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