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/ets_runtime/js_runtime_config.gni") 15import("//build/ohos.gni") 16import("//build/ohos/sa_profile/sa_profile.gni") 17 18declare_args() { 19 code_sign_enable = true 20 21 if (defined(global_parts_info) && 22 !defined(global_parts_info.security_code_signature)) { 23 code_sign_enable = false 24 } 25} 26 27config("aot_compiler_service_config") { 28 visibility = [ ":*" ] 29 include_dirs = [ 30 "include", 31 "interface", 32 ] 33} 34 35ohos_shared_library("libcompiler_service") { 36 public_configs = [ ":aot_compiler_service_config" ] 37 configs = [ 38 "$js_root:ark_jsruntime_public_config", 39 "$js_root:ark_jsruntime_common_config", 40 ] 41 shlib_type = "sa" 42 version_script = "libaot_compiler_service.map" 43 sources = [ 44 "${js_root}/common_components/log/log.cpp", 45 "${js_root}/ecmascript/compiler/aot_compiler_stats.cpp", 46 "interface/aot_compiler_interface_proxy.cpp", 47 "interface/aot_compiler_interface_stub.cpp", 48 "src/aot_args_handler.cpp", 49 "src/aot_compiler_client.cpp", 50 "src/aot_compiler_error_utils.cpp", 51 "src/aot_compiler_impl.cpp", 52 "src/aot_compiler_load_callback.cpp", 53 "src/aot_compiler_service.cpp", 54 "src/power_disconnected_listener.cpp", 55 "src/screen_status_listener.cpp", 56 "src/thermal_mgr_listener.cpp", 57 ] 58 if (enable_target_compilation) { 59 sources += [ 60 "${js_root}/ecmascript/platform/unix/ohos/directory.cpp", 61 "${js_root}/ecmascript/platform/unix/linux/os.cpp", 62 ] 63 } else if (is_mingw) { 64 sources += [ 65 "${js_root}/ecmascript/platform/windows/directory.cpp", 66 "${js_root}/ecmascript/platform/windows/os.cpp", 67 ] 68 } else { 69 sources += [ 70 "${js_root}/ecmascript/platform/unix/directory.cpp", 71 "${js_root}/ecmascript/platform/unix/linux/os.cpp", 72 ] 73 } 74 if (is_mingw) { 75 sources += [ 76 "${js_root}/ecmascript/platform/windows/file.cpp", 77 ] 78 } else { 79 sources += [ 80 "${js_root}/ecmascript/platform/unix/file.cpp", 81 ] 82 } 83 external_deps = [ 84 "ability_base:want", 85 "access_token:libaccesstoken_sdk", 86 "access_token:libtokenid_sdk", 87 "c_utils:utils", 88 "common_event_service:cesfwk_innerkits", 89 "eventhandler:libeventhandler", 90 "hilog:libhilog", 91 "hisysevent:libhisysevent", 92 "hitrace:hitrace_meter", 93 "icu:shared_icui18n", 94 "icu:shared_icuuc", 95 "ipc:ipc_core", 96 "runtime_core:libarkfile_static", 97 "safwk:system_ability_fwk", 98 "samgr:samgr_proxy", 99 ] 100 101 defines = [] 102 if (code_sign_enable) { 103 external_deps += [ "code_signature:liblocal_code_sign_sdk" ] 104 defines += [ "CODE_SIGN_ENABLE" ] 105 } 106 107 if (!ark_standalone_build && !(defined(is_arkui_x) && is_arkui_x) && 108 is_ohos && is_standard_system) { 109 external_deps += [ "init:libbegetutil" ] 110 defines += [ "ENABLE_COMPILER_SERVICE_GET_PARAMETER" ] 111 } 112 113 install_enable = true 114 install_images = [ "system" ] 115 116 part_name = "ets_runtime" 117 subsystem_name = "arkcompiler" 118} 119 120ohos_prebuilt_etc("compiler_service_cfg") { 121 source = "compiler_service.cfg" 122 relative_install_dir = "init" 123 part_name = "ets_runtime" 124 subsystem_name = "arkcompiler" 125} 126 127ohos_prebuilt_etc("ark_aot_compiler.cfg") { 128 source = "ark_aot_compiler.cfg" 129 relative_install_dir = "init" 130 131 # Set the subsystem name 132 part_name = "ets_runtime" 133 subsystem_name = "arkcompiler" 134} 135 136ohos_prebuilt_etc("system_framework_aot_enable_list.conf") { 137 relative_install_dir = "ark" 138 source = "system_framework_aot_enable_list.conf" 139 140 # Set the subsystem name 141 part_name = "ets_runtime" 142 subsystem_name = "arkcompiler" 143} 144 145ohos_sa_profile("compiler_sa_profile") { 146 sources = [ "sa_profile/5300.json" ] 147 part_name = "ets_runtime" 148} 149 150group("compiler_service") { 151 deps = [ 152 ":compiler_sa_profile", 153 ":compiler_service_cfg", 154 ":libcompiler_service", 155 ] 156} 157