1# Copyright (c) 2022 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.gni")
15import("//foundation/ability/ability_runtime/ability_runtime.gni")
16
17if (is_mac) {
18  dylib_suffix = ".dylib"
19} else {
20  dylib_suffix = ".dll"
21}
22
23not_needed("*", [ "dylib_suffix" ])
24
25ohos_copy("ability_simulator_copy_ability_modules") {
26  deps = []
27  sources = []
28
29  napi_modules = [ "napi_module/want_constant:wantconstant_napi" ]
30
31  foreach(module, napi_modules) {
32    deps += [ module ]
33    out_path = get_label_info(module, "root_out_dir")
34    out_name = get_label_info(module, "name")
35    sources +=
36        [ out_path + "/ability/ability_runtime/lib" + out_name + dylib_suffix ]
37  }
38
39  target_path = get_label_info(":copy_ability_simulator", "target_out_dir")
40
41  outputs = [ target_path + "/bin/module/ability/{{source_file_part}}" ]
42}
43
44ohos_copy("ability_simulator_copy_application_modules") {
45  deps = []
46  sources = []
47
48  napi_modules = [
49    "napi_module/ability:ability_napi",
50    "napi_module/ability_context:abilitycontext_napi",
51    "napi_module/ability_stage_context:abilitystagecontext_napi",
52    "napi_module/application_context:applicationcontext_napi",
53    "napi_module/caller:caller_napi",
54    "napi_module/callee:callee",
55    "napi_module/context:context_napi",
56  ]
57
58  foreach(module, napi_modules) {
59    deps += [ module ]
60    out_path = get_label_info(module, "root_out_dir")
61    out_name = get_label_info(module, "name")
62    sources +=
63        [ out_path + "/ability/ability_runtime/lib" + out_name + dylib_suffix ]
64  }
65
66  target_path = get_label_info(":copy_ability_simulator", "target_out_dir")
67
68  outputs = [ target_path + "/bin/module/application/{{source_file_part}}" ]
69}
70
71ohos_copy("ability_simulator_copy_app_ability_modules") {
72  deps = []
73  sources = []
74
75  napi_modules = [
76    "napi_module/embeddable_ui_ability:embeddableuiability_napi",
77    "napi_module/embeddable_ui_ability_context:embeddeduiextensionability_napi",
78    "napi_module/uiability:uiability",
79    "napi_module/ability_stage:abilitystage",
80    "napi_module/ability_constant:abilityconstant",
81    "napi_module/configuration_constant:configurationconstant",
82  ]
83
84  foreach(module, napi_modules) {
85    deps += [ module ]
86    out_path = get_label_info(module, "root_out_dir")
87    out_name = get_label_info(module, "name")
88    sources +=
89        [ out_path + "/ability/ability_runtime/lib" + out_name + dylib_suffix ]
90  }
91
92  target_path = get_label_info(":copy_ability_simulator", "target_out_dir")
93
94  outputs = [ target_path + "/bin/module/app/ability/{{source_file_part}}" ]
95
96  part_name = "ability_runtime"
97  subsystem_name = "ability"
98}
99
100ohos_copy("copy_ability_simulator") {
101  deps = [
102    ":ability_simulator_copy_ability_modules",
103    ":ability_simulator_copy_app_ability_modules",
104    ":ability_simulator_copy_application_modules",
105  ]
106  sources = []
107
108  deps += [ "test:ability_simulator_test" ]
109  out_path = get_label_info("test:ability_simulator_test", "root_out_dir")
110
111  deps += [ "ability_simulator:ability_simulator" ]
112  out_path =
113      get_label_info("ability_simulator:ability_simulator", "root_out_dir")
114  sources += [ out_path + "/ability/ability_runtime/libability_simulator" +
115               dylib_suffix ]
116
117  deps += [ "${ability_base_path}:string_utils" ]
118  out_path = get_label_info("${ability_base_path}:string_utils", "root_out_dir")
119  sources +=
120      [ out_path + "/ability/ability_base/libstring_utils" + dylib_suffix ]
121
122  deps += [ "${arkui_path}/napi:ace_napi" ]
123  out_path = get_label_info("${arkui_path}/napi:ace_napi", "root_out_dir")
124  sources += [ out_path + "/arkui/napi/libace_napi" + dylib_suffix ]
125
126  deps += [ "//arkcompiler/ets_runtime:libark_jsruntime" ]
127  out_path = get_label_info("//arkcompiler/ets_runtime:libark_jsruntime",
128                            "root_out_dir")
129  sources +=
130      [ out_path + "/arkcompiler/ets_runtime/libark_jsruntime" + dylib_suffix ]
131
132  deps += [ "//arkcompiler/toolchain/tooling:libark_ecma_debugger" ]
133  out_path =
134      get_label_info("//arkcompiler/toolchain/tooling:libark_ecma_debugger",
135                     "root_out_dir")
136  sources +=
137      [ out_path + "/arkcompiler/toolchain/libark_tooling" + dylib_suffix ]
138
139  deps += [ "//arkcompiler/toolchain/inspector:ark_debugger" ]
140  out_path = get_label_info("//arkcompiler/toolchain/inspector:ark_debugger",
141                            "root_out_dir")
142  sources +=
143      [ out_path + "/arkcompiler/toolchain/libark_inspector" + dylib_suffix ]
144
145  deps += [ "//third_party/libuv:uv" ]
146  out_path = get_label_info("//third_party/libuv:uv", "root_out_dir")
147  sources += [ out_path + "/thirdparty/libuv/libuv" + dylib_suffix ]
148
149  deps += [ "${hilog_path}/interfaces/native/innerkits:libhilog" ]
150  out_path =
151      get_label_info("${hilog_path}/interfaces/native/innerkits:libhilog",
152                     "root_out_dir")
153  sources += [ out_path + "/hiviewdfx/hilog/libhilog" + dylib_suffix ]
154
155  deps += [ "//third_party/icu/icu4c:shared_icui18n" ]
156  out_path =
157      get_label_info("//third_party/icu/icu4c:shared_icui18n", "root_out_dir")
158  sources += [ out_path + "/thirdparty/icu/libhmicui18n" + dylib_suffix ]
159
160  deps += [ "//third_party/icu/icu4c:shared_icuuc" ]
161  out_path =
162      get_label_info("//third_party/icu/icu4c:shared_icuuc", "root_out_dir")
163  sources += [ out_path + "/thirdparty/icu/libhmicuuc" + dylib_suffix ]
164
165  deps += [ "//third_party/bounds_checking_function:libsec_shared" ]
166  out_path =
167      get_label_info("//third_party/bounds_checking_function:libsec_shared",
168                     "root_out_dir")
169  sources += [ out_path + "/thirdparty/bounds_checking_function/libsec_shared" +
170               dylib_suffix ]
171
172  deps += [ "${ets_utils_path}/js_sys_module/timer:timer" ]
173  out_path = get_label_info("${ets_utils_path}/js_sys_module/timer:timer",
174                            "root_out_dir")
175  sources += [ out_path + "/commonlibrary/ets_utils/libtimer" + dylib_suffix ]
176
177  deps += [ "${ets_utils_path}/js_sys_module/console:console" ]
178  out_path = get_label_info("${ets_utils_path}/js_sys_module/console:console",
179                            "root_out_dir")
180  sources += [ out_path + "/commonlibrary/ets_utils/libconsole" + dylib_suffix ]
181
182  outputs = [ target_out_dir + "/bin/{{source_file_part}}" ]
183  module_source_dir = target_out_dir + "/bin"
184  module_install_name = ""
185}
186