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/config/sanitizers/sanitizers.gni") 15import("//build/ohos_var.gni") 16 17print("root_out_dir=$root_out_dir") 18print("root_build_dir=$root_build_dir") 19print("root_gen_dir=$root_gen_dir") 20print("current_toolchain=$current_toolchain") 21print("host_toolchain=$host_toolchain") 22 23# load build configs and write load result to out_build_dir/build_configs 24build_loader_script = rebase_path("//build/loader/load.py") 25 26_platforms_config_file = 27 "${preloader_output_dir}/${product_name}/platforms.build" 28 29_subsystem_config_file = 30 "${preloader_output_dir}/${product_name}/subsystem_config.json" 31 32build_platform = "" 33 34arguments = [ 35 "--subsystem-config-file", 36 rebase_path(_subsystem_config_file), 37 "--platforms-config-file", 38 rebase_path(_platforms_config_file), 39 "--source-root-dir", 40 rebase_path("//"), 41 "--gn-root-out-dir", 42 rebase_path(root_build_dir), 43 "--target-os", 44 target_os, 45 "--target-cpu", 46 target_cpu, 47] 48 49arguments += [ 50 "--os-level", 51 os_level, 52] 53 54if (build_platform != "") { 55 arguments += [ 56 "--build-platform-name", 57 build_platform, 58 ] 59} 60 61if (scalable_build) { 62 arguments += [ "--scalable-build" ] 63} 64 65if (build_example) { 66 arguments += [ 67 "--example-subsystem-file", 68 rebase_path("//build/subsystem_config_example.json", "$root_out_dir"), 69 ] 70} 71if (build_xts) { 72 arguments += [ "--build-xts" ] 73} 74 75arguments += [ 76 "--ignore-api-check", 77 "xts", 78 "common", 79 "developertest", 80] 81 82load_result = exec_script(build_loader_script, arguments, "string") 83 84if (load_result != "") { 85 print() 86 print(load_result) 87} 88 89print("build configs generation is complete.") 90 91# gn target defined 92if (product_name == "ohos-sdk") { 93 group("build_ohos_sdk") { 94 deps = [ 95 "//build/ohos/ndk:ohos_ndk", 96 "//build/ohos/sdk:ohos_sdk", 97 ] 98 } 99} else { 100 group("make_all") { 101 deps = [ 102 ":make_inner_kits", 103 ":packages", 104 ] 105 if (is_standard_system) { 106 # Lite system uses different packaging scheme, which is called in hb. 107 # So skip images for lite system since it's the mkimage 108 # action for standard system. 109 deps += [ ":images" ] 110 } 111 } 112 113 group("images") { 114 deps = [ "//build/ohos/images:make_images" ] 115 } 116 117 group("packages") { 118 deps = [ "//build/ohos/packages:make_packages" ] 119 } 120 121 group("make_inner_kits") { 122 deps = [ "$root_build_dir/build_configs:inner_kits" ] 123 } 124 125 group("build_all_test_pkg") { 126 testonly = true 127 deps = [ 128 "$root_build_dir/build_configs:parts_test", 129 "//test/developertest:make_temp_test", 130 ] 131 } 132 133 group("make_test") { 134 testonly = true 135 deps = [ ":build_all_test_pkg" ] 136 deps += [ "//build/ohos/packages:package_testcase_mlf" ] 137 deps += [ "//build/ohos/packages:package_testcase" ] 138 if (archive_component) { 139 deps += [ "//build/ohos/testfwk:archive_testcase" ] 140 } 141 } 142} 143