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/common.gni") 15import("//build/version.gni") 16 17declare_args() { 18 # build ohos version 19 build_public_version = true 20} 21 22declare_args() { 23 enable_java = is_large_system 24} 25 26declare_args() { 27 build_version_alpha = true 28} 29 30declare_args() { 31 sdk_build_public = false 32 use_current_sdk = false 33} 34 35declare_args() { 36 # Whether build the qemu images, this image is usd to run on emulator device. 37 build_qemu_image = false 38 39 # system package dir 40 system_base_dir = "system" 41 42 # ramdisk package dir 43 ramdisk_base_dir = "ramdisk" 44 45 # vendor package dir 46 vendor_base_dir = "vendor" 47 48 # chipset package dir 49 chipset_base_dir = "vendor" 50 51 # updater package dir 52 updater_base_dir = "updater" 53 54 # updater_vendor package dir 55 updater_vendor_base_dir = "updater_vendor" 56 57 # sys_prod package dir 58 sys_prod_base_dir = "sys_prod" 59 60 # eng_system package dir 61 eng_system_base_dir = "eng_system" 62 63 # eng_chipset package dir 64 eng_chipset_base_dir = "eng_chipset" 65 66 # chip_prod package dir 67 chip_prod_base_dir = "chip_prod" 68 69 # chipset passthrough libraries dir 70 chipset_passthrough_dir = "chipsetsdk" 71 72 # check sdk interface 73 sdk_interface_check = true 74 75 # is use sdk 76 is_use_sdk = false 77 78 # build test example 79 build_example = false 80 81 # check intersdk interface 82 check_innersdk_interface = true 83 gen_innersdk_interface_signature = false 84 85 # sdk check 86 check_sdk_interface = true 87 gen_sdk_interface_signature = false 88 89 # Whether to collect the ebpf testcase. 90 ebpf_enable = false 91 92 # Info files of test targets will remove source file paths when setting true. 93 release_test_suite = false 94 95 # Whether to enable scalable build. 96 scalable_build = false 97 98 # Whether to enable pycache or not. 99 pycache_enable = true 100 101 # Whether to build js bundle to ark bytecode 102 build_ark = true 103 104 # Whether to make Code_OpenSource.tar.gz 105 make_osp = false 106 107 # sepcify opensource scan dir, separated by a colon 108 osp_scan_dirs = "third_party:kernel:device:drivers" 109 110 # sepcify opensource scan license, separated by a colon 111 osp_scan_licenses = "GPL:LGPL" 112 113 # Collecting but not pacaking open-source packages for post processing 114 osp_only_collect_file = false 115 116 # Enables EMMA Java code coverage. Instruments classes during build to 117 # produce .ec files during runtime 118 emma_coverage = false 119} 120 121declare_args() { 122 build_platform = "" 123 124 sparse_image = false 125} 126 127declare_args() { 128 target_app_dir = "" 129} 130 131declare_args() { 132 system_kits_package = false 133 134 kits_api_statistics = false 135 136 # ohos sdk 137 build_ohos_sdk = false 138 enable_enhanced_opt = true 139 140 # Build ohos sdk compatibility jar 141 build_bc_sdk = false 142 143 # Which OS the generated SDK works on. possible values: 'win/mac/linux/default' 144 sdk_platform = "default" 145} 146 147declare_args() { 148 # Build ohos NDK 149 build_ohos_ndk = false 150 151 # Which OS the generated NDK works on. possible values: 'win/mac/linux/default' 152 ndk_platform = "default" 153 154 # Whether to archive or not, set to false in debug to save ndk build time. 155 archive_ndk = true 156 157 # Check ndk header signature, set false to generate header signature 158 check_ndk_signature = false 159} 160 161declare_args() { 162 archive_component = false 163} 164 165declare_args() { 166 build_asan_clean = false 167} 168 169declare_args() { 170 check_deps = false 171} 172 173declare_args() { 174 enable_iccarm_sp = false 175} 176 177declare_args() { 178 enforce_selinux = false 179} 180 181declare_args() { 182 enable_notice_collection = true 183} 184 185declare_args() { 186 skip_generate_module_list_file = true 187} 188 189declare_args() { 190 ohos_skip_parse_external_deps = false 191} 192 193declare_args() { 194 load_test_config = true 195} 196 197declare_args() { 198 # Skip module_info generation when the packaging image is not needed 199 skip_gen_module_info = false 200} 201 202declare_args() { 203 enable_archive_sdk = true 204 enable_process_notice = true 205} 206 207declare_args() { 208 is_use_check_deps = true 209} 210 211if (ohos_indep_compiler_enable) { 212 is_use_check_deps = false 213} 214 215declare_args() { 216 if (is_mac || is_ios) { 217 enable_bitcode = false 218 if (defined(product_build_config.enable_bitcode)) { 219 enable_bitcode = product_build_config.enable_bitcode 220 } 221 } 222} 223 224declare_args() { 225 bitcode_marker = false 226} 227 228declare_args() { 229 is_opensource = true 230} 231 232# Upgrade Skia version 233use_new_skia = true 234 235if (defined(build_cross_platform_version) && build_cross_platform_version) { 236 use_rosen_drawing = false 237} else { 238 use_rosen_drawing = true 239} 240 241# support changing the ohpm registry and using hvigor cache 242declare_args() { 243 ohpm_registry = "" 244 use_hvigor_cache = false 245 hvigor_obfuscation = true 246 ohos_app_enable_ubsan = false 247 ohos_app_enable_asan = false 248 ohos_app_enable_tsan = false 249} 250 251# enhance some optimizations 252declare_args() { 253 enhanced_opt = true 254} 255 256# build target type 257target_type = "${target_os}-${target_cpu}" 258 259is_system_component = 260 exec_script(rebase_path("//build/scripts/dir_exists.py"), 261 [ rebase_path("//foundation/arkui", root_build_dir) ], 262 "string") == "True" 263 264parts_src_flag_file = "$root_build_dir/build_configs/parts_src_flag.json" 265 266declare_args() { 267 innersdk_dir_name = "sdk/${target_type}" 268} 269declare_args() { 270 innersdk_base_dir = "//${innersdk_dir_name}" 271} 272 273declare_args() { 274 ability_runtime_graphics = true 275} 276 277declare_args() { 278 window_manager_use_sceneboard = false 279} 280 281# Compile and generate output directory 282innersdk_build_out_dir = "innerkits/${target_type}" 283 284dist_dir_name = "component_dist/${target_type}" 285dist_build_out_dir = "${root_build_dir}/component_dist/${target_type}" 286dist_subsystem_info_filename = "dist_parts_info.json" 287 288# install packages archive dir define 289dist_install_packages_dir = "${dist_dir_name}/packages_to_install" 290dist_subsystem_info_file = 291 "//${dist_install_packages_dir}/${dist_subsystem_info_filename}" 292dist_build_install_packages_dir = "${dist_build_out_dir}/packages_to_install" 293dist_subsystem_info_output_file = 294 "${dist_build_install_packages_dir}/${dist_subsystem_info_filename}" 295prebuilts_sdk_dir = "//prebuilts/ohos-sdk/linux/18" 296 297ramdisk_dir_list = [] 298 299app_target_allowlist = [ 300 "*:*_res", 301 "*:*_resources", 302 "*:*_resource", 303 "*:*_assets", 304 "*:*_asset", 305 "*:*_profile", 306] 307app_target_types = [ 308 "hap", 309 "resources", 310 "js_assets", 311 "ets_assets", 312 "assets", 313 "app_profile", 314] 315 316ohos_package_names = [ 317 "ohos.*", 318 "ark.*", 319] 320 321openjdk_package_names = [ 322 "java.*", 323 "javax.*", 324] 325if (ohos_indep_compiler_enable) { 326 hapsigner = "${prebuilts_sdk_dir}/toolchains/lib/hap-sign-tool.jar" 327 hap_packing_tool = "${prebuilts_sdk_dir}/toolchains/lib/app_packing_tool.jar" 328} else { 329 hapsigner = "//developtools/hapsigner/dist/hap-sign-tool.jar" 330 hap_packing_tool = 331 "${root_out_dir}/obj/developtools/packing_tool/jar/app_packing_tool.jar" 332} 333 334nodejs = "//prebuilts/build-tools/common/nodejs/current/bin/node" 335npm = "//prebuilts/build-tools/common/nodejs/current/bin/npm" 336 337default_key_alias = "OpenHarmony Application Release" 338default_signature_algorithm = "SHA256withECDSA" 339default_hap_private_key_path = "123456" 340default_keystore_password = "123456" 341if (ohos_indep_compiler_enable) { 342 default_keystore_path = "${prebuilts_sdk_dir}/toolchains/lib/OpenHarmony.p12" 343 default_hap_certificate_file = 344 "//prebuilts/ohos-sdk/OpenHarmonyApplication.pem" 345} else { 346 default_keystore_path = "//developtools/hapsigner/dist/OpenHarmony.p12" 347 default_hap_certificate_file = 348 "//developtools/hapsigner/dist/OpenHarmonyApplication.pem" 349} 350 351declare_args() { 352 build_default_sdk_target = false 353 build_mac_sdk_target = false 354 build_linux_sdk_target = false 355 build_windows_sdk_target = false 356 build_ohos_sdk_target = false 357} 358 359declare_args() { 360 build_default_ndk_target = false 361 build_mac_ndk_target = false 362 build_linux_ndk_target = false 363 build_windows_ndk_target = false 364 build_ohos_ndk_target = false 365} 366 367python_script = "//build/scripts/is_substring.py" 368 369if (exec_script(python_script, 370 [ 371 sdk_platform, 372 "default", 373 ], 374 "string") == "True") { 375 build_default_sdk_target = true 376} 377 378if (exec_script(python_script, 379 [ 380 sdk_platform, 381 "mac", 382 ], 383 "string") == "True") { 384 build_mac_sdk_target = true 385} 386 387if (exec_script(python_script, 388 [ 389 sdk_platform, 390 "win", 391 ], 392 "string") == "True") { 393 build_windows_sdk_target = true 394} 395 396if (exec_script(python_script, 397 [ 398 sdk_platform, 399 "linux", 400 ], 401 "string") == "True") { 402 build_linux_sdk_target = true 403} 404 405if (exec_script(python_script, 406 [ 407 sdk_platform, 408 "ohos", 409 ], 410 "string") == "True") { 411 build_ohos_sdk_target = true 412} 413 414if (exec_script(python_script, 415 [ 416 ndk_platform, 417 "default", 418 ], 419 "string") == "True") { 420 build_default_ndk_target = true 421} 422 423if (exec_script(python_script, 424 [ 425 ndk_platform, 426 "mac", 427 ], 428 "string") == "True") { 429 build_mac_ndk_target = true 430} 431 432if (exec_script(python_script, 433 [ 434 ndk_platform, 435 "win", 436 ], 437 "string") == "True") { 438 build_windows_ndk_target = true 439} 440 441if (exec_script(python_script, 442 [ 443 ndk_platform, 444 "linux", 445 ], 446 "string") == "True") { 447 build_linux_ndk_target = true 448} 449 450if (exec_script(python_script, 451 [ 452 ndk_platform, 453 "ohos", 454 ], 455 "string") == "True") { 456 build_ohos_ndk_target = true 457} 458