diff --git a/build_ts_js.py b/build_ts_js.py index f1ddd35e929aa58ca7c42d10d188dcbf7cd55b5c..20ec59ea404a098151b4e3cefa3c8008cea72b05 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 1efcba73655af7440c0cae8d13cfe459361ec780..5c652433dcf3220bf58af9714494f115d8674872 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 f24320aebe1259eb8675b498a63428682bc02b4c..20abe9edb6245061dc3a47aa237599c07f7c2a1c 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 c9da00fdeab6eb55ee7db30946f7d361284f4e21..db5005530f8b447177815dddaca6fdcdf61220e7 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" ]