• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright (c) 2021 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15set -e
16echo "copy source code..."
17prebuilts_path=${10}
18# copy dependency file to generate dir of gn
19# the params come from .gn
20
21# copy runtime to target out, and runtime/css-what is solt link, copy it always follow symbolic links in SOURCE
22if [ "${9}" == 'true' ];then
23  cp -R -L $3 $8
24  if [ "${13}" == 'true' ];then
25    cp -R ${12} $8
26  fi
27else
28  cp -r -L $3 $8
29  if [ "${13}" == 'true' ];then
30    cp -r ${12} $8
31  fi
32fi
33
34# $2 => node $4 => node_modules
35cp -f $5 $8
36
37if [ -d "$prebuilts_path" ]; then
38  echo "copy node_modules..."
39  if [ "${9}" == 'true' ];then
40    cp -R $4 $8
41  else
42    cp -r $4 $8
43  fi
44else
45  echo "download node_modules..."
46  npm install
47  cp -r ./node_modules ../../tools_previewer/automock/mock-generate
48fi
49
50cp -f $6 $8
51cp -f $7 $8
52cp -f $1 $8
53if [ -d "$prebuilts_path" ]; then
54  echo "prebuilts exists"
55  # address problme of parallzing compile
56  rm -rf "$8/node-v12.18.4-linux-x64"
57  rm -rf "$8/node-v12.18.4-darwin-x64"
58  cp -r $2 $8
59  cd $8
60  if [ "${9}" == 'true' ];then
61    if [ "${13}" == 'true' ];then
62      ./node-v12.18.4-darwin-x64/bin/node ./mock-generate/build.js
63    fi
64    ./node-v12.18.4-darwin-x64/bin/node build_jsmock_system_plugin.js || exit 1 &
65    wait
66  else
67    if [ "${13}" == 'true' ];then
68      ./node-v12.18.4-linux-x64/bin/node ./mock-generate/build.js
69    fi
70    ./node-v12.18.4-linux-x64/bin/node build_jsmock_system_plugin.js || exit 1 &
71    wait
72  fi
73else
74  npm run build
75fi
76
77# after running, remove dependency file
78# rm -rf ./node_modules
79# if [ "${9}" == 'true' ];then
80  rm -rf ./node-v12.18.4-darwin-x64
81# else
82#   rm -rf ./node-v12.18.4-linux-x64
83# fi
84# rm -rf ./runtime
85# rm -rf ./tsconfig.json
86# rm -rf build_jsmock_system_plugin.js
87# rm -rf ./test
88# rm -rf ./.eslintrc
89# rm -rf ./.babelrc
90# rm -rf ./package.json
91# if [ "${13}" == 'true' ];then
92#   rm -rf ./mock-generate
93# fi
94