• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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/dfs_service/distributedfile.gni")
16
17config("compiler_configs") {
18  visibility = [ ":*" ]
19  visibility += [
20    "${distributedfile_path}/services/*",
21    "${distributedfile_path}/test/moduletest/*",
22  ]
23
24  cflags = [
25    "-Wall",
26    "-Werror",
27    "-Wdate-time",
28    "-Wfloat-equal",
29    "-Wshadow",
30    "-Wformat=2",
31    "-ffunction-sections",
32    "-Os",
33  ]
34  configs = [ "//build/config/compiler:exceptions" ]
35
36  cflags_cc = [
37    "-fvisibility-inlines-hidden",
38    "-Os",
39  ]
40
41  defines = [
42    "LOG_DOMAIN=0xD001600",
43    "LOG_LEVEL=INFO",
44  ]
45}
46
47config("utils_public_config") {
48  include_dirs = [
49    "inner_api",
50    "load/include",
51    "log/include",
52    "work/include",
53    "system/include",
54  ]
55}
56
57config("optimize-size") {
58  cflags = [
59    "-fdata-sections",
60    "-ffunction-sections",
61    "-Oz",
62  ]
63  cflags_cc = [
64    "-fvisibility-inlines-hidden",
65    "-Oz",
66  ]
67}
68
69ohos_shared_library("libdistributedfileutils") {
70  branch_protector_ret = "pac_ret"
71  configs = [ ":optimize-size" ]
72  sanitize = {
73    integer_overflow = true
74    ubsan = true
75    boundary_sanitize = true
76    cfi = true
77    cfi_cross_dso = true
78    debug = false
79  }
80  sources = [
81    "cloud_disk/src/cloud_file_utils.cpp",
82    "dfx/src/xcollie_helper.cpp",
83    "ffrt/src/ffrt_timer.cpp",
84    "load/src/plugin_loader.cpp",
85    "log/src/dfs_error.cpp",
86    "log/src/utils_log.cpp",
87    "preference/src/cloud_pref_impl.cpp",
88    "system/src/dfsu_access_token_helper.cpp",
89    "system/src/dfsu_fd_guard.cpp",
90    "system/src/dfsu_memory_guard.cpp",
91    "system/src/dfsu_mount_argument_descriptors.cpp",
92    "system/src/dfsu_timer.cpp",
93    "system/src/sys_utils.cpp",
94    "system/src/utils_directory.cpp",
95    "work/src/async_work.cpp",
96  ]
97
98  configs += [ "//build/config/compiler:exceptions" ]
99  public_configs = [ ":utils_public_config" ]
100
101  cflags = [ "-D_FORTIFY_SOURCE=2" ]
102
103  defines = [
104    "LOG_DOMAIN=0xD004308",
105    "LOG_TAG=\"distributedfile_utils\"",
106  ]
107
108  if (use_musl) {
109    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
110      defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ]
111    }
112  }
113
114  external_deps = [
115    "ability_base:want",
116    "ability_base:zuri",
117    "ability_runtime:uri_permission_mgr",
118    "access_token:libaccesstoken_sdk",
119    "access_token:libtokenid_sdk",
120    "c_utils:utils",
121    "device_manager:devicemanagersdk",
122    "ffrt:libffrt",
123    "file_api:filemgmt_libhilog",
124    "file_api:filemgmt_libn",
125    "hilog:libhilog",
126    "hisysevent:libhisysevent",
127    "ipc:ipc_core",
128    "json:nlohmann_json_static",
129    "napi:ace_napi",
130    "preferences:native_preferences",
131  ]
132
133  if (cloudsync_service_hicollie_enable) {
134    external_deps += [ "hicollie:libhicollie" ]
135    defines += [ "HICOLLIE_ENABLE" ]
136  }
137
138  part_name = "dfs_service"
139  innerapi_tags = [ "platformsdk" ]
140  subsystem_name = "filemanagement"
141}
142
143config("dentry_public_config") {
144  include_dirs = [
145    "dentry/include",
146    "inner_api",
147    "system/include",
148  ]
149}
150
151ohos_shared_library("libdistributedfiledentry") {
152  branch_protector_ret = "pac_ret"
153  configs = [ ":optimize-size" ]
154  sanitize = {
155    integer_overflow = true
156    ubsan = true
157    boundary_sanitize = true
158    cfi = true
159    cfi_cross_dso = true
160    debug = false
161  }
162
163  sources = [
164    "dentry/src/file_utils.cpp",
165    "dentry/src/meta_file.cpp",
166    "dentry/src/meta_file_clouddisk.cpp",
167    "system/src/utils_directory.cpp",
168  ]
169
170  public_configs = [ ":dentry_public_config" ]
171
172  cflags = [ "-D_FORTIFY_SOURCE=2" ]
173
174  deps = [ "${utils_path}:libdistributedfileutils" ]
175
176  external_deps = [
177    "c_utils:utils",
178    "device_manager:devicemanagersdk",
179    "hilog:libhilog",
180    "hisysevent:libhisysevent",
181    "json:nlohmann_json_static",
182  ]
183
184  defines = [
185    "LOG_DOMAIN=0xD004307",
186    "LOG_TAG=\"CLOUDSYNC_SA\"",
187  ]
188
189  if (cloudsync_service_hicollie_enable) {
190    external_deps += [ "hicollie:libhicollie" ]
191    defines += [ "HICOLLIE_ENABLE" ]
192  }
193
194  part_name = "dfs_service"
195  subsystem_name = "filemanagement"
196}
197
198config("utils_lite_public_config") {
199  include_dirs = [
200    "dentry/include",
201    "inner_api",
202    "load/include",
203    "log/include",
204    "system/include",
205  ]
206}
207
208ohos_shared_library("libdistributedfileutils_lite") {
209  branch_protector_ret = "pac_ret"
210  configs = [ ":optimize-size" ]
211  sanitize = {
212    integer_overflow = true
213    ubsan = true
214    boundary_sanitize = true
215    cfi = true
216    cfi_cross_dso = true
217    debug = false
218  }
219
220  sources = [
221    "cloud_disk/src/cloud_file_utils.cpp",
222    "dentry/src/file_utils.cpp",
223    "dentry/src/meta_file.cpp",
224    "dentry/src/meta_file_clouddisk.cpp",
225    "dfx/src/xcollie_helper.cpp",
226    "ffrt/src/ffrt_timer.cpp",
227    "load/src/plugin_loader.cpp",
228    "log/src/dfs_error.cpp",
229    "log/src/utils_log.cpp",
230    "system/src/dfsu_memory_guard.cpp",
231    "system/src/utils_directory.cpp",
232  ]
233
234  configs += [ "//build/config/compiler:exceptions" ]
235  public_configs = [ ":utils_lite_public_config" ]
236
237  cflags = [ "-D_FORTIFY_SOURCE=2" ]
238
239  defines = [
240    "LOG_DOMAIN=0xD004308",
241    "LOG_TAG=\"CloudFileDaemon\"",
242  ]
243
244  deps = []
245
246  external_deps = [
247    "c_utils:utils",
248    "device_manager:devicemanagersdk",
249    "ffrt:libffrt",
250    "hilog:libhilog",
251    "hisysevent:libhisysevent",
252    "json:nlohmann_json_static",
253  ]
254
255  if (use_musl) {
256    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
257      defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ]
258    }
259  }
260
261  if (cloudsync_service_hicollie_enable) {
262    external_deps += [ "hicollie:libhicollie" ]
263    defines += [ "HICOLLIE_ENABLE" ]
264  }
265
266  part_name = "dfs_service"
267  innerapi_tags = [ "platformsdk" ]
268  subsystem_name = "filemanagement"
269}
270