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("//arkcompiler/ets_frontend/ts2panda/ts2abc_config.gni") 15import("//build/ohos.gni") 16import("//foundation/ability/ability_runtime/ability_runtime.gni") 17import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni") 18 19ts2abc_gen_abc("gen_abc_js_mock") { 20 js_mock_path = 21 get_label_info("//third_party/jsframework:gen_snapshot", 22 "target_out_dir") + "/dist/jsMockSystemPlugin.js" 23 src_js = rebase_path(js_mock_path) 24 dst_file = rebase_path(target_out_dir + "/jsMockSystemPlugin.abc") 25 in_puts = [ js_mock_path ] 26 out_puts = [ target_out_dir + "/jsMockSystemPlugin.abc" ] 27 extra_dependencies = [ "//third_party/jsframework:gen_snapshot" ] 28} 29 30gen_obj("js_mock_abc") { 31 input = get_label_info(":gen_abc_js_mock", "target_out_dir") + 32 "/jsMockSystemPlugin.abc" 33 34 if (is_mac || is_mingw) { 35 output = target_out_dir + "/js_mock_abc.c" 36 } else { 37 output = target_out_dir + "/js_mock_abc.o" 38 } 39 40 snapshot_dep = [ ":gen_abc_js_mock" ] 41} 42 43config("ability_simulator_public_config") { 44 include_dirs = [ "include" ] 45} 46 47ohos_shared_library("ability_simulator") { 48 if (is_mingw) { 49 defines = [ 50 "WINDOWS_PLATFORM", 51 "NOGDI", 52 ] 53 } 54 55 if (is_mingw) { 56 platform = "windows" 57 } else { 58 platform = "mac" 59 } 60 61 cflags = [ "-std=c++17" ] 62 63 include_dirs = [ 64 "//foundation/ability/ability_runtime/frameworks/native/runtime", 65 "//foundation/ability/ability_runtime/interfaces/inner_api/runtime/include", 66 ] 67 68 sources = [ 69 "//foundation/ability/ability_runtime/frameworks/native/runtime/js_console_log.cpp", 70 "//foundation/ability/ability_runtime/frameworks/native/runtime/js_module_searcher.cpp", 71 "//foundation/ability/ability_runtime/frameworks/native/runtime/js_runtime_utils.cpp", 72 "src/js_timer.cpp", 73 "src/simulator.cpp", 74 ] 75 76 public_configs = [ 77 ":ability_simulator_public_config", 78 "${ability_runtime_services_path}/common:common_config", 79 ] 80 81 configs = [ "//arkcompiler/ets_runtime:ark_jsruntime_public_config" ] 82 83 deps = [ 84 ":gen_obj_src_js_mock_abc", 85 "${ability_runtime_native_path}/runtime:string_utils", 86 "//arkcompiler/ets_runtime:libark_jsruntime", 87 "//arkcompiler/toolchain/inspector:ark_debugger", 88 "//arkcompiler/toolchain/tooling:libark_ecma_debugger", 89 "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_$platform", 90 "//foundation/ability/ability_runtime/frameworks/simulator/osal:simulator_osal", 91 "//foundation/arkui/napi:ace_napi", 92 "//foundation/arkui/napi:ace_napi_ark", 93 ] 94 95 part_name = "simulator" 96 subsystem_name = "ability" 97} 98