From ef4ee2c3b8d55cc1ae20c94064122c7ee146c99e Mon Sep 17 00:00:00 2001 From: chuxuezhe111 Date: Wed, 29 Jun 2022 01:22:00 -0700 Subject: [PATCH] add the relative_path argument to adapter the root_build_dir Signed-off-by: chuxuezhe111 --- build_ts_js.py | 6 ++++-- container/BUILD.gn | 2 ++ container/build_ts_js.py | 10 ++++++---- util/BUILD.gn | 2 ++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/build_ts_js.py b/build_ts_js.py index f1ddd35..20ec59e 100755 --- a/build_ts_js.py +++ b/build_ts_js.py @@ -37,9 +37,11 @@ if __name__ == '__main__': help='the module path') PARSER_INST.add_argument('--out-file', help='js output file') + PARSER_INST.add_argument('--relative-path', + help='the code root path relative the root_build_dir') INPUT_ARGUMENTS = PARSER_INST.parse_args() - BUILD_PATH = os.path.abspath(os.path.join(os.getcwd(), "../..")) + BUILD_PATH = os.path.abspath(os.path.join(os.getcwd(), INPUT_ARGUMENTS.relative_path)) os.chdir(("%s" + INPUT_ARGUMENTS.module_path) % BUILD_PATH) NODE_PATH = '../../../../prebuilts/build-tools/common/nodejs/\ node-v12.18.4-linux-x64/bin/node' @@ -55,4 +57,4 @@ typescript/bin/tsc' CMD_INST = shutil.rmtree('./out') - exit(0) \ No newline at end of file + exit(0) diff --git a/container/BUILD.gn b/container/BUILD.gn index 1efcba7..5c65243 100644 --- a/container/BUILD.gn +++ b/container/BUILD.gn @@ -40,6 +40,8 @@ action("build_js_ts") { args = [ "--dst-file", rebase_path(target_out_dir + "/"), + "--relative-path", + rebase_path("//", root_build_dir), ] depfile = "$target_gen_dir/$target_name.d" outputs = [] diff --git a/container/build_ts_js.py b/container/build_ts_js.py index f24320a..20abe9e 100755 --- a/container/build_ts_js.py +++ b/container/build_ts_js.py @@ -27,15 +27,17 @@ def run_command(command): exit(1) if __name__ == '__main__': - - build_path = os.path.abspath(os.path.join(os.getcwd(), "../..")) - os.chdir("%s/base/compileruntime/js_util_module/container/" % build_path) - parser = argparse.ArgumentParser() parser.add_argument('--dst-file', help='the converted target file') + parser.add_argument('--relative-path', + help='the code root path relative the root_build_dir') input_arguments = parser.parse_args() + build_path = os.path.abspath(os.path.join(os.getcwd(), input_arguments.relative_path)) + os.chdir("%s/base/compileruntime/js_util_module/container/" % build_path) + + NODE_PATH = '../../../../prebuilts/build-tools/common/nodejs/\ node-v12.18.4-linux-x64/bin/node' TSC_PATH = '../../../../ark/ts2abc/ts2panda/node_modules/typescript/bin/tsc' diff --git a/util/BUILD.gn b/util/BUILD.gn index c9da00f..db50055 100755 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -26,6 +26,8 @@ action("build_ts_js") { rebase_path("/base/compileruntime/js_util_module/util"), "--out-file", rebase_path("./out/util_js.js"), + "--relative-path", + rebase_path("//", root_build_dir), ] depfile = "$target_gen_dir/$target_name.d" outputs = [ target_out_dir + "/util_js.js" ] -- Gitee