• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 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
14template("check_target") {
15  forward_variables_from(invoker,
16                         [
17                           "part_name",
18                           "subsystem_name",
19                           "target_path",
20                         ])
21
22  action(target_name) {
23    script = "//build/templates/common/check_build_target.py"
24    depfile = "${target_gen_dir}/$target_name.d"
25    outputs = [ "${target_out_dir}/${target_name}.txt" ]
26    _compile_standard_allow_file =
27        "$preloader_output_dir/compile_standard_whitelist.json"
28    args = [
29      "--part-name",
30      part_name,
31      "--subsystem-name",
32      subsystem_name,
33      "--source-root-dir",
34      rebase_path("//", root_build_dir),
35      "--target-path",
36      target_path,
37      "--depfile",
38      rebase_path(depfile, root_build_dir),
39      "--output",
40      rebase_path(outputs[0], root_build_dir),
41      "--compile-standard-allow-file",
42      rebase_path(_compile_standard_allow_file, root_build_dir),
43    ]
44
45    if (defined(invoker.skip_check_subsystem) &&
46        invoker.skip_check_subsystem == true) {
47      args += [ "--skip-check-subsystem" ]
48    }
49
50    if (defined(invoker.module_deps)) {
51      dep_labels = []
52      foreach(label, invoker.module_deps) {
53        dep_labels += [ get_label_info(label, "label_no_toolchain") ]
54      }
55      args += [ "--deps" ]
56      args += dep_labels
57    }
58
59    if (defined(invoker.module_ex_deps)) {
60      args += [ "--external-deps" ]
61      args += invoker.module_ex_deps
62    }
63  }
64}
65