1# Copyright (c) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/version.gni")
15
16declare_args() {
17  # build ohos version
18  build_public_version = true
19}
20
21declare_args() {
22  enable_java = is_large_system
23}
24
25declare_args() {
26  build_version_alpha = true
27}
28
29declare_args() {
30  sdk_build_public = false
31  use_current_sdk = false
32}
33
34declare_args() {
35  # Whether build the qemu images, this image is usd to run on emulator device.
36  build_qemu_image = false
37
38  # system package dir
39  system_base_dir = "system"
40
41  # ramdisk package dir
42  ramdisk_base_dir = "ramdisk"
43
44  # vendor package dir
45  vendor_base_dir = "vendor"
46
47  # chipset package dir
48  chipset_base_dir = "vendor"
49
50  # updater package dir
51  updater_base_dir = "updater"
52
53  # updater_vendor package dir
54  updater_vendor_base_dir = "updater_vendor"
55
56  # sys_prod package dir
57  sys_prod_base_dir = "sys_prod"
58
59  # eng_system package dir
60  eng_system_base_dir = "eng_system"
61
62  # eng_chipset package dir
63  eng_chipset_base_dir = "eng_chipset"
64
65  # chip_prod package dir
66  chip_prod_base_dir = "chip_prod"
67
68  # chipset passthrough libraries dir
69  chipset_passthrough_dir = "chipsetsdk"
70
71  # check sdk interface
72  sdk_interface_check = true
73
74  # is use sdk
75  is_use_sdk = false
76
77  # build test example
78  build_example = false
79
80  # check intersdk interface
81  check_innersdk_interface = true
82  gen_innersdk_interface_signature = false
83
84  # sdk check
85  check_sdk_interface = true
86  gen_sdk_interface_signature = false
87
88  # Whether to collect the ebpf testcase.
89  ebpf_enable = false
90
91  # Info files of test targets will remove source file paths when setting true.
92  release_test_suite = false
93
94  # Whether to enable scalable build.
95  scalable_build = false
96
97  # Whether to enable pycache or not.
98  pycache_enable = true
99
100  # Whether to build js bundle to ark bytecode
101  build_ark = true
102
103  # Whether to make Code_OpenSource.tar.gz
104  make_osp = false
105
106  # sepcify opensource scan dir, separated by a colon
107  osp_scan_dirs = "third_party:kernel:device:drivers"
108
109  # sepcify opensource scan license, separated by a colon
110  osp_scan_licenses = "GPL:LGPL"
111
112  # Collecting but not pacaking open-source packages for post processing
113  osp_only_collect_file = false
114
115  # Enables EMMA Java code coverage. Instruments classes during build to
116  # produce .ec files during runtime
117  emma_coverage = false
118}
119
120declare_args() {
121  build_platform = ""
122
123  sparse_image = false
124}
125
126declare_args() {
127  system_kits_package = false
128
129  kits_api_statistics = false
130
131  # ohos sdk
132  build_ohos_sdk = false
133  enable_enhanced_opt = true
134
135  # Build ohos sdk compatibility jar
136  build_bc_sdk = false
137
138  # Which OS the generated SDK works on. possible values: 'win/mac/linux/default'
139  sdk_platform = "default"
140}
141
142declare_args() {
143  # Build ohos NDK
144  build_ohos_ndk = false
145
146  # Which OS the generated NDK works on. possible values: 'win/mac/linux/default'
147  ndk_platform = "default"
148
149  # Whether to archive or not, set to false in debug to save ndk build time.
150  archive_ndk = true
151
152  # Check ndk header signature, set false to generate header signature
153  check_ndk_signature = false
154}
155
156declare_args() {
157  archive_component = false
158}
159
160declare_args() {
161  build_asan_clean = false
162}
163
164declare_args() {
165  check_deps = false
166}
167
168declare_args() {
169  enable_iccarm_sp = false
170}
171
172declare_args() {
173  enforce_selinux = false
174}
175
176declare_args() {
177  enable_notice_collection = true
178}
179
180declare_args() {
181  skip_generate_module_list_file = true
182}
183
184declare_args() {
185  ohos_skip_parse_external_deps = false
186}
187
188declare_args() {
189  load_test_config = true
190}
191
192declare_args() {
193  # Skip module_info generation when the packaging image is not needed
194  skip_gen_module_info = false
195}
196
197declare_args() {
198  enable_archive_sdk = true
199  enable_process_notice = true
200}
201
202declare_args() {
203  build_variant = "root"
204  root_perf_main = "main"
205  device_type = "default"
206}
207
208declare_args() {
209  is_use_check_deps = true
210}
211
212if (ohos_indep_compiler_enable) {
213  is_use_check_deps = false
214}
215
216declare_args() {
217  if (is_mac || is_ios) {
218    enable_bitcode = false
219    if (defined(product_build_config.enable_bitcode)) {
220      enable_bitcode = product_build_config.enable_bitcode
221    }
222  }
223}
224
225declare_args() {
226  bitcode_marker = false
227}
228
229declare_args() {
230  is_opensource = true
231}
232
233# Upgrade Skia version
234use_new_skia = true
235
236if (defined(build_cross_platform_version) && build_cross_platform_version) {
237  use_rosen_drawing = false
238} else {
239  use_rosen_drawing = true
240}
241
242# support changing the ohpm registry and using hvigor cache
243declare_args() {
244  ohpm_registry = ""
245  use_hvigor_cache = false
246  hvigor_obfuscation = true
247}
248
249# enhance some optimizations
250declare_args() {
251  enhanced_opt = true
252}
253
254# build target type
255target_type = "${target_os}-${target_cpu}"
256
257is_system_component =
258    exec_script(rebase_path("//build/scripts/dir_exists.py"),
259                [ rebase_path("//foundation/arkui", root_build_dir) ],
260                "string") == "True"
261
262parts_src_flag_file = "$root_build_dir/build_configs/parts_src_flag.json"
263
264declare_args() {
265  innersdk_dir_name = "sdk/${target_type}"
266}
267declare_args() {
268  innersdk_base_dir = "//${innersdk_dir_name}"
269}
270
271declare_args() {
272  ability_runtime_graphics = true
273}
274
275declare_args() {
276  window_manager_use_sceneboard = false
277}
278
279# Compile and generate output directory
280innersdk_build_out_dir = "innerkits/${target_type}"
281
282dist_dir_name = "component_dist/${target_type}"
283dist_build_out_dir = "${root_build_dir}/component_dist/${target_type}"
284dist_subsystem_info_filename = "dist_parts_info.json"
285
286# install packages archive dir define
287dist_install_packages_dir = "${dist_dir_name}/packages_to_install"
288dist_subsystem_info_file =
289    "//${dist_install_packages_dir}/${dist_subsystem_info_filename}"
290dist_build_install_packages_dir = "${dist_build_out_dir}/packages_to_install"
291dist_subsystem_info_output_file =
292    "${dist_build_install_packages_dir}/${dist_subsystem_info_filename}"
293
294ramdisk_dir_list = []
295
296app_target_allowlist = [
297  "*:*_res",
298  "*:*_resources",
299  "*:*_resource",
300  "*:*_assets",
301  "*:*_asset",
302  "*:*_profile",
303]
304app_target_types = [
305  "hap",
306  "resources",
307  "js_assets",
308  "ets_assets",
309  "assets",
310  "app_profile",
311]
312
313ohos_package_names = [
314  "ohos.*",
315  "ark.*",
316]
317
318openjdk_package_names = [
319  "java.*",
320  "javax.*",
321]
322
323hapsigner = "//developtools/hapsigner/dist/hap-sign-tool.jar"
324hap_packing_tool =
325    "${root_out_dir}/obj/developtools/packing_tool/jar/app_packing_tool.jar"
326
327nodejs = "//prebuilts/build-tools/common/nodejs/current/bin/node"
328npm = "//prebuilts/build-tools/common/nodejs/current/bin/npm"
329
330default_key_alias = "OpenHarmony Application Release"
331default_signature_algorithm = "SHA256withECDSA"
332default_hap_private_key_path = "123456"
333default_keystore_password = "123456"
334default_keystore_path = "//developtools/hapsigner/dist/OpenHarmony.p12"
335default_hap_certificate_file =
336    "//developtools/hapsigner/dist/OpenHarmonyApplication.pem"
337