15f9996aaSopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd.
25f9996aaSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
35f9996aaSopenharmony_ci# you may not use this file except in compliance with the License.
45f9996aaSopenharmony_ci# You may obtain a copy of the License at
55f9996aaSopenharmony_ci#
65f9996aaSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
75f9996aaSopenharmony_ci#
85f9996aaSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
95f9996aaSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
105f9996aaSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115f9996aaSopenharmony_ci# See the License for the specific language governing permissions and
125f9996aaSopenharmony_ci# limitations under the License.
135f9996aaSopenharmony_ci
145f9996aaSopenharmony_ciimport("//build/config/python.gni")
155f9996aaSopenharmony_ciimport("${root_build_dir}/build_configs/parts_list.gni")
165f9996aaSopenharmony_ci
175f9996aaSopenharmony_ci# build target type
185f9996aaSopenharmony_citarget_type = "${target_os}-${target_cpu}"
195f9996aaSopenharmony_cidist_dir_name = "component_dist/${target_type}"
205f9996aaSopenharmony_ci
215f9996aaSopenharmony_ci# dist_build_out_dir = "${root_build_dir}/component_dist/${target_type}"
225f9996aaSopenharmony_cidist_subsystem_info_filename = "dist_parts_info.json"
235f9996aaSopenharmony_ci
245f9996aaSopenharmony_ci# install packages archive dir define
255f9996aaSopenharmony_cidist_install_packages_dir = "${dist_dir_name}/packages_to_install"
265f9996aaSopenharmony_cidist_subsystem_info_file =
275f9996aaSopenharmony_ci    "//${dist_install_packages_dir}/${dist_subsystem_info_filename}"
285f9996aaSopenharmony_ci
295f9996aaSopenharmony_cisrc_installed_info_file = "${root_build_dir}/src_installed_parts.json"
305f9996aaSopenharmony_cibinary_installed_info_file = "${root_build_dir}/binary_installed_parts.json"
315f9996aaSopenharmony_ci
325f9996aaSopenharmony_ciall_subsystem_info_file = "${root_build_dir}/all_parts_info.json"
335f9996aaSopenharmony_ci
345f9996aaSopenharmony_cigenerated_file("generate_src_installed_info") {
355f9996aaSopenharmony_ci  deps = []
365f9996aaSopenharmony_ci  foreach(part_label, parts_list) {
375f9996aaSopenharmony_ci    deps += [ get_label_info(part_label, "label_with_toolchain") ]
385f9996aaSopenharmony_ci  }
395f9996aaSopenharmony_ci  outputs = [ src_installed_info_file ]
405f9996aaSopenharmony_ci  data_keys = [ "part_installed_info" ]
415f9996aaSopenharmony_ci  output_conversion = "json"
425f9996aaSopenharmony_ci}
435f9996aaSopenharmony_ci
445f9996aaSopenharmony_cihost_info_file = "${root_build_dir}/all_parts_host.json"
455f9996aaSopenharmony_ci
465f9996aaSopenharmony_cigenerated_file("generate_host_info") {
475f9996aaSopenharmony_ci  deps = []
485f9996aaSopenharmony_ci  foreach(part_label, parts_list) {
495f9996aaSopenharmony_ci    deps += [ get_label_info(part_label, "label_with_toolchain") ]
505f9996aaSopenharmony_ci  }
515f9996aaSopenharmony_ci  outputs = [ host_info_file ]
525f9996aaSopenharmony_ci  data_keys = [ "part_host_info" ]
535f9996aaSopenharmony_ci  output_conversion = "json"
545f9996aaSopenharmony_ci}
555f9996aaSopenharmony_ci
565f9996aaSopenharmony_ciaction_with_pydeps("gen_binary_installed_info") {
575f9996aaSopenharmony_ci  deps = [ ":generate_src_installed_info" ]
585f9996aaSopenharmony_ci  script = "//build/ohos/common/binary_install_info.py"
595f9996aaSopenharmony_ci  depfile = "$target_gen_dir/$target_name.d"
605f9996aaSopenharmony_ci  inputs = [ src_installed_info_file ]
615f9996aaSopenharmony_ci  outputs = [ binary_installed_info_file ]
625f9996aaSopenharmony_ci  args = [
635f9996aaSopenharmony_ci    "--depfile",
645f9996aaSopenharmony_ci    rebase_path(depfile, root_build_dir),
655f9996aaSopenharmony_ci    "--dist-parts-info-file",
665f9996aaSopenharmony_ci    rebase_path(dist_subsystem_info_file, root_build_dir),
675f9996aaSopenharmony_ci    "--parts-src-installed-info-file",
685f9996aaSopenharmony_ci    rebase_path(src_installed_info_file, root_build_dir),
695f9996aaSopenharmony_ci    "--binary-installed-info-file",
705f9996aaSopenharmony_ci    rebase_path(binary_installed_info_file, root_build_dir),
715f9996aaSopenharmony_ci  ]
725f9996aaSopenharmony_ci}
735f9996aaSopenharmony_ci
745f9996aaSopenharmony_ciaction_with_pydeps("merge_all_parts") {
755f9996aaSopenharmony_ci  script = "//build/ohos/common/merge_all_subsystem.py"
765f9996aaSopenharmony_ci  deps = [
775f9996aaSopenharmony_ci    ":gen_binary_installed_info",
785f9996aaSopenharmony_ci    ":generate_host_info",
795f9996aaSopenharmony_ci    ":generate_src_installed_info",
805f9996aaSopenharmony_ci  ]
815f9996aaSopenharmony_ci  sources = [
825f9996aaSopenharmony_ci    binary_installed_info_file,
835f9996aaSopenharmony_ci    src_installed_info_file,
845f9996aaSopenharmony_ci  ]
855f9996aaSopenharmony_ci  outputs = [ all_subsystem_info_file ]
865f9996aaSopenharmony_ci  depfile = "$target_gen_dir/$target_name.d"
875f9996aaSopenharmony_ci  args = [
885f9996aaSopenharmony_ci    "--depfile",
895f9996aaSopenharmony_ci    rebase_path(depfile, root_build_dir),
905f9996aaSopenharmony_ci    "--src-install-info-file",
915f9996aaSopenharmony_ci    rebase_path(src_installed_info_file, root_build_dir),
925f9996aaSopenharmony_ci    "--binary-install-info-file",
935f9996aaSopenharmony_ci    rebase_path(binary_installed_info_file, root_build_dir),
945f9996aaSopenharmony_ci    "--all-subsystem-info-file",
955f9996aaSopenharmony_ci    rebase_path(all_subsystem_info_file, root_build_dir),
965f9996aaSopenharmony_ci  ]
975f9996aaSopenharmony_ci}
98