• 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")
15
16config("panda_guard_public_config") {
17  include_dirs = [ "$ark_root/panda_guard" ]
18}
19
20panda_guard_sources = [
21  "configs/guard_args_parser.cpp",
22  "configs/guard_context.cpp",
23  "configs/guard_graph_context.cpp",
24  "configs/guard_name_cache.cpp",
25  "configs/guard_options.cpp",
26  "generator/name_mapping.cpp",
27  "generator/order_name_generator.cpp",
28  "guard4program.cpp",
29  "guard_driver.cpp",
30  "obfuscate/annotation.cpp",
31  "obfuscate/array.cpp",
32  "obfuscate/class.cpp",
33  "obfuscate/entity.cpp",
34  "obfuscate/file_path.cpp",
35  "obfuscate/function.cpp",
36  "obfuscate/graph_analyzer.cpp",
37  "obfuscate/inst_obf.cpp",
38  "obfuscate/instruction_info.cpp",
39  "obfuscate/method.cpp",
40  "obfuscate/module_record.cpp",
41  "obfuscate/node.cpp",
42  "obfuscate/object.cpp",
43  "obfuscate/program.cpp",
44  "obfuscate/property.cpp",
45  "obfuscate/ui_decorator.cpp",
46  "util/error.cpp",
47  "util/file_util.cpp",
48  "util/json_util.cpp",
49  "util/string_util.cpp",
50]
51
52panda_guard_configs = [
53  "$ark_root:ark_config",
54  "$ark_root/libpandabase:arkbase_public_config",
55  "$ark_root/assembler:arkassembler_public_config",
56  "$ark_root/libpandafile:arkfile_public_config",
57  "$ark_root/compiler:arkcompiler_public_config",
58]
59
60ohos_static_library("panda_guard_static") {
61  sources = panda_guard_sources
62
63  include_dirs = [ "$ark_root/abc2program" ]
64
65  configs = panda_guard_configs
66
67  public_configs = [ ":panda_guard_public_config" ]
68
69  deps = [
70    "$ark_root/abc2program:abc2program_frontend_static",
71    "$ark_root/assembler:libarkassembler_frontend_static",
72    "$ark_root/compiler:libarkcompiler_frontend_static",
73    "$ark_root/libpandabase:libarkbase_frontend_static",
74    "$ark_root/libpandafile:libarkfile_frontend_static",
75  ]
76
77  external_deps = [ sdk_libc_secshared_dep ]
78  if (enable_hilog && defined(ohos_indep_compiler_enable) &&
79      ohos_indep_compiler_enable) {
80    external_deps += [ "hilog:libhilog" ]
81  }
82
83  part_name = "runtime_core"
84  subsystem_name = "arkcompiler"
85}
86
87ohos_executable("panda_guard") {
88  sources = [ "guard_main.cpp" ]
89
90  configs = panda_guard_configs
91
92  deps = [ ":panda_guard_static" ]
93
94  install_enable = false
95
96  part_name = "runtime_core"
97  subsystem_name = "arkcompiler"
98}
99
100if (is_linux || (is_build_sdk && is_ohos)) {
101  ohos_copy("panda_guard_build_ets") {
102    deps = [ ":panda_guard" ]
103    sources = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard" ]
104    outputs = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard-ets" ]
105    module_source_dir = "${root_out_dir}/arkcompiler/runtime_core"
106    module_install_name = "panda_guard"
107
108    part_name = "runtime_core"
109    subsystem_name = "arkcompiler"
110  }
111}
112
113if (is_mingw) {
114  ohos_copy("panda_guard_build_win_ets") {
115    deps = [ ":panda_guard" ]
116    sources = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard.exe" ]
117    outputs = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard-win-ets" ]
118    module_source_dir = "${root_out_dir}/arkcompiler/runtime_core"
119    module_install_name = "panda_guard.exe"
120
121    part_name = "runtime_core"
122    subsystem_name = "arkcompiler"
123  }
124}
125
126if (is_mac) {
127  ohos_copy("panda_guard_build_mac_ets") {
128    deps = [ ":panda_guard" ]
129    sources = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard" ]
130    outputs = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard-mac-ets" ]
131    module_source_dir = "${root_out_dir}/arkcompiler/runtime_core"
132    module_install_name = "panda_guard"
133
134    part_name = "runtime_core"
135    subsystem_name = "arkcompiler"
136  }
137}
138