1# Copyright (C) 2022 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("public_config") {
18  include_dirs = [ "." ]
19}
20
21config("private_config") {
22  include_dirs = [
23    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner_lite/include",
24    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/include",
25    "${distributedfile_path}/interfaces/inner_api/native/cloudsync_kit_inner",
26    "${distributedfile_path}/utils/log/include",
27  ]
28}
29
30config("optimize-size") {
31  cflags = [
32    "-fdata-sections",
33    "-ffunction-sections",
34    "-Oz",
35  ]
36  cflags_cc = [
37    "-fvisibility-inlines-hidden",
38    "-Oz",
39  ]
40}
41
42ohos_shared_library("cloudsync_kit_inner") {
43  branch_protector_ret = "pac_ret"
44  configs = [ ":optimize-size" ]
45  sanitize = {
46    integer_overflow = true
47    ubsan = true
48    boundary_sanitize = true
49    cfi = true
50    cfi_cross_dso = true
51    debug = false
52  }
53  sources = [
54    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_download_callback_client.cpp",
55    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_download_callback_stub.cpp",
56    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_download_uri_manager.cpp",
57    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_callback_client.cpp",
58    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_callback_stub.cpp",
59    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp",
60    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_manager.cpp",
61    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_manager_impl.cpp",
62    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_service_proxy.cpp",
63    "${distributedfile_path}/utils/log/src/utils_log.cpp",
64  ]
65
66  defines = [
67    "LOG_DOMAIN=0xD004308",
68    "LOG_TAG=\"CLOUDSYNC_API\"",
69  ]
70
71  configs += [ ":private_config" ]
72  public_configs = [ ":public_config" ]
73
74  external_deps = [
75    "ability_base:zuri",
76    "ability_runtime:ability_manager",
77    "ability_runtime:dataobs_manager",
78    "c_utils:utils",
79    "hilog:libhilog",
80    "ipc:ipc_single",
81    "safwk:system_ability_fwk",
82    "samgr:samgr_proxy",
83  ]
84
85  if (cloudsync_service_media_library) {
86    external_deps += [ "media_library:media_library" ]
87    defines += [ "SUPPORT_MEDIA_LIBRARY" ]
88  }
89
90  use_exceptions = true
91  part_name = "dfs_service"
92  subsystem_name = "filemanagement"
93}
94
95ohos_shared_library("cloudsync_asset_kit_inner") {
96  branch_protector_ret = "pac_ret"
97  configs = [ ":optimize-size" ]
98  sanitize = {
99    integer_overflow = true
100    ubsan = true
101    boundary_sanitize = true
102    cfi = true
103    cfi_cross_dso = true
104    debug = false
105  }
106  sources = [
107    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_download_uri_manager.cpp",
108    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_asset_manager.cpp",
109    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_asset_manager_impl.cpp",
110    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_common.cpp",
111    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/cloud_sync_service_proxy.cpp",
112    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_client.cpp",
113    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner/src/download_asset_callback_stub.cpp",
114  ]
115
116  defines = [
117    "LOG_DOMAIN=0xD004309",
118    "LOG_TAG=\"CLOUD_ASSET_API\"",
119  ]
120
121  configs += [ ":private_config" ]
122  public_configs = [ ":public_config" ]
123
124  external_deps = [
125    "ability_base:zuri",
126    "c_utils:utils",
127    "hilog:libhilog",
128    "ipc:ipc_single",
129    "safwk:system_ability_fwk",
130    "samgr:samgr_proxy",
131  ]
132
133  deps = [ "${utils_path}:libdistributedfileutils_lite" ]
134
135  use_exceptions = true
136  innerapi_tags = [ "platformsdk" ]
137  part_name = "dfs_service"
138  subsystem_name = "filemanagement"
139}
140
141ohos_shared_library("cloudsync_kit_inner_lite") {
142  branch_protector_ret = "pac_ret"
143  configs = [ ":optimize-size" ]
144  sanitize = {
145    integer_overflow = true
146    ubsan = true
147    boundary_sanitize = true
148    cfi = true
149    cfi_cross_dso = true
150    debug = false
151    cfi_vcall_icall_only = true
152  }
153  sources = [
154    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner_lite/src/cloud_sync_manager_impl_lite.cpp",
155    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner_lite/src/cloud_sync_manager_lite.cpp",
156    "${distributedfile_path}/frameworks/native/cloudsync_kit_inner_lite/src/cloud_sync_service_proxy_lite.cpp",
157  ]
158
159  defines = [
160    "LOG_DOMAIN=0xD004308",
161    "LOG_TAG=\"CloudFileDaemon\"",
162  ]
163
164  configs += [ ":private_config" ]
165  public_configs = [ ":public_config" ]
166
167  external_deps = [
168    "c_utils:utils",
169    "hilog:libhilog",
170    "ipc:ipc_single",
171    "safwk:system_ability_fwk",
172    "samgr:samgr_proxy",
173  ]
174
175  deps = [ "${utils_path}:libdistributedfileutils_lite" ]
176
177  use_exceptions = true
178  innerapi_tags = [ "platformsdk" ]
179  part_name = "dfs_service"
180  subsystem_name = "filemanagement"
181}
182