• 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=${9}
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 [ "${8}" == 'true' ];then
23  #cp -R -L $3 $8
24  if [ "${12}" == 'true' ];then
25    cp -R ${11} $7
26  fi
27else
28  #cp -r -L $3 $8
29  if [ "${12}" == 'true' ];then
30    cp -r ${11} $7
31  fi
32fi
33
34# $2 => node $3 => node_modules
35cp -f $4 $7
36
37if [ -d "$prebuilts_path" ]; then
38  echo "copy node_modules..."
39  if [ "${9}" == 'true' ];then
40    cp -R $3 $7
41  else
42    cp -r $3 $7
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 $5 $7
51cp -f $6 $7
52cp -f $1 $7
53cp -f ${13} $7
54if [ -d "$prebuilts_path" ]; then
55  echo "prebuilts exists"
56  # address problme of parallzing compile
57  rm -rf "$7/current"
58  link_path=$(realpath $2)
59  ln -s $link_path "$7/current"
60  cd $7
61  if [ "${8}" == 'true' ];then
62    if [ "${12}" == 'true' ];then
63      ./current/bin/node ./mock-generate/build.js ${10}
64    fi
65    ./current/bin/node build_jsmock_system_plugin.js || exit 1 &
66    wait
67  else
68    if [ "${12}" == 'true' ];then
69      ./current/bin/node ./mock-generate/build.js ${10}
70    fi
71    ./current/bin/node build_jsmock_system_plugin.js || exit 1 &
72    wait
73  fi
74else
75  npm run build
76fi
77
78# after running, remove dependency file
79rm -rf ./node_modules
80if [ "${8}" == 'true' ];then
81  rm -rf ./current
82else
83  rm -rf ./current
84fi
85rm -rf ./runtime
86rm -rf ./tsconfig.json
87rm -rf build_jsmock_system_plugin.js
88rm -rf ./.eslintrc
89rm -rf ./.babelrc
90rm -rf ./package.json
91if [ "${12}" == 'true' ];then
92  rm -rf ./mock-generate
93fi
94