1# Copyright (c) 2022-2023 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/es2panda/es2abc_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 19es2abc_gen_abc("gen_abc_js_mock") { 20 js_mock_path = 21 get_label_info("${previewer_path}/automock:gen_snapshot_jsmock", 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 = [ "${previewer_path}/automock:gen_snapshot_jsmock" ] 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_inner") { 48 if (is_mingw || is_mac) { 49 if (is_mingw) { 50 defines = [ 51 "WINDOWS_PLATFORM", 52 "NOGDI", 53 ] 54 } 55 56 cflags = [ "-std=c++17" ] 57 58 include_dirs = [ 59 "${ability_runtime_path}/interfaces/kits/native/ability/native/ability_business_error", 60 "${ability_runtime_native_path}/runtime", 61 "${ability_runtime_innerkits_path}/ability_manager/include", 62 "${ability_runtime_innerkits_path}/runtime/include", 63 "${windowmanager_path}/previewer/include", 64 "${windowmanager_path}/previewer/mock", 65 "${windowmanager_path}/previewer/mock/transaction", 66 "${windowmanager_path}/previewer/mock/ui", 67 "${windowmanager_path}/interfaces/innerkits/wm", 68 "${windowmanager_path}/interfaces/kits/napi/window_runtime/window_stage_napi", 69 "${previewer_path}/jsapp/rich/external", 70 ] 71 72 sources = [ 73 "${ability_runtime_native_path}/ability/native/ability_business_error/ability_business_error.cpp", 74 "${ability_runtime_native_path}/runtime/js_module_searcher.cpp", 75 "src/ability_context.cpp", 76 "src/ability_stage_context.cpp", 77 "src/common_func.cpp", 78 "src/js_ability_context.cpp", 79 "src/js_ability_stage_context.cpp", 80 "src/js_application_context_utils.cpp", 81 "src/js_console_log.cpp", 82 "src/js_context_utils.cpp", 83 "src/js_data_converter.cpp", 84 "src/js_resource_manager_utils.cpp", 85 "src/js_runtime_utils.cpp", 86 "src/js_timer.cpp", 87 "src/resource_manager_addon.cpp", 88 "src/simulator.cpp", 89 ] 90 91 public_configs = [ 92 ":ability_simulator_public_config", 93 "${simulator_path}/common:ability_simulator_common_config", 94 ] 95 96 configs = [ "${windowmanager_path}/previewer:previewer_window_config" ] 97 98 deps = [ ":gen_obj_src_js_mock_abc" ] 99 100 external_deps = [ 101 "ability_base:string_utils", 102 "ets_runtime:libark_jsruntime", 103 "hilog:libhilog", 104 "napi:ace_napi", 105 "napi:ace_napi_ark", 106 "previewer:ide_extension", 107 "window_manager:previewer_window", 108 "window_manager:previewer_window_napi", 109 ] 110 111 if (is_mingw) { 112 external_deps += [ "resource_management:win_resmgr" ] 113 } else { 114 external_deps += [ "resource_management:mac_resmgr" ] 115 } 116 } 117 118 output_name = "ability_simulator" 119 innerapi_tags = [ "platformsdk" ] 120 part_name = "ability_runtime" 121 subsystem_name = "ability" 122} 123 124group("ability_simulator") { 125 if (is_mingw || is_mac) { 126 public_deps = [ ":ability_simulator_inner" ] 127 } 128} 129