1# Copyright (c) 2020 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.
13import("//build/lite/config/component/lite_component.gni")
14import(
15    "//foundation/bundlemanager/bundle_framework_lite/bundle_framework_lite.gni")
16
17config("bundle_config") {
18  defines = [ "OHOS_APPEXECFWK_BMS_BUNDLEMANAGER" ]
19  cflags_cc = [ "-std=c++14" ]
20}
21
22if (ohos_kernel_type == "liteos_m") {
23  static_library("bundlems") {
24    sources = [
25      "src/bundle_map.cpp",
26      "src/bundle_mgr_service.cpp",
27      "src/bundle_mgr_slite_feature.cpp",
28      "src/bundle_util.cpp",
29      "src/gt_bundle_extractor.cpp",
30      "src/gt_bundle_installer.cpp",
31      "src/gt_bundle_manager_service.cpp",
32      "src/gt_bundle_parser.cpp",
33      "src/gt_extractor_util.cpp",
34    ]
35
36    defines = [ "JERRY_FOR_IAR_CONFIG" ]
37    if (bundle_framework_lite_enable_ohos_bundle_manager_service == true) {
38      defines += [ "_MINI_BMS_" ]
39    }
40
41    if (bundle_framework_lite_enable_ohos_bundle_manager_service_permission ==
42        true) {
43      defines += [
44        "_MINI_BMS_PERMISSION_",
45        "BC_TRANS_ENABLE",
46      ]
47    }
48
49    if (bundle_framework_lite_enable_ohos_bundle_manager_service_parse_metadata == true) {
50      defines += [ "_MINI_BMS_PARSE_METADATA_" ]
51    }
52
53    deps = [
54      "${ace_engine_lite_path}/frameworks:ace_lite",
55      "${appexecfwk_lite_path}/frameworks/bundle_lite:bundle",
56      "${hilog_lite_path}/frameworks/featured:hilog_static",
57      "${resource_management_lite_path}/frameworks/resmgr_lite:global_resmgr",
58      "${samgr_lite_path}/samgr:samgr",
59      "//build/lite/config/component/cJSON:cjson_static",
60      "//third_party/jerryscript/jerry-core:jerry-core_static",
61    ]
62
63    include_dirs = [
64      "${appexecfwk_lite_path}/services/bundlemgr_lite/include",
65      "${appexecfwk_lite_path}/interfaces/inner_api/bundlemgr_lite/slite",
66      "${appexecfwk_lite_path}/interfaces/inner_api/bundlemgr_lite",
67      "${appexecfwk_lite_path}/interfaces/kits/bundle_lite/slite",
68      "${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
69      "${appexecfwk_lite_path}/utils/bundle_lite",
70      "${appexecfwk_lite_path}/frameworks/bundle_lite/include",
71      "${hilog_lite_path}/interfaces/native/kits/hilog_lite",
72      "${startup_path}/init/interfaces/innerkits/include/syspara",
73      "${aafwk_lite_path}/interfaces/kits/ability_lite/slite",
74      "${aafwk_lite_path}/services/abilitymgr_lite/include",
75      "${aafwk_lite_path}/interfaces/inner_api/abilitymgr_lite",
76      "${aafwk_lite_path}/interfaces/kits/ability_lite",
77      "${aafwk_lite_path}/interfaces/kits/want_lite",
78      "${aafwk_lite_path}/frameworks/want_lite/include",
79      "${resource_management_lite_path}/interfaces/inner_api/include",
80      "${samgr_lite_path}/interfaces/kits/registry",
81      "${samgr_lite_path}/interfaces/kits/samgr",
82      "//third_party/jerryscript/jerry-core",
83      "//third_party/jerryscript/jerry-core/api",
84      "//third_party/jerryscript/jerry-core/ecma/base",
85      "//third_party/jerryscript/jerry-core/include",
86      "//third_party/jerryscript/jerry-core/jrt",
87      "//third_party/jerryscript/jerry-core/jmem",
88      "//third_party/jerryscript/jerry-core/lit",
89      "//third_party/cJSON",
90      "//third_party/zlib",
91      "//third_party/zlib/contrib/minizip",
92      "${permission_lite_path}/interfaces/kits",
93      "${permission_lite_path}/services/pms/include",
94      "${appverify_lite_path}/include",
95      "//third_party/bounds_checking_function/include",
96      "${utils_lite_path}/include",
97      "${utils_lite_path}/memory/include",
98      "include",
99    ]
100  }
101  lite_component("appexecfwk_services_lite") {
102    features = [ ":bundlems" ]
103  }
104} else {
105  shared_library("bundlems") {
106    configs -= [ "//build/lite/config:language_cpp" ]
107    configs += [ ":bundle_config" ]
108
109    cflags = [
110      "-Wall",
111      "-Wno-format",
112      "-Wno-format-extra-args",
113    ]
114    cflags_cc = cflags
115
116    sources = [
117      "src/bundle_daemon_client.cpp",
118      "src/bundle_extractor.cpp",
119      "src/bundle_info_creator.cpp",
120      "src/bundle_inner_feature.cpp",
121      "src/bundle_installer.cpp",
122      "src/bundle_manager_service.cpp",
123      "src/bundle_map.cpp",
124      "src/bundle_ms_feature.cpp",
125      "src/bundle_ms_host.cpp",
126      "src/bundle_parser.cpp",
127      "src/bundle_res_transform.cpp",
128      "src/bundle_util.cpp",
129      "src/extractor_util.cpp",
130      "src/hap_sign_verify.cpp",
131      "src/zip_file.cpp",
132    ]
133    include_dirs = [
134      "${resource_management_lite_path}/interfaces/inner_api/include",
135      "${aafwk_lite_path}/services/abilitymgr_lite/include",
136      "${aafwk_lite_path}/interfaces/inner_api/abilitymgr_lite",
137      "${aafwk_lite_path}/interfaces/kits/ability_lite",
138      "${aafwk_lite_path}/interfaces/kits/want_lite",
139      "${aafwk_lite_path}/frameworks/want_lite/include",
140      "${appexecfwk_lite_path}/interfaces/inner_api/bundlemgr_lite",
141      "${appexecfwk_lite_path}/frameworks/bundle_lite/include",
142      "${appexecfwk_lite_path}/interfaces/kits/bundle_lite",
143      "${appexecfwk_lite_path}/utils/bundle_lite",
144      "${samgr_lite_path}/interfaces/kits/registry",
145      "${samgr_lite_path}/interfaces/kits/samgr",
146      "//third_party/cJSON",
147      "//third_party/zlib",
148      "//third_party/zlib/contrib/minizip",
149      "${permission_lite_path}/interfaces/kits",
150      "${permission_lite_path}/services/pms/include",
151      "${appverify_lite_path}/include",
152      "//third_party/bounds_checking_function/include",
153      "${utils_lite_path}/include",
154      "${utils_lite_path}/memory",
155      "include",
156    ]
157
158    public_deps = [
159      "${appexecfwk_lite_path}/frameworks/bundle_lite:bundle",
160      "${appverify_lite_path}:verify",
161      "${hilog_lite_path}/frameworks/featured:hilog_shared",
162      "${resource_management_lite_path}/frameworks/resmgr_lite:global_resmgr",
163      "${samgr_lite_path}/samgr:samgr",
164      "//build/lite/config/component/cJSON:cjson_shared",
165      "//build/lite/config/component/zlib:zlib_shared",
166    ]
167  }
168  lite_component("appexecfwk_services_lite") {
169    features = [
170      ":bundlems",
171      "tools:bm",
172      "bundle_daemon:bundle_daemon",
173    ]
174  }
175}
176
177generate_notice_file("appexecfwk_services_lite_notice_file") {
178  module_name = "appexecfwk_services_lite"
179  module_source_dir_list = [
180    "//third_party/cJSON",
181    "//third_party/zlib",
182    "//third_party/bounds_checking_function",
183  ]
184}
185