• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 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/ohos_var.gni")
15
16template("collect_module_target") {
17  forward_variables_from(invoker,
18                         [
19                           "install_images",
20                           "module_label",
21                         ])
22
23  # do not collect build targets for host toolchains
24  if (current_toolchain == host_toolchain) {
25    group("${target_name}") {
26      not_needed([
27                   "module_label",
28                   "install_images",
29                 ])
30    }
31  } else {
32    if (defined(install_images)) {
33      module_install_images = []
34      module_install_images += install_images
35    } else {
36      module_install_images = [ "system" ]
37    }
38
39    group(target_name) {
40      metadata = {
41        collect_targets = []
42        foreach(image, module_install_images) {
43          # Add mapping between image name and target label
44          collect_targets += [ "${image}||${module_label}" ]
45        }
46      }
47    }
48  }
49}
50