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