add the relative_path argument to adapter the root_build_dir

Signed-off-by: chuxuezhe111 <hanjixiao@huawei.com>
This commit is contained in:
chuxuezhe111
2022-06-29 01:22:00 -07:00
parent 36fcd65451
commit 2289db98d4
4 changed files with 14 additions and 6 deletions
+4 -2
View File
@@ -37,9 +37,11 @@ if __name__ == '__main__':
help='the module path') help='the module path')
PARSER_INST.add_argument('--out-file', PARSER_INST.add_argument('--out-file',
help='js output 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() 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) os.chdir(("%s" + INPUT_ARGUMENTS.module_path) % BUILD_PATH)
NODE_PATH = '../../../../prebuilts/build-tools/common/nodejs/\ NODE_PATH = '../../../../prebuilts/build-tools/common/nodejs/\
node-v12.18.4-linux-x64/bin/node' node-v12.18.4-linux-x64/bin/node'
@@ -55,4 +57,4 @@ typescript/bin/tsc'
CMD_INST = shutil.rmtree('./out') CMD_INST = shutil.rmtree('./out')
exit(0) exit(0)
+2
View File
@@ -40,6 +40,8 @@ action("build_js_ts") {
args = [ args = [
"--dst-file", "--dst-file",
rebase_path(target_out_dir + "/"), rebase_path(target_out_dir + "/"),
"--relative-path",
rebase_path("//", root_build_dir),
] ]
depfile = "$target_gen_dir/$target_name.d" depfile = "$target_gen_dir/$target_name.d"
outputs = [] outputs = []
+6 -4
View File
@@ -27,15 +27,17 @@ def run_command(command):
exit(1) exit(1)
if __name__ == '__main__': 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 = argparse.ArgumentParser()
parser.add_argument('--dst-file', parser.add_argument('--dst-file',
help='the converted target 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() 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_PATH = '../../../../prebuilts/build-tools/common/nodejs/\
node-v12.18.4-linux-x64/bin/node' node-v12.18.4-linux-x64/bin/node'
TSC_PATH = '../../../../ark/ts2abc/ts2panda/node_modules/typescript/bin/tsc' TSC_PATH = '../../../../ark/ts2abc/ts2panda/node_modules/typescript/bin/tsc'
+2
View File
@@ -26,6 +26,8 @@ action("build_ts_js") {
rebase_path("/base/compileruntime/js_util_module/util"), rebase_path("/base/compileruntime/js_util_module/util"),
"--out-file", "--out-file",
rebase_path("./out/util_js.js"), rebase_path("./out/util_js.js"),
"--relative-path",
rebase_path("//", root_build_dir),
] ]
depfile = "$target_gen_dir/$target_name.d" depfile = "$target_gen_dir/$target_name.d"
outputs = [ target_out_dir + "/util_js.js" ] outputs = [ target_out_dir + "/util_js.js" ]