Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
BUILD.gn 9.88 KB
Copy Edit Raw Blame History
yfwang6 authored 2022-08-16 21:17 . wangyongfei6@huawei.com
# 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.
import("//build/ohos.gni")
import("//build/ohos/ace/ace.gni")
import("//build/ohos_var.gni")
import("//foundation/arkui/ace_engine/ace_config.gni")
if (sdk_build_public) {
import("//out/sdk-public/public_interface/sdk-js/interface_config.gni")
} else {
import("//interface/sdk-js/interface_config.gni")
}
ets_loader_lib_dir =
get_label_info(":build_ets_loader_library", "target_out_dir") + "/lib"
ets_loader_syntax_dir = get_label_info(":build_ets_loader_library",
"target_out_dir") + "/syntax_parser/dist"
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"
ets_sysResource = get_label_info(":build_ets_sysResource", "target_out_dir") +
"/sysResource.js"
action("build_ets_loader_library") {
deps = [
":components",
":server",
]
script = "build_ets_loader_library.py"
depfile = "$target_gen_dir/$target_name.d"
outputs = [
ets_loader_lib_dir,
ets_loader_syntax_dir,
ets_loader_declarations_dir,
ets_loader_component_config_file,
]
_ets_loader_dir = "compiler"
if (is_standard_system) {
_ace_config_dir = "compiler"
} else {
_ace_config_dir = "//prebuilts/ace-toolkit/ets-loader/compiler"
}
_declarations_file_dir = "//interface/sdk-js/api/@internal/component/ets"
if (sdk_build_public) {
_declarations_file_dir =
"//out/sdk-public/public_interface/sdk-js/api/@internal/component/ets"
}
_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_parser_js = _ace_config_dir + "/build_parser.js"
_build_declarations_file_js = _ace_config_dir + "/build_declarations_file.js"
inputs = [
_babel_config_js,
_babel_js,
_uglify_source_js,
_build_parser_js,
_build_declarations_file_js,
]
# different host platform nodejs tool directory
if (host_os == "linux") {
if (is_standard_system) {
nodejs_path = "//prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/node"
} else {
nodejs_path =
"//prebuilts/ace-toolkit/nodejs/node-v12.18.4-linux-x64/bin/node"
}
} else if (host_os == "mac") {
if (is_standard_system) {
nodejs_path = "//prebuilts/build-tools/common/nodejs/node-v12.18.4-darwin-x64/bin/node"
} else {
nodejs_path =
"//prebuilts/ace-toolkit/nodejs/node-v12.18.4-darwin-x64/bin/node"
}
} else {
assert(false, "Unsupported host_os: $host_os")
}
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),
"--ets-loader-syntax-src-dir",
rebase_path(_ets_loader_dir + "/syntax_parser/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),
"--build-parser-js",
rebase_path(_build_parser_js, root_build_dir),
"--output-dir",
rebase_path(ets_loader_lib_dir, root_build_dir),
"--output-syntax-dir",
rebase_path(ets_loader_syntax_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),
]
}
action("build_ets_sysResource") {
if (is_standard_system) {
script = "//developtools/ace_ets2bundle/generateSysResource.py"
} else {
script = "//foundation/ace/huawei_proprietary/tools/ets-loader/generateSysResource.py"
}
outputs = [ ets_sysResource ]
_id_defined_json = "//utils/system_resources/systemres/main/resources/base/element/id_defined.json"
inputs = [ _id_defined_json ]
args = [
"--input-json",
rebase_path(_id_defined_json, root_build_dir),
"--output-js",
rebase_path(ets_sysResource, root_build_dir),
]
}
ets_loader_sources = [
"compiler/main.js",
"compiler/npm-install.js",
"compiler/package-lock.json",
"compiler/package.json",
"compiler/tsconfig.esm.json",
"compiler/tsconfig.json",
"compiler/webpack.config.js",
]
ohos_copy("ets_loader_deps") {
sources =
[ "//third_party/typescript/build_package/ohos-typescript-4.2.3-r2.tgz" ]
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
module_source_dir = target_out_dir + "/$target_name"
module_install_name = ""
license_file = "//third_party/typescript/LICENSE"
}
ohos_copy("ets_loader") {
deps = [
":build_ets_loader_library",
":ets_loader_deps",
]
sources = ets_loader_sources
deps += [ ":build_ets_sysResource" ]
sources += [ ets_sysResource ]
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
module_source_dir = target_out_dir + "/$target_name"
module_install_name = ""
}
ohos_copy("ets_loader_component_config") {
deps = [ ":build_ets_loader_library" ]
sources = [ ets_loader_component_config_file ]
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
module_source_dir = target_out_dir + "/$target_name"
module_install_name = ""
}
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 = ""
}
ohos_copy("ets_loader_syntax") {
deps = [ ":build_ets_loader_library" ]
sources = [ ets_loader_syntax_dir ]
outputs = [ target_out_dir + "/$target_name" ]
module_source_dir = target_out_dir + "/$target_name"
module_install_name = ""
}
ohos_copy("components") {
sources = [ "compiler/components" ]
outputs = [ target_out_dir + "/$target_name" ]
module_source_dir = target_out_dir + "/$target_name"
module_install_name = ""
}
ohos_copy("server") {
sources = [ "compiler/server" ]
outputs = [ target_out_dir + "/$target_name" ]
module_source_dir = target_out_dir + "/$target_name"
module_install_name = ""
}
ohos_copy("codegen") {
sources = [ "compiler/codegen" ]
outputs = [ target_out_dir + "/$target_name" ]
module_source_dir = target_out_dir + "/$target_name"
module_install_name = ""
}
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 = ""
}
ohos_copy("ets_loader_ark") {
deps = [ ":build_ets_loader_library" ]
sources = ets_loader_sources
deps += [ ":build_ets_sysResource" ]
sources += [ ets_sysResource ]
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_syntax") {
deps = [
":build_ets_loader_library",
":ets_loader_ark",
]
sources = [ ets_loader_syntax_dir ]
outputs = [ target_out_dir + "/ets_loader_ark/syntax_parser/dist" ]
}
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" ]
}
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" ]
}
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" ]
}
ohos_copy("ohos_declaration_ets_ark") {
deps = []
if (sdk_build_public) {
deps += [ "//out/sdk-public/public_interface/sdk-js:ohos_declaration_ets" ]
} else {
deps += [ "//interface/sdk-js:ohos_declaration_ets" ]
}
sources = [ root_out_dir + "/ohos_declaration/ohos_declaration_ets" ]
outputs = [ target_out_dir + "/../api" ]
}
ohos_copy("common_api_ark") {
sources = common_api_src
deps = [ ":ohos_declaration_ets_ark" ]
outputs = [ target_out_dir + "/../../developtools/api/{{source_file_part}}" ]
module_install_name = ""
}
ohos_copy("ets_loader_node_modules") {
deps = [
":common_api_ark",
":ets_loader_ark",
":ets_loader_ark_codegen",
":ets_loader_ark_components",
":ets_loader_ark_declaration",
":ets_loader_ark_lib",
":ets_loader_ark_server",
":ets_loader_ark_syntax",
]
sources = [ "//developtools/ace_ets2bundle/compiler/node_modules" ]
outputs = [ target_out_dir + "/ets_loader_ark/node_modules" ]
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化