1b1994897Sopenharmony_ci# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2b1994897Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3b1994897Sopenharmony_ci# you may not use this file except in compliance with the License.
4b1994897Sopenharmony_ci# You may obtain a copy of the License at
5b1994897Sopenharmony_ci#
6b1994897Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0
7b1994897Sopenharmony_ci#
8b1994897Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9b1994897Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10b1994897Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11b1994897Sopenharmony_ci# See the License for the specific language governing permissions and
12b1994897Sopenharmony_ci# limitations under the License.
13b1994897Sopenharmony_ci
14b1994897Sopenharmony_ciimport("//arkcompiler/runtime_core/ark_config.gni")
15b1994897Sopenharmony_ci
16b1994897Sopenharmony_ciisa_paths = [ rebase_path("$ark_root/isa/isa.yaml", root_build_dir) ]
17b1994897Sopenharmony_ci
18b1994897Sopenharmony_ciforeach(plugin, enabled_plugins) {
19b1994897Sopenharmony_ci  print("add isa plugin: $plugin")
20b1994897Sopenharmony_ci  plugin_dir = "$ark_root/plugins/$plugin"
21b1994897Sopenharmony_ci
22b1994897Sopenharmony_ci  source_files = read_file("$plugin_dir/subproject_sources.gn", "scope")
23b1994897Sopenharmony_ci  if (defined(source_files.srcs_isa_path)) {
24b1994897Sopenharmony_ci    source_file = "$plugin_dir/${source_files.srcs_isa_path}"
25b1994897Sopenharmony_ci    src_scope = read_file(source_file, "scope")
26b1994897Sopenharmony_ci
27b1994897Sopenharmony_ci    if (defined(src_scope.srcs)) {
28b1994897Sopenharmony_ci      foreach(src, src_scope.srcs) {
29b1994897Sopenharmony_ci        isa_paths += [ rebase_path("$ark_root/$src", root_build_dir) ]
30b1994897Sopenharmony_ci      }
31b1994897Sopenharmony_ci    }
32b1994897Sopenharmony_ci  }
33b1994897Sopenharmony_ci
34b1994897Sopenharmony_ci  source_files = {
35b1994897Sopenharmony_ci  }
36b1994897Sopenharmony_ci  src_scope = {
37b1994897Sopenharmony_ci  }
38b1994897Sopenharmony_ci}
39b1994897Sopenharmony_ci
40b1994897Sopenharmony_ciaction("isa_combine") {
41b1994897Sopenharmony_ci  script = "$ark_root/isa/combine.rb"
42b1994897Sopenharmony_ci  input_args = string_join(",", isa_paths)
43b1994897Sopenharmony_ci  inputs = [ "$ark_root/isa/isa.yaml" ]
44b1994897Sopenharmony_ci  outputs = [ "$root_gen_dir/isa/isa.yaml" ]
45b1994897Sopenharmony_ci  args = [
46b1994897Sopenharmony_ci    "-d",
47b1994897Sopenharmony_ci    "$input_args",
48b1994897Sopenharmony_ci    "-o",
49b1994897Sopenharmony_ci    rebase_path(outputs[0], root_build_dir),
50b1994897Sopenharmony_ci  ]
51b1994897Sopenharmony_ci}
52