1fc223305Sopenharmony_ci# Copyright (c) 2024 Huawei Device Co., Ltd.
2fc223305Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3fc223305Sopenharmony_ci# you may not use this file except in compliance with the License.
4fc223305Sopenharmony_ci# You may obtain a copy of the License at
5fc223305Sopenharmony_ci#
6fc223305Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0
7fc223305Sopenharmony_ci#
8fc223305Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9fc223305Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10fc223305Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11fc223305Sopenharmony_ci# See the License for the specific language governing permissions and
12fc223305Sopenharmony_ci# limitations under the License.
13fc223305Sopenharmony_ciimport("//build/ohos.gni")
14fc223305Sopenharmony_ciimport("//foundation/distributeddatamgr/preferences/preferences.gni")
15fc223305Sopenharmony_ci
16fc223305Sopenharmony_ciconfig("common_public_config") {
17fc223305Sopenharmony_ci  visibility = [ ":*" ]
18fc223305Sopenharmony_ci  include_dirs = [ "include" ]
19fc223305Sopenharmony_ci}
20fc223305Sopenharmony_ci
21fc223305Sopenharmony_ciconfig("common_config") {
22fc223305Sopenharmony_ci  visibility = [ ":*" ]
23fc223305Sopenharmony_ci  include_dirs = [
24fc223305Sopenharmony_ci    "include",
25fc223305Sopenharmony_ci    "${preferences_base_path}/frameworks/common/include",
26fc223305Sopenharmony_ci  ]
27fc223305Sopenharmony_ci}
28fc223305Sopenharmony_ci
29fc223305Sopenharmony_ciif (is_ohos) {
30fc223305Sopenharmony_ci  ohos_shared_library("preferences_jscommon") {
31fc223305Sopenharmony_ci    branch_protector_ret = "pac_ret"
32fc223305Sopenharmony_ci    sanitize = {
33fc223305Sopenharmony_ci      boundary_sanitize = true
34fc223305Sopenharmony_ci      ubsan = true
35fc223305Sopenharmony_ci      cfi = true
36fc223305Sopenharmony_ci      cfi_cross_dso = true
37fc223305Sopenharmony_ci      debug = false
38fc223305Sopenharmony_ci    }
39fc223305Sopenharmony_ci
40fc223305Sopenharmony_ci    cflags_cc = [
41fc223305Sopenharmony_ci      "-std=c++17",
42fc223305Sopenharmony_ci      "-stdlib=libc++",
43fc223305Sopenharmony_ci    ]
44fc223305Sopenharmony_ci
45fc223305Sopenharmony_ci    sources = [
46fc223305Sopenharmony_ci      "${preferences_napi_path}/common/src/js_ability.cpp",
47fc223305Sopenharmony_ci      "${preferences_napi_path}/common/src/js_common_utils.cpp",
48fc223305Sopenharmony_ci      "${preferences_napi_path}/common/src/js_observer.cpp",
49fc223305Sopenharmony_ci      "${preferences_napi_path}/common/src/js_sendable_utils.cpp",
50fc223305Sopenharmony_ci      "${preferences_napi_path}/common/src/napi_async_call.cpp",
51fc223305Sopenharmony_ci      "${preferences_napi_path}/common/src/napi_preferences_error.cpp",
52fc223305Sopenharmony_ci      "${preferences_napi_path}/common/src/napi_preferences_observer.cpp",
53fc223305Sopenharmony_ci      "${preferences_napi_path}/common/src/uv_queue.cpp",
54fc223305Sopenharmony_ci    ]
55fc223305Sopenharmony_ci    configs = [ ":common_config" ]
56fc223305Sopenharmony_ci    public_configs = [ ":common_public_config" ]
57fc223305Sopenharmony_ci    deps =
58fc223305Sopenharmony_ci        [ "${preferences_base_path}/interfaces/inner_api:native_preferences" ]
59fc223305Sopenharmony_ci    version_script = "libcommon.map"
60fc223305Sopenharmony_ci    external_deps = [
61fc223305Sopenharmony_ci      "ability_runtime:abilitykit_native",
62fc223305Sopenharmony_ci      "ability_runtime:napi_base_context",
63fc223305Sopenharmony_ci      "bounds_checking_function:libsec_shared",
64fc223305Sopenharmony_ci      "hilog:libhilog",
65fc223305Sopenharmony_ci      "napi:ace_napi",
66fc223305Sopenharmony_ci    ]
67fc223305Sopenharmony_ci
68fc223305Sopenharmony_ci    subsystem_name = "distributeddatamgr"
69fc223305Sopenharmony_ci    part_name = "preferences"
70fc223305Sopenharmony_ci  }
71fc223305Sopenharmony_ci}
72