• 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("//arkcompiler/runtime_core/ark_config.gni")
15import("//arkcompiler/runtime_core/libabckit/abckit_config.gni")
16
17template("abckit_standalone_canary") {
18  assert(defined(invoker.input_file), "input_file is required!")
19  assert(defined(invoker.extension), "extension is required!")
20  assert(defined(invoker.configs), "config_file is required!")
21
22  output_file =
23      "$target_out_dir" + "/" + "$target_name" + "." + invoker.extension
24
25  extra_dependencies = []
26  if (defined(invoker.extra_dependencies)) {
27    extra_dependencies += invoker.extra_dependencies
28  }
29
30  action("${target_name}_gen_canary") {
31    script = "$abckit_root/scripts/run_script.sh"
32
33    args = [
34      "--script=" + rebase_path(abckit_root) +
35          "/scripts/generate_standalone_canary.sh",
36      "--ret-code=0",
37      "--script-args=" + rebase_path(invoker.input_file),
38      "--script-args=" + rebase_path("$output_file"),
39    ]
40
41    # rerun action when input file update
42    inputs = [ invoker.input_file ]
43    outputs = [ "$output_file" ]
44    deps = extra_dependencies
45  }
46
47  ohos_executable("${target_name}") {
48    configs = []
49    if (defined(invoker.configs)) {
50      configs += invoker.configs
51    }
52    sources = [ rebase_path("$output_file") ]
53    deps = [ ":${target_name}_gen_canary" ]
54
55    # NOTE: Important! Do not add `include_dirs` to this target!
56    # Compiling this test without `include_dirs` ensures all relative paths are correct
57    # and there are no dependencies from `include` to `src`
58    install_enable = false
59    part_name = "runtime_core"
60    subsystem_name = "arkcompiler"
61  }
62}
63