• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright (c) 2024 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 $1 $2
17VARIANTS="default"
18if [ -n "$3" ]; then
19  VARIANTS=$3
20fi
21rm -rf out
22rm -rf .gn
23
24mkdir -p out/$VARIANTS
25mkdir -p out/preloader
26mkdir -p out/$VARIANTS/build_configs/parts_info
27cp -rf build/indep_configs/mapping/component_mapping.json out/$VARIANTS/build_configs
28ln -s build/indep_configs/dotfile.gn .gn
29
30export SOURCE_ROOT_DIR="$PWD"
31
32# set python3
33HOST_DIR="linux-x86"
34HOST_OS="linux"
35NODE_PLATFORM="linux-x64"
36
37PYTHON3_DIR=${SOURCE_ROOT_DIR}/prebuilts/python/${HOST_DIR}/current/
38PYTHON3=${PYTHON3_DIR}/bin/python3
39PYTHON=${PYTHON3_DIR}/bin/python
40export PATH=${SOURCE_ROOT_DIR}/prebuilts/build-tools/${HOST_DIR}/bin:${PYTHON3_DIR}/bin:$PATH
41
42${PYTHON3} ${SOURCE_ROOT_DIR}/build/indep_configs/scripts/generate_components.py -hp $1 -sp $2 -v ${VARIANTS} -rp ${SOURCE_ROOT_DIR}
43${PYTHON3} ${SOURCE_ROOT_DIR}/build/indep_configs/scripts/generate_target_build_gn.py -p $2 -rp ${SOURCE_ROOT_DIR}
44${PYTHON3} ${SOURCE_ROOT_DIR}/build/indep_configs/scripts/variants_info_handler.py -rp ${SOURCE_ROOT_DIR} -v ${VARIANTS}
45
46prebuilts/build-tools/linux-x86/bin/gn gen --args="ohos_indep_compiler_enable=true product_name=\"$VARIANTS\"" -C out/$VARIANTS
47prebuilts/build-tools/linux-x86/bin/ninja -C out/$VARIANTS
48
49rm -rf .gn
50ln -s build/core/gn/dotfile.gn .gn
51
52exit 0
53