Files
js_api_module/js_util_module/container/BUILD.gn
T
lengchangjing 1956f2e85d Switch component name from ts_js_lang_library to ets_utils for js_api_module,js_util_module,js_sys_module,js_worker_module
Related Issue
https://gitee.com/openharmony/manifest/issues/I5HDQT

Description
Switch component name from ts_js_lang_library to ets_utils for js_api_module,js_util_module,js_sys_module,js_worker_module

Signed-off-by: lengchangjing <lengchangjing@huawei.com>
2022-07-20 16:16:30 +08:00

145 lines
3.8 KiB
Plaintext

# 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("//arkcompiler/ets_frontend/ts2panda/ts2abc_config.gni")
import("//build/ohos.gni")
import("//build/ohos/ace/ace.gni")
import("//foundation/arkui/ace_engine/ace_config.gni")
container_names = [
"arraylist",
"deque",
"queue",
"vector",
"linkedlist",
"list",
"stack",
"struct",
"treemap",
"treeset",
"hashmap",
"hashset",
"lightweightmap",
"lightweightset",
"plainarray",
]
# compile .ts to .js.
action("build_js_ts") {
script = "//commonlibrary/ets_utils/js_util_module/container/build_ts_js.py"
args = [
"--dst-file",
rebase_path(target_out_dir + "/"),
"--relative-path",
rebase_path("//", root_build_dir),
]
depfile = "$target_gen_dir/$target_name.d"
outputs = []
foreach(item, container_names) {
dep = target_out_dir + "/js_" + item + ".js"
outputs += [ dep ]
}
}
# libs
template("container_lib") {
forward_variables_from(invoker, "*")
name = target_name
base_output_path = get_label_info(":js_" + name, "target_out_dir")
js_container_obj_path = base_output_path + name + ".o"
gen_js_obj("js_" + name) {
input = "$target_out_dir/js_" + name + ".js"
output = js_container_obj_path
dep = ":build_js_ts"
}
# compile .js to .abc.
action("gen_" + name + "_abc") {
visibility = [ ":*" ]
script =
"//arkcompiler/ets_frontend/ts2panda/scripts/generate_js_bytecode.py"
args = [
"--src-js",
rebase_path(target_out_dir + "/js_" + name + ".js"),
"--dst-file",
rebase_path(target_out_dir + "/" + name + ".abc"),
"--node",
rebase_path("${node_path}"),
"--frontend-tool-path",
rebase_path("${ts2abc_build_path}"),
"--node-modules",
rebase_path("${node_modules}"),
"--module",
]
deps = [
":build_js_ts",
"//arkcompiler/ets_frontend/ts2panda:ark_ts2abc_build",
]
inputs = [ target_out_dir + "/js_" + name + ".js" ]
outputs = [ target_out_dir + "/" + name + ".abc" ]
}
abc_output_path = get_label_info(":" + name + "_abc", "target_out_dir")
arraylist_abc_obj_path = abc_output_path + "/" + name + "_abc.o"
gen_js_obj(name + "_abc") {
input = "$target_out_dir/" + name + ".abc"
output = arraylist_abc_obj_path
dep = ":gen_" + target_name
}
ohos_shared_library(name) {
include_dirs = [
"//third_party/node/src",
"//foundation/arkui/napi/interfaces/kits",
"//commonlibrary/ets_utils/js_util_module/container/" + name,
]
sources = [ name + "/native_module_" + name + ".cpp" ]
dep_abc = ":" + name + "_abc"
dep_js = ":js_" + name
deps = [
"//commonlibrary/ets_utils/js_util_module/container/:js_" + name,
"//foundation/arkui/napi/:ace_napi",
"//utils/native/base:utils",
]
deps += [ dep_abc ]
deps += [ dep_js ]
if (is_standard_system) {
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
} else {
external_deps = [ "hilog:libhilog" ]
}
subsystem_name = "commonlibrary"
part_name = "ets_utils"
relative_install_dir = "module/util"
}
}
container_libs = []
foreach(item, container_names) {
container_lib(item) {
}
dep = ":" + item
container_libs += [ dep ]
}
group("container_packages") {
deps = container_libs
}