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