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 <lubinglun@huawei.com>
Change-Id: I03c35300650072798ee5468d493b763dbb15aedb

replace nodejs dir to current

Change-Id: I1e3b3c4920d23a6c7c1a2ad0555a202db3e86346
This commit is contained in:
lubinglun 2023-04-23 20:03:30 +08:00
parent 08cf7438d5
commit 271d819a29
3 changed files with 16 additions and 31 deletions

View File

@ -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"

View File

@ -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

View File

@ -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