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("//build/ohos.gni") 15import("../../../appexecfwk.gni") 16 17config("cj_bundle_manager_ffi_config") { 18 visibility = [ ":*" ] 19 include_dirs = [ "src/" ] 20} 21 22ohos_shared_library("cj_bundle_manager_ffi") { 23 public_configs = [ ":cj_bundle_manager_ffi_config" ] 24 25 branch_protector_ret = "pac_ret" 26 27 sanitize = { 28 boundary_sanitize = true 29 cfi = true 30 cfi_cross_dso = true 31 debug = false 32 integer_overflow = true 33 ubsan = true 34 } 35 36 include_dirs = [ 37 "${bundle_framework_path}/common/log/include", 38 "src", 39 "${base_path}/include", 40 "${kits_path}/js/bundle_manager", 41 "${kits_path}/js/default_app", 42 "${kits_path}/js/zip/include", 43 "${kits_path}/js/common", 44 ] 45 46 if (!defined(defines)) { 47 defines = [] 48 } 49 50 cflags = [ 51 "-Os", 52 "-fstack-protector-strong", 53 ] 54 55 cflags_cc = [ 56 "-Os", 57 "-fstack-protector-strong", 58 ] 59 60 if (product_name != "ohos-sdk") { 61 sources = [ 62 "${kits_path}/js/zip/src/file_path.cpp", 63 "${kits_path}/js/zip/src/zip_internal.cpp", 64 "${kits_path}/js/zip/src/zip_reader.cpp", 65 "${kits_path}/js/zip/src/zip_utils.cpp", 66 "${kits_path}/js/zip/src/zip_writer.cpp", 67 "src/bundle_manager.cpp", 68 "src/bundle_manager_convert.cpp", 69 "src/bundle_manager_ffi.cpp", 70 "src/cj_zip.cpp", 71 "src/default_app.cpp", 72 "src/zip_ffi.cpp", 73 ] 74 75 deps = [ 76 "${base_path}:appexecfwk_base", 77 "${common_path}:libappexecfwk_common", 78 "${core_path}:appexecfwk_core", 79 "${kits_path}/js/common:bundle_napi_common", 80 "${kits_path}/js/zip:zlib", 81 ] 82 83 external_deps = [ 84 "ability_base:want", 85 "c_utils:utils", 86 "eventhandler:libeventhandler", 87 "ffrt:libffrt", 88 "hilog:libhilog", 89 "ipc:ipc_core", 90 "napi:ace_napi", 91 "napi:cj_bind_ffi", 92 "samgr:samgr_proxy", 93 "zlib:shared_libz", 94 ] 95 } else { 96 defines += [ "PREVIEWER" ] 97 sources = [ "src/bundle_manager_mock.cpp" ] 98 } 99 100 if (current_os == "ohos") { 101 defines += [ "OHOS_PLATFORM" ] 102 } 103 104 if (current_os == "mingw") { 105 defines += [ "WINDOWS_PLATFORM" ] 106 } 107 108 innerapi_tags = [ "platformsdk" ] 109 subsystem_name = "bundlemanager" 110 part_name = "bundle_framework" 111} 112