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/python.gni") 15import("${root_build_dir}/build_configs/parts_list.gni") 16 17# build target type 18target_type = "${target_os}-${target_cpu}" 19dist_dir_name = "component_dist/${target_type}" 20 21# dist_build_out_dir = "${root_build_dir}/component_dist/${target_type}" 22dist_subsystem_info_filename = "dist_parts_info.json" 23 24# install packages archive dir define 25dist_install_packages_dir = "${dist_dir_name}/packages_to_install" 26dist_subsystem_info_file = 27 "//${dist_install_packages_dir}/${dist_subsystem_info_filename}" 28 29src_installed_info_file = "${root_build_dir}/src_installed_parts.json" 30binary_installed_info_file = "${root_build_dir}/binary_installed_parts.json" 31 32all_subsystem_info_file = "${root_build_dir}/all_parts_info.json" 33 34generated_file("generate_src_installed_info") { 35 deps = [] 36 foreach(part_label, parts_list) { 37 deps += [ get_label_info(part_label, "label_with_toolchain") ] 38 } 39 outputs = [ src_installed_info_file ] 40 data_keys = [ "part_installed_info" ] 41 output_conversion = "json" 42} 43 44host_info_file = "${root_build_dir}/all_parts_host.json" 45 46generated_file("generate_host_info") { 47 deps = [] 48 foreach(part_label, parts_list) { 49 deps += [ get_label_info(part_label, "label_with_toolchain") ] 50 } 51 outputs = [ host_info_file ] 52 data_keys = [ "part_host_info" ] 53 output_conversion = "json" 54} 55 56action_with_pydeps("gen_binary_installed_info") { 57 deps = [ ":generate_src_installed_info" ] 58 script = "//build/ohos/common/binary_install_info.py" 59 depfile = "$target_gen_dir/$target_name.d" 60 inputs = [ src_installed_info_file ] 61 outputs = [ binary_installed_info_file ] 62 args = [ 63 "--depfile", 64 rebase_path(depfile, root_build_dir), 65 "--dist-parts-info-file", 66 rebase_path(dist_subsystem_info_file, root_build_dir), 67 "--parts-src-installed-info-file", 68 rebase_path(src_installed_info_file, root_build_dir), 69 "--binary-installed-info-file", 70 rebase_path(binary_installed_info_file, root_build_dir), 71 ] 72} 73 74action_with_pydeps("merge_all_parts") { 75 script = "//build/ohos/common/merge_all_subsystem.py" 76 deps = [ 77 ":gen_binary_installed_info", 78 ":generate_host_info", 79 ":generate_src_installed_info", 80 ] 81 sources = [ 82 binary_installed_info_file, 83 src_installed_info_file, 84 ] 85 outputs = [ all_subsystem_info_file ] 86 depfile = "$target_gen_dir/$target_name.d" 87 args = [ 88 "--depfile", 89 rebase_path(depfile, root_build_dir), 90 "--src-install-info-file", 91 rebase_path(src_installed_info_file, root_build_dir), 92 "--binary-install-info-file", 93 rebase_path(binary_installed_info_file, root_build_dir), 94 "--all-subsystem-info-file", 95 rebase_path(all_subsystem_info_file, root_build_dir), 96 ] 97} 98