From 271d819a29517a8e28d2cc1d232aec5e2dfcdc76 Mon Sep 17 00:00:00 2001 From: lubinglun Date: Sun, 23 Apr 2023 20:03:30 +0800 Subject: [PATCH] replace nodejs dir to current Update nodejs to 14.21.1 Issue:https://gitee.com/openharmony/build/issues/I6TECN Test:build Signed-off-by: lubinglun Change-Id: I03c35300650072798ee5468d493b763dbb15aedb replace nodejs dir to current Change-Id: I1e3b3c4920d23a6c7c1a2ad0555a202db3e86346 --- BUILD.gn | 24 +++++------------------- js_framework_build.sh | 18 +++++++++--------- prebuild_env.sh | 5 ++--- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 0bea0c18..38856a3a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -34,26 +34,12 @@ action("gen_snapshot") { is_mac = "false" use_mac = host_os == "mac" - if (is_standard_system || is_cross_platform_build) { - node_modules = "//prebuilts/build-tools/common/js-framework/node_modules" - if (use_mac) { - nodejs_path = - "//prebuilts/build-tools/common/nodejs/node-v12.18.4-darwin-x64" - is_mac = "true" - } else { - nodejs_path = - "//prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64" - is_mac = "false" - } + node_modules = "//prebuilts/build-tools/common/js-framework/node_modules" + nodejs_path = "//prebuilts/build-tools/common/nodejs/current" + if (use_mac) { + is_mac = "true" } else { - node_modules = "//prebuilts/ace-toolkit/js-framework/node_modules" - if (use_mac) { - nodejs_path = "//prebuilts/ace-toolkit/nodejs/node-v12.18.4-darwin-x64" - is_mac = "true" - } else { - nodejs_path = "//prebuilts/ace-toolkit/nodejs/node-v12.18.4-linux-x64" - is_mac = "false" - } + is_mac = "false" } buildfile_native_min = "//third_party/jsframework/build_strip_native_min.js" diff --git a/js_framework_build.sh b/js_framework_build.sh index 98823cd0..95192d6a 100755 --- a/js_framework_build.sh +++ b/js_framework_build.sh @@ -49,19 +49,19 @@ cp -r $7 $8 if [ -d "$prebuilts_path" ]; then echo "prebuilts exists" # address problme of parallzing compile - rm -rf "$8/node-v12.18.4-linux-x64" - rm -rf "$8/node-v12.18.4-darwin-x64" - cp -r $1 $8 + rm -rf "$8/current" + link_path=$(realpath $1) + ln -s $link_path "$8/current" cd $8 if [ "${10}" == 'true' ];then - ./node-v12.18.4-darwin-x64/bin/node build_strip_native_min.js || exit 1 & + ./current/bin/node build_strip_native_min.js || exit 1 & # run unit test - ./node-v12.18.4-darwin-x64/bin/node node_modules/.bin/mocha -r ts-node/register test/lib.ts test/ut/**/*.ts test/ut/*.ts || exit 1 & + ./current/bin/node node_modules/.bin/mocha -r ts-node/register test/lib.ts test/ut/**/*.ts test/ut/*.ts || exit 1 & wait else - ./node-v12.18.4-linux-x64/bin/node build_strip_native_min.js || exit 1 & + ./current/bin/node build_strip_native_min.js || exit 1 & # run unit test - ./node-v12.18.4-linux-x64/bin/node node_modules/.bin/mocha -r ts-node/register test/lib.ts test/ut/**/*.ts test/ut/*.ts || exit 1& + ./current/bin/node node_modules/.bin/mocha -r ts-node/register test/lib.ts test/ut/**/*.ts test/ut/*.ts || exit 1& wait fi else @@ -73,9 +73,9 @@ fi # after running, remove dependency file rm -rf ./node_modules if [ "${10}" == 'true' ];then - rm -rf ./node-v12.18.4-darwin-x64 + rm -rf ./current else - rm -rf ./node-v12.18.4-linux-x64 + rm -rf ./current fi rm -rf ./runtime rm -rf ./tsconfig.json diff --git a/prebuild_env.sh b/prebuild_env.sh index 1389f726..886807bb 100755 --- a/prebuild_env.sh +++ b/prebuild_env.sh @@ -29,8 +29,7 @@ case $(uname -s) in exit 1 esac -node_js_ver=v12.18.4 -node_js_name=node-${node_js_ver}-${host_platform}-x64 +node_js_name=current cd ${code_dir}/third_party/jsframework/ export PATH=${code_dir}/prebuilts/build-tools/common/nodejs/${node_js_name}/bin:$PATH @@ -40,7 +39,7 @@ npm install cd ${code_dir} if [ -d "${code_dir}/prebuilts/build-tools/common/js-framework" ]; then echo -e "\n" - echo "${code_dir}/prebuilts/build-tools/common/js-framework already exist, it will be replaced with node-${node_js_ver}" + echo "${code_dir}/prebuilts/build-tools/common/js-framework already exist, it will be replaced" /bin/rm -rf ${code_dir}/prebuilts/build-tools/common/js-framework echo -e "\n" fi -- Gitee