2021-10-14 06:33:13 +00:00
|
|
|
# Copyright (c) 2021 Huawei Device Co., Ltd.
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2021-08-28 08:48:39 +00:00
|
|
|
|
|
|
|
import("//build/ohos.gni")
|
|
|
|
import("//build/ohos/ace/ace.gni")
|
2022-08-04 09:08:56 +00:00
|
|
|
import("//build/ohos_var.gni")
|
2022-04-20 09:38:43 +00:00
|
|
|
import("//foundation/arkui/ace_engine/ace_config.gni")
|
2022-08-04 09:08:56 +00:00
|
|
|
if (sdk_build_public) {
|
|
|
|
import("//out/sdk-public/public_interface/sdk-js/interface_config.gni")
|
|
|
|
} else {
|
|
|
|
import("//interface/sdk-js/interface_config.gni")
|
|
|
|
}
|
2021-08-28 08:48:39 +00:00
|
|
|
|
|
|
|
ets_loader_lib_dir =
|
|
|
|
get_label_info(":build_ets_loader_library", "target_out_dir") + "/lib"
|
|
|
|
ets_loader_declarations_dir = get_label_info(":build_ets_loader_library",
|
|
|
|
"target_out_dir") + "/declarations"
|
|
|
|
ets_loader_component_config_file =
|
|
|
|
get_label_info(":build_ets_loader_library", "target_out_dir") +
|
|
|
|
"/component_config.json"
|
2023-02-08 05:55:07 +00:00
|
|
|
ets_loader_form_config_file =
|
|
|
|
get_label_info(":build_ets_loader_library", "target_out_dir") +
|
|
|
|
"/form_config.json"
|
2024-05-11 09:40:15 +00:00
|
|
|
ets_loader_build_config_file =
|
|
|
|
get_label_info(":build_ets_loader_library", "target_out_dir") +
|
|
|
|
"/build_config.json"
|
2021-10-14 06:33:13 +00:00
|
|
|
ets_sysResource = get_label_info(":build_ets_sysResource", "target_out_dir") +
|
|
|
|
"/sysResource.js"
|
2023-12-14 10:01:55 +00:00
|
|
|
ets_loader_kit_configs_dir = get_label_info(":build_ets_loader_library",
|
|
|
|
"target_out_dir") + "/kit_configs"
|
2021-08-28 08:48:39 +00:00
|
|
|
|
|
|
|
action("build_ets_loader_library") {
|
2021-12-21 09:18:35 +00:00
|
|
|
deps = [
|
|
|
|
":components",
|
2023-02-08 05:55:07 +00:00
|
|
|
":form_components",
|
2023-12-05 10:15:07 +00:00
|
|
|
":install_arkguard_tsc",
|
2021-12-21 09:18:35 +00:00
|
|
|
":server",
|
|
|
|
]
|
2021-10-14 06:33:13 +00:00
|
|
|
script = "build_ets_loader_library.py"
|
2021-08-28 08:48:39 +00:00
|
|
|
depfile = "$target_gen_dir/$target_name.d"
|
|
|
|
outputs = [
|
|
|
|
ets_loader_lib_dir,
|
|
|
|
ets_loader_declarations_dir,
|
|
|
|
ets_loader_component_config_file,
|
2023-02-08 05:55:07 +00:00
|
|
|
ets_loader_form_config_file,
|
2023-12-14 10:01:55 +00:00
|
|
|
ets_loader_kit_configs_dir,
|
2024-05-11 09:40:15 +00:00
|
|
|
ets_loader_build_config_file,
|
2021-08-28 08:48:39 +00:00
|
|
|
]
|
|
|
|
|
2021-10-14 06:33:13 +00:00
|
|
|
_ets_loader_dir = "compiler"
|
|
|
|
if (is_standard_system) {
|
|
|
|
_ace_config_dir = "compiler"
|
|
|
|
} else {
|
|
|
|
_ace_config_dir = "//prebuilts/ace-toolkit/ets-loader/compiler"
|
|
|
|
}
|
2021-08-28 08:48:39 +00:00
|
|
|
_declarations_file_dir = "//interface/sdk-js/api/@internal/component/ets"
|
2023-12-23 08:02:49 +00:00
|
|
|
_kit_configs_file_dir = "//interface/sdk-js/kits"
|
2024-02-15 03:45:12 +00:00
|
|
|
_kit_apis_file_dir = "//interface/sdk-js/api"
|
2024-03-25 03:34:30 +00:00
|
|
|
_arkts_apis_file_dir = "//interface/sdk-js/arkts"
|
2024-01-13 09:29:42 +00:00
|
|
|
isPublic = "false"
|
2022-08-04 09:08:56 +00:00
|
|
|
if (sdk_build_public) {
|
|
|
|
_declarations_file_dir =
|
|
|
|
"//out/sdk-public/public_interface/sdk-js/api/@internal/component/ets"
|
2023-12-23 08:02:49 +00:00
|
|
|
_kit_configs_file_dir = "//out/sdk-public/public_interface/sdk-js/kits"
|
2024-02-15 03:45:12 +00:00
|
|
|
_kit_apis_file_dir = "//out/sdk-public/public_interface/sdk-js/api"
|
2024-03-25 03:34:30 +00:00
|
|
|
_arkts_apis_file_dir = "//out/sdk-public/public_interface/sdk-js/arkts"
|
2024-01-13 09:29:42 +00:00
|
|
|
isPublic = "true"
|
2022-08-04 09:08:56 +00:00
|
|
|
}
|
2021-08-28 08:48:39 +00:00
|
|
|
|
2021-10-14 06:33:13 +00:00
|
|
|
_babel_js = _ace_config_dir + "/node_modules/@babel/cli/bin/babel.js"
|
|
|
|
_babel_config_js = _ace_config_dir + "/babel.config.js"
|
|
|
|
_uglify_source_js = _ace_config_dir + "/uglify-source.js"
|
|
|
|
_build_declarations_file_js = _ace_config_dir + "/build_declarations_file.js"
|
2023-12-14 10:01:55 +00:00
|
|
|
_build_kit_configs_file_js = _ace_config_dir + "/build_kitConfigs_file.js"
|
2021-08-28 08:48:39 +00:00
|
|
|
|
|
|
|
inputs = [
|
|
|
|
_babel_config_js,
|
|
|
|
_babel_js,
|
|
|
|
_uglify_source_js,
|
|
|
|
_build_declarations_file_js,
|
2023-12-14 10:01:55 +00:00
|
|
|
_build_kit_configs_file_js,
|
2021-08-28 08:48:39 +00:00
|
|
|
]
|
|
|
|
|
2023-04-24 14:08:56 +00:00
|
|
|
nodejs_path = "//prebuilts/build-tools/common/nodejs/current/bin/node"
|
2021-08-28 08:48:39 +00:00
|
|
|
|
|
|
|
args = [
|
|
|
|
"--depfile",
|
|
|
|
rebase_path(depfile, root_build_dir),
|
|
|
|
"--node",
|
|
|
|
rebase_path(nodejs_path, root_build_dir),
|
|
|
|
"--babel-js",
|
|
|
|
rebase_path(_babel_js, root_build_dir),
|
|
|
|
"--ets-loader-src-dir",
|
|
|
|
rebase_path(_ets_loader_dir + "/src", root_build_dir),
|
|
|
|
"--babel-config-js",
|
|
|
|
rebase_path(_babel_config_js, root_build_dir),
|
|
|
|
"--uglify-source-js",
|
|
|
|
rebase_path(_uglify_source_js, root_build_dir),
|
|
|
|
"--output-dir",
|
|
|
|
rebase_path(ets_loader_lib_dir, root_build_dir),
|
|
|
|
"--declarations-file-dir",
|
|
|
|
rebase_path(_declarations_file_dir, root_build_dir),
|
|
|
|
"--build-declarations-file-js",
|
|
|
|
rebase_path(_build_declarations_file_js, root_build_dir),
|
|
|
|
"--output-declarations-dir",
|
|
|
|
rebase_path(ets_loader_declarations_dir, root_build_dir),
|
|
|
|
"--output-component-config-file",
|
|
|
|
rebase_path(ets_loader_component_config_file, root_build_dir),
|
2023-02-08 05:55:07 +00:00
|
|
|
"--output-form-config-file",
|
|
|
|
rebase_path(ets_loader_form_config_file, root_build_dir),
|
2024-05-11 09:40:15 +00:00
|
|
|
"--output-build-config-file",
|
|
|
|
rebase_path(ets_loader_build_config_file, root_build_dir),
|
2023-12-14 10:01:55 +00:00
|
|
|
"--kit-configs-file-dir",
|
|
|
|
rebase_path(_kit_configs_file_dir, root_build_dir),
|
|
|
|
"--build-kit-configs-file-js",
|
|
|
|
rebase_path(_build_kit_configs_file_js, root_build_dir),
|
|
|
|
"--output-kit-configs-dir",
|
|
|
|
rebase_path(ets_loader_kit_configs_dir, root_build_dir),
|
2024-02-15 03:45:12 +00:00
|
|
|
"--kit-apis-file-dir",
|
|
|
|
rebase_path(_kit_apis_file_dir, root_build_dir),
|
2024-03-25 03:34:30 +00:00
|
|
|
"--arkts-apis-file-dir",
|
|
|
|
rebase_path(_arkts_apis_file_dir, root_build_dir),
|
2024-01-13 09:29:42 +00:00
|
|
|
"--build-public-sdk",
|
|
|
|
isPublic,
|
2021-08-28 08:48:39 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2021-10-14 06:33:13 +00:00
|
|
|
action("build_ets_sysResource") {
|
2021-12-21 09:02:38 +00:00
|
|
|
if (is_standard_system) {
|
2022-08-16 13:17:51 +00:00
|
|
|
script = "//developtools/ace_ets2bundle/generateSysResource.py"
|
2021-12-21 09:02:38 +00:00
|
|
|
} else {
|
|
|
|
script = "//foundation/ace/huawei_proprietary/tools/ets-loader/generateSysResource.py"
|
|
|
|
}
|
2021-10-14 06:33:13 +00:00
|
|
|
outputs = [ ets_sysResource ]
|
|
|
|
|
2022-09-24 02:34:44 +00:00
|
|
|
_id_defined_json = "//base/global/system_resources/systemres/main/resources/base/element/id_defined.json"
|
2021-10-14 06:33:13 +00:00
|
|
|
inputs = [ _id_defined_json ]
|
|
|
|
|
|
|
|
args = [
|
|
|
|
"--input-json",
|
|
|
|
rebase_path(_id_defined_json, root_build_dir),
|
|
|
|
"--output-js",
|
|
|
|
rebase_path(ets_sysResource, root_build_dir),
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2021-12-22 03:02:21 +00:00
|
|
|
ets_loader_sources = [
|
2023-01-29 03:15:14 +00:00
|
|
|
"compiler/compile_plugin.js",
|
2024-08-02 03:52:57 +00:00
|
|
|
"compiler/config/obfuscateWhiteList.json5",
|
2021-12-22 03:02:21 +00:00
|
|
|
"compiler/main.js",
|
2023-06-25 07:29:35 +00:00
|
|
|
"compiler/node_modules",
|
2021-12-22 03:02:21 +00:00
|
|
|
"compiler/npm-install.js",
|
|
|
|
"compiler/package-lock.json",
|
|
|
|
"compiler/package.json",
|
2023-01-29 03:15:14 +00:00
|
|
|
"compiler/rollup.config.js",
|
2022-06-10 09:10:02 +00:00
|
|
|
"compiler/tsconfig.esm.json",
|
2021-12-22 03:02:21 +00:00
|
|
|
"compiler/tsconfig.json",
|
|
|
|
"compiler/webpack.config.js",
|
|
|
|
]
|
|
|
|
|
2021-08-28 08:48:39 +00:00
|
|
|
ohos_copy("ets_loader") {
|
2023-12-05 10:15:07 +00:00
|
|
|
deps = [
|
|
|
|
":build_ets_loader_library",
|
|
|
|
":install_arkguard_tsc",
|
|
|
|
]
|
2021-12-22 03:02:21 +00:00
|
|
|
sources = ets_loader_sources
|
2021-12-25 02:16:36 +00:00
|
|
|
deps += [ ":build_ets_sysResource" ]
|
|
|
|
sources += [ ets_sysResource ]
|
2021-12-21 09:02:38 +00:00
|
|
|
|
2021-08-28 08:48:39 +00:00
|
|
|
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
}
|
|
|
|
|
2022-01-13 07:58:08 +00:00
|
|
|
ohos_copy("ets_loader_component_config") {
|
|
|
|
deps = [ ":build_ets_loader_library" ]
|
2024-05-11 09:40:15 +00:00
|
|
|
sources = [
|
|
|
|
ets_loader_build_config_file,
|
|
|
|
ets_loader_component_config_file,
|
|
|
|
]
|
2022-01-13 07:58:08 +00:00
|
|
|
|
|
|
|
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
}
|
|
|
|
|
2023-02-08 05:55:07 +00:00
|
|
|
ohos_copy("ets_loader_form_config") {
|
|
|
|
deps = [ ":build_ets_loader_library" ]
|
|
|
|
sources = [ ets_loader_form_config_file ]
|
|
|
|
|
|
|
|
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
}
|
|
|
|
|
2021-08-28 08:48:39 +00:00
|
|
|
ohos_copy("ets_loader_library") {
|
|
|
|
deps = [ ":build_ets_loader_library" ]
|
|
|
|
sources = [ ets_loader_lib_dir ]
|
|
|
|
outputs = [ target_out_dir + "/$target_name" ]
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
}
|
|
|
|
|
2023-12-09 03:32:20 +00:00
|
|
|
ohos_copy("ets_loader_kit_configs") {
|
2023-12-14 10:01:55 +00:00
|
|
|
deps = [ ":build_ets_loader_library" ]
|
|
|
|
sources = [ ets_loader_kit_configs_dir ]
|
2023-12-09 03:32:20 +00:00
|
|
|
outputs = [ target_out_dir + "/$target_name" ]
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
}
|
|
|
|
|
2021-12-21 09:02:38 +00:00
|
|
|
ohos_copy("components") {
|
|
|
|
sources = [ "compiler/components" ]
|
|
|
|
outputs = [ target_out_dir + "/$target_name" ]
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
}
|
|
|
|
|
2023-02-08 05:55:07 +00:00
|
|
|
ohos_copy("form_components") {
|
|
|
|
sources = [ "compiler/form_components" ]
|
|
|
|
outputs = [ target_out_dir + "/$target_name" ]
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
}
|
|
|
|
|
2021-12-21 09:02:38 +00:00
|
|
|
ohos_copy("server") {
|
|
|
|
sources = [ "compiler/server" ]
|
|
|
|
outputs = [ target_out_dir + "/$target_name" ]
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
}
|
|
|
|
|
2022-01-18 02:35:14 +00:00
|
|
|
ohos_copy("codegen") {
|
|
|
|
sources = [ "compiler/codegen" ]
|
|
|
|
outputs = [ target_out_dir + "/$target_name" ]
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
}
|
|
|
|
|
2021-08-28 08:48:39 +00:00
|
|
|
ohos_copy("ets_loader_declaration") {
|
|
|
|
deps = [ ":build_ets_loader_library" ]
|
|
|
|
sources = [ ets_loader_declarations_dir ]
|
|
|
|
outputs = [ target_out_dir + "/$target_name" ]
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
}
|
2021-12-22 03:02:21 +00:00
|
|
|
|
|
|
|
ohos_copy("ets_loader_ark") {
|
2023-12-05 10:15:07 +00:00
|
|
|
deps = [
|
|
|
|
":build_ets_loader_library",
|
|
|
|
":install_arkguard_tsc",
|
|
|
|
]
|
2021-12-22 03:02:21 +00:00
|
|
|
sources = ets_loader_sources
|
2021-12-25 02:16:36 +00:00
|
|
|
deps += [ ":build_ets_sysResource" ]
|
|
|
|
sources += [ ets_sysResource ]
|
2021-12-22 03:02:21 +00:00
|
|
|
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_copy("ets_loader_ark_lib") {
|
|
|
|
deps = [
|
|
|
|
":build_ets_loader_library",
|
|
|
|
":ets_loader_ark",
|
|
|
|
]
|
|
|
|
sources = [ ets_loader_lib_dir ]
|
|
|
|
outputs = [ target_out_dir + "/ets_loader_ark/lib" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_copy("ets_loader_ark_declaration") {
|
|
|
|
deps = [
|
|
|
|
":build_ets_loader_library",
|
|
|
|
":ets_loader_ark",
|
|
|
|
]
|
|
|
|
sources = [ ets_loader_declarations_dir ]
|
|
|
|
outputs = [ target_out_dir + "/ets_loader_ark/declarations" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_copy("ets_loader_ark_components") {
|
|
|
|
deps = [
|
|
|
|
":build_ets_loader_library",
|
|
|
|
":ets_loader_ark",
|
|
|
|
]
|
|
|
|
sources = [ "compiler/components" ]
|
|
|
|
outputs = [ target_out_dir + "/ets_loader_ark/components" ]
|
|
|
|
}
|
|
|
|
|
2023-02-08 05:55:07 +00:00
|
|
|
ohos_copy("ets_loader_ark_form_components") {
|
|
|
|
deps = [
|
|
|
|
":build_ets_loader_library",
|
|
|
|
":ets_loader_ark",
|
|
|
|
]
|
|
|
|
sources = [ "compiler/form_components" ]
|
|
|
|
outputs = [ target_out_dir + "/ets_loader_ark/form_components" ]
|
|
|
|
}
|
|
|
|
|
2021-12-22 03:02:21 +00:00
|
|
|
ohos_copy("ets_loader_ark_server") {
|
|
|
|
deps = [
|
|
|
|
":build_ets_loader_library",
|
|
|
|
":ets_loader_ark",
|
|
|
|
]
|
|
|
|
sources = [ "compiler/server" ]
|
|
|
|
outputs = [ target_out_dir + "/ets_loader_ark/server" ]
|
|
|
|
}
|
|
|
|
|
2022-01-18 02:35:14 +00:00
|
|
|
ohos_copy("ets_loader_ark_codegen") {
|
|
|
|
deps = [
|
|
|
|
":build_ets_loader_library",
|
|
|
|
":ets_loader_ark",
|
|
|
|
]
|
|
|
|
sources = [ "compiler/codegen" ]
|
|
|
|
outputs = [ target_out_dir + "/ets_loader_ark/codegen" ]
|
|
|
|
}
|
|
|
|
|
2022-03-10 07:28:18 +00:00
|
|
|
ohos_copy("ohos_declaration_ets_ark") {
|
2022-08-04 09:08:56 +00:00
|
|
|
deps = []
|
|
|
|
if (sdk_build_public) {
|
|
|
|
deps += [ "//out/sdk-public/public_interface/sdk-js:ohos_declaration_ets" ]
|
|
|
|
} else {
|
|
|
|
deps += [ "//interface/sdk-js:ohos_declaration_ets" ]
|
|
|
|
}
|
2022-03-10 07:28:18 +00:00
|
|
|
|
|
|
|
sources = [ root_out_dir + "/ohos_declaration/ohos_declaration_ets" ]
|
|
|
|
|
|
|
|
outputs = [ target_out_dir + "/../api" ]
|
|
|
|
}
|
|
|
|
|
2023-06-25 07:29:35 +00:00
|
|
|
ohos_copy("ets_loader_ark_hap") {
|
2022-03-10 07:28:18 +00:00
|
|
|
sources = common_api_src
|
2021-12-22 03:02:21 +00:00
|
|
|
deps = [
|
|
|
|
":ets_loader_ark",
|
2022-01-18 02:35:14 +00:00
|
|
|
":ets_loader_ark_codegen",
|
2021-12-22 03:02:21 +00:00
|
|
|
":ets_loader_ark_components",
|
|
|
|
":ets_loader_ark_declaration",
|
2023-02-08 05:55:07 +00:00
|
|
|
":ets_loader_ark_form_components",
|
2021-12-22 03:02:21 +00:00
|
|
|
":ets_loader_ark_lib",
|
|
|
|
":ets_loader_ark_server",
|
2023-06-25 07:29:35 +00:00
|
|
|
":ohos_declaration_ets_ark",
|
2021-12-22 03:02:21 +00:00
|
|
|
]
|
2023-06-25 07:29:35 +00:00
|
|
|
outputs = [ target_out_dir + "/../../developtools/api/{{source_file_part}}" ]
|
|
|
|
module_install_name = ""
|
2021-12-22 03:02:21 +00:00
|
|
|
}
|
2023-12-05 10:15:07 +00:00
|
|
|
|
2024-03-05 09:14:10 +00:00
|
|
|
typescript_dir = get_label_info("//third_party/typescript:build_typescript",
|
|
|
|
"target_out_dir")
|
|
|
|
|
2023-12-05 10:15:07 +00:00
|
|
|
action("install_arkguard_tsc") {
|
|
|
|
deps = [
|
|
|
|
"//arkcompiler/ets_frontend/arkguard:build_arkguard",
|
|
|
|
"//third_party/typescript:build_typescript",
|
|
|
|
]
|
|
|
|
script = "install_arkguard_tsc.py"
|
|
|
|
args = [
|
2024-03-05 09:14:10 +00:00
|
|
|
rebase_path("${typescript_dir}/ohos-typescript-4.9.5-r4.tgz"),
|
2023-12-05 10:15:07 +00:00
|
|
|
rebase_path(
|
|
|
|
"${root_out_dir}/obj/arkcompiler/ets_frontend/arkguard/arkguard-1.1.3.tgz"),
|
|
|
|
rebase_path("//developtools/ace_ets2bundle/compiler"),
|
|
|
|
current_os,
|
|
|
|
]
|
|
|
|
outputs = [ "${target_out_dir}/${target_name}.stamp" ]
|
|
|
|
}
|