1# Copyright (c) 2021-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/filemanagement/user_file_service/filemanagement_aafwk.gni")
16
17group("user_file_managers") {
18  deps = [
19    ":external_file_manager_hap",
20    ":file_access_service",
21    ":file_access_service.cfg",
22    ":file_access_service_profile",
23  ]
24}
25
26ohos_hap("external_file_manager_hap") {
27  hap_profile = "file_extension_hap/entry/src/main/module.json"
28  deps = [
29    ":external_file_manager_js_assets",
30    ":external_file_manager_resources",
31  ]
32  publicity_file = "../publicity.xml"
33  certificate_profile = "signature/fileextension.p7b"
34  hap_name = "external_file_manager"
35  subsystem_name = "filemanagement"
36  part_name = "user_file_service"
37  module_install_dir = "app/com.ohos.UserFile.ExternalFileManager"
38}
39
40ohos_js_assets("external_file_manager_js_assets") {
41  hap_profile = "file_extension_hap/entry/src/main/module.json"
42  ets2abc = true
43  source_dir = "file_extension_hap/entry/src/main/ets"
44}
45
46ohos_app_scope("external_file_manager_app_profile") {
47  app_profile = "file_extension_hap/AppScope/app.json"
48  sources = [ "file_extension_hap/AppScope/resources" ]
49}
50
51ohos_sa_profile("file_access_service_profile") {
52  sources = [ "5010.json" ]
53  part_name = "user_file_service"
54}
55
56ohos_prebuilt_etc("file_access_service.cfg") {
57  source = "file_access_service.cfg"
58  relative_install_dir = "init"
59  subsystem_name = "filemanagement"
60  part_name = "user_file_service"
61}
62
63config("ability_config") {
64  visibility = [ ":*" ]
65  include_dirs = [
66    "native/file_access_service/include",
67    "${user_file_service_path}/utils",
68    "${user_file_service_path}/interfaces/inner_api/file_access/include",
69    "${user_file_service_path}/frameworks/js/napi/file_access_module",
70  ]
71}
72
73config("ability_public_config") {
74  visibility = [ ":*" ]
75  include_dirs = [
76    "native/file_access_service/include",
77    "${user_file_service_path}/utils",
78    "${user_file_service_path}/interfaces/kits/js/src/common",
79  ]
80}
81
82ohos_resources("external_file_manager_resources") {
83  sources = [ "file_extension_hap/entry/src/main/resources" ]
84  deps = [ ":external_file_manager_app_profile" ]
85  hap_profile = "file_extension_hap/entry/src/main/module.json"
86}
87
88ohos_shared_library("file_access_service") {
89  branch_protector_ret = "pac_ret"
90  sanitize = {
91    integer_overflow = true
92    ubsan = true
93    boundary_sanitize = true
94    cfi = true
95    cfi_cross_dso = true
96    debug = false
97  }
98
99  include_dirs = [
100    "${user_file_service_path}/services/native/file_access_service/include",
101    "${user_file_service_path}/interfaces/inner_api/file_access/include",
102  ]
103  shlib_type = "sa"
104  sources = [
105    "native/file_access_service/src/file_access_ext_connection.cpp",
106    "native/file_access_service/src/file_access_service.cpp",
107    "native/file_access_service/src/file_access_service_proxy.cpp",
108    "native/file_access_service/src/file_access_service_stub.cpp",
109    "native/file_access_service/src/observer_callback_proxy.cpp",
110    "native/file_access_service/src/observer_callback_stub.cpp",
111  ]
112  configs = [ ":ability_config" ]
113  version_script = "libfile_access_service.map"
114  public_configs = [ ":ability_public_config" ]
115
116  deps = [ "${user_file_service_path}/interfaces/inner_api/file_access:file_access_extension_ability_kit" ]
117
118  external_deps = [
119    "ability_base:want",
120    "ability_base:zuri",
121    "ability_runtime:ability_manager",
122    "ability_runtime:napi_common",
123    "access_token:libaccesstoken_sdk",
124    "access_token:libtokenid_sdk",
125    "bundle_framework:appexecfwk_core",
126    "c_utils:utils",
127    "hilog:libhilog",
128    "hitrace:hitrace_meter",
129    "ipc:ipc_core",
130    "safwk:system_ability_fwk",
131    "samgr:samgr_proxy",
132  ]
133
134  subsystem_name = "filemanagement"
135  part_name = "user_file_service"
136}
137