1# Copyright (c) 2022-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("//foundation/ability/ability_runtime/ability_runtime.gni")
16
17config("upms_config") {
18  visibility = [ ":*" ]
19  visibility += [ "${ability_runtime_test_path}/unittest/*" ]
20  include_dirs = [
21    "include",
22    "${ability_runtime_utils_path}/global/constant",
23  ]
24  cflags = []
25  if (target_cpu == "arm") {
26    cflags += [ "-DBINDER_IPC_32BIT" ]
27  }
28}
29
30libupms_sources = [
31  "src/file_permission_manager.cpp",
32  "src/media_permission_manager.cpp",
33  "src/tokenid_permission.cpp",
34  "src/uri_permission_manager_service.cpp",
35  "src/uri_permission_manager_stub_impl.cpp",
36  "src/uri_permission_utils.cpp",
37]
38
39#build so
40ohos_shared_library("libupms") {
41  sanitize = {
42    cfi = true
43    cfi_cross_dso = true
44    debug = false
45  }
46  branch_protector_ret = "pac_ret"
47  shlib_type = "sa"
48  configs = [
49    "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config",
50    "${ability_runtime_services_path}/common:common_config",
51    "${ability_runtime_services_path}/abilitymgr:abilityms_config",
52  ]
53  public_configs = [ ":upms_config" ]
54
55  include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper" ]
56
57  sources = libupms_sources
58
59  deps = [
60    "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper",
61    "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr",
62    "${ability_runtime_native_path}/appkit:appkit_manager_helper",
63    "${ability_runtime_services_path}/common:app_util",
64    "${ability_runtime_services_path}/common:event_report",
65    "${ability_runtime_services_path}/common:perm_verification",
66  ]
67
68  external_deps = [
69    "ability_base:configuration",
70    "ability_base:want",
71    "ability_base:zuri",
72    "access_token:libaccesstoken_sdk",
73    "access_token:libtokenid_sdk",
74    "app_file_service:fileuri_native",
75    "background_task_mgr:bgtaskmgr_innerkits",
76    "bundle_framework:appexecfwk_base",
77    "bundle_framework:appexecfwk_core",
78    "c_utils:utils",
79    "common_event_service:cesfwk_core",
80    "common_event_service:cesfwk_innerkits",
81    "data_share:datashare_consumer",
82    "eventhandler:libeventhandler",
83    "graphic_2d:color_manager",
84    "hilog:libhilog",
85    "hisysevent:libhisysevent",
86    "hitrace:hitrace_meter",
87    "image_framework:image_native",
88    "init:libbeget_proxy",
89    "init:libbegetutil",
90    "ipc:ipc_core",
91    "media_library:media_library_manager",
92    "relational_store:native_dataability",
93    "relational_store:native_rdb",
94    "safwk:system_ability_fwk",
95    "samgr:samgr_proxy",
96    "storage_service:storage_manager_sa_proxy",
97  ]
98  if (ability_runtime_feature_sandboxmanager) {
99    external_deps += [ "sandbox_manager:libsandbox_manager_sdk" ]
100    defines = [ "ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER" ]
101  }
102  if (ability_runtime_graphics) {
103    external_deps += [ "i18n:intl_util" ]
104  }
105
106  subsystem_name = "ability"
107  part_name = "ability_runtime"
108}
109
110# Note: Just for test
111ohos_static_library("libupms_static") {
112  sanitize = {
113    cfi = true
114    cfi_cross_dso = true
115    debug = false
116    blocklist = "../../test/cfi_blocklist.txt"
117  }
118  branch_protector_ret = "pac_ret"
119  configs = [
120    "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config",
121    "${ability_runtime_services_path}/common:common_config",
122  ]
123  public_configs = [ ":upms_config" ]
124
125  include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper" ]
126
127  sources = libupms_sources
128
129  deps = [
130    "${ability_runtime_innerkits_path}/uri_permission:uri_permission_mgr",
131    "${ability_runtime_services_path}/common:app_util",
132    "${ability_runtime_services_path}/common:perm_verification",
133  ]
134
135  external_deps = [
136    "ability_base:configuration",
137    "ability_base:want",
138    "ability_base:zuri",
139    "ability_runtime:ability_deps_wrapper",
140    "access_token:libaccesstoken_sdk",
141    "app_file_service:fileuri_native",
142    "bundle_framework:appexecfwk_base",
143    "bundle_framework:appexecfwk_core",
144    "c_utils:utils",
145    "common_event_service:cesfwk_core",
146    "common_event_service:cesfwk_innerkits",
147    "data_share:datashare_consumer",
148    "hilog:libhilog",
149    "hitrace:hitrace_meter",
150    "image_framework:image_native",
151    "init:libbeget_proxy",
152    "init:libbegetutil",
153    "ipc:ipc_core",
154    "media_library:media_library_manager",
155    "safwk:system_ability_fwk",
156    "samgr:samgr_proxy",
157    "storage_service:storage_manager_sa_proxy",
158  ]
159
160  if (ability_runtime_feature_sandboxmanager) {
161    external_deps += [ "sandbox_manager:libsandbox_manager_sdk" ]
162    defines = [ "ABILITY_RUNTIME_FEATURE_SANDBOXMANAGER" ]
163  }
164
165  subsystem_name = "ability"
166  part_name = "ability_runtime"
167}
168