1# Copyright (c) 2022-2025 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/config/components/ace_engine/ace_gen_obj.gni") 15import("//build/ohos.gni") 16import("//foundation/ability/ability_runtime/ability_runtime.gni") 17 18config("ability_simulator_public_config") { 19 include_dirs = [ "include" ] 20 cflags_cc = [ "-Wno-unused-variable" ] 21} 22 23ohos_shared_library("ability_simulator_inner") { 24 if (is_mingw || is_mac) { 25 defines = [] 26 if (is_mingw) { 27 defines += [ 28 "WINDOWS_PLATFORM", 29 "NOGDI", 30 "NONLS", 31 ] 32 } 33 defines += [ 34 "OFFSET_PREVIEW=0", 35 "__IDE_PREVIEW__", 36 ] 37 38 cflags = [ "-std=c++17" ] 39 40 include_dirs = [ 41 "${ability_runtime_path}/js_environment/interfaces/inner_api", 42 "${ability_runtime_path}/interfaces/kits/native/ability/native/ability_business_error", 43 "${ability_runtime_native_path}/runtime", 44 "${ability_runtime_innerkits_path}/ability_manager/include", 45 "${ability_runtime_innerkits_path}/error_utils/include", 46 "${ability_runtime_innerkits_path}/runtime/include", 47 "${windowmanager_path}/previewer/include", 48 "${windowmanager_path}/previewer/mock", 49 "${windowmanager_path}/previewer/mock/transaction", 50 "${windowmanager_path}/previewer/mock/ui", 51 "${windowmanager_path}/interfaces/innerkits/wm", 52 "${windowmanager_path}/interfaces/kits/napi/window_runtime/window_stage_napi", 53 "include/bundle_parser", 54 "${simulator_path}/napi_module/application", 55 ] 56 57 sources = [ 58 "${ability_runtime_native_path}/ability/native/ability_business_error/ability_business_error.cpp", 59 "${ability_runtime_native_path}/runtime/js_module_searcher.cpp", 60 "${ability_runtime_path}/js_environment/frameworks/js_environment/src/source_map.cpp", 61 "${simulator_path}/napi_module/application/application_module.cpp", 62 "${simulator_path}/napi_module/application/js_application.cpp", 63 "${simulator_path}/napi_module/application/napi_base_context.cpp", 64 "src/ability_context.cpp", 65 "src/ability_runtime_error_util.cpp", 66 "src/ability_stage_context.cpp", 67 "src/bundle_parser/ability_info.cpp", 68 "src/bundle_parser/application_info.cpp", 69 "src/bundle_parser/bundle_container.cpp", 70 "src/bundle_parser/bundle_info.cpp", 71 "src/bundle_parser/extension_ability_info.cpp", 72 "src/bundle_parser/hap_module_info.cpp", 73 "src/bundle_parser/inner_bundle_info.cpp", 74 "src/bundle_parser/module_info.cpp", 75 "src/bundle_parser/module_profile.cpp", 76 "src/bundle_parser/overlay_bundle_info.cpp", 77 "src/common_func.cpp", 78 "src/context_impl.cpp", 79 "src/js_ability_context.cpp", 80 "src/js_ability_stage_context.cpp", 81 "src/js_application_context_utils.cpp", 82 "src/js_console_log.cpp", 83 "src/js_context_utils.cpp", 84 "src/js_data_converter.cpp", 85 "src/js_error_utils.cpp", 86 "src/js_resource_manager_utils.cpp", 87 "src/js_runtime.cpp", 88 "src/js_runtime_utils.cpp", 89 "src/js_timer.cpp", 90 "src/resource_manager_helper.cpp", 91 "src/simulator.cpp", 92 ] 93 94 public_configs = [ 95 ":ability_simulator_public_config", 96 "${simulator_path}/common:ability_simulator_common_config", 97 ] 98 99 configs = [ "${windowmanager_path}/previewer:previewer_window_config" ] 100 101 external_deps = [ 102 "ability_base:string_utils", 103 "ets_runtime:libark_jsruntime", 104 "ets_utils:console", 105 "ets_utils:timer", 106 "hilog:libhilog", 107 "json:nlohmann_json_static", 108 "napi:ace_napi", 109 "previewer:ide_extension", 110 "resource_management:resmgr_napi_core_preview", 111 ] 112 113 if (ability_runtime_graphics) { 114 external_deps += [ 115 "ace_engine:ace_uicontent", 116 "window_manager:previewer_window", 117 "window_manager:previewer_window_napi", 118 ] 119 } 120 121 if (is_mingw) { 122 external_deps += [ "resource_management:win_resmgr" ] 123 } else { 124 external_deps += [ "resource_management:mac_resmgr" ] 125 } 126 } 127 128 output_name = "ability_simulator" 129 innerapi_tags = [ "platformsdk" ] 130 part_name = "ability_runtime" 131 subsystem_name = "ability" 132} 133 134group("ability_simulator") { 135 if (is_mingw || is_mac) { 136 public_deps = [ ":ability_simulator_inner" ] 137 } 138} 139