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 44action_with_pydeps("gen_binary_installed_info") { 45 deps = [ ":generate_src_installed_info" ] 46 script = "//build/ohos/common/binary_install_info.py" 47 depfile = "$target_gen_dir/$target_name.d" 48 inputs = [ src_installed_info_file ] 49 outputs = [ binary_installed_info_file ] 50 args = [ 51 "--depfile", 52 rebase_path(depfile, root_build_dir), 53 "--dist-parts-info-file", 54 rebase_path(dist_subsystem_info_file, root_build_dir), 55 "--parts-src-installed-info-file", 56 rebase_path(src_installed_info_file, root_build_dir), 57 "--binary-installed-info-file", 58 rebase_path(binary_installed_info_file, root_build_dir), 59 ] 60} 61 62action_with_pydeps("merge_all_parts") { 63 script = "//build/ohos/common/merge_all_subsystem.py" 64 deps = [ 65 ":gen_binary_installed_info", 66 ":generate_src_installed_info", 67 ] 68 sources = [ 69 binary_installed_info_file, 70 src_installed_info_file, 71 ] 72 outputs = [ all_subsystem_info_file ] 73 depfile = "$target_gen_dir/$target_name.d" 74 args = [ 75 "--depfile", 76 rebase_path(depfile, root_build_dir), 77 "--src-install-info-file", 78 rebase_path(src_installed_info_file, root_build_dir), 79 "--binary-install-info-file", 80 rebase_path(binary_installed_info_file, root_build_dir), 81 "--all-subsystem-info-file", 82 rebase_path(all_subsystem_info_file, root_build_dir), 83 ] 84} 85