1cf69771bSopenharmony_ci# Copyright (C) 2024 Huawei Device Co., Ltd.
2cf69771bSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3cf69771bSopenharmony_ci# you may not use this file except in compliance with the License.
4cf69771bSopenharmony_ci# You may obtain a copy of the License at
5cf69771bSopenharmony_ci#
6cf69771bSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7cf69771bSopenharmony_ci#
8cf69771bSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9cf69771bSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10cf69771bSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11cf69771bSopenharmony_ci# See the License for the specific language governing permissions and
12cf69771bSopenharmony_ci# limitations under the License.
13cf69771bSopenharmony_ci
14cf69771bSopenharmony_ciimport("../../time.gni")
15cf69771bSopenharmony_ci
16cf69771bSopenharmony_ciohos_shared_library("cj_system_date_time_ffi") {
17cf69771bSopenharmony_ci  defines = []
18cf69771bSopenharmony_ci  include_dirs = [
19cf69771bSopenharmony_ci    "include/",
20cf69771bSopenharmony_ci    "../../interfaces/inner_api/include",
21cf69771bSopenharmony_ci    "../../utils/native/include",
22cf69771bSopenharmony_ci  ]
23cf69771bSopenharmony_ci
24cf69771bSopenharmony_ci  if (!build_ohos_sdk) {
25cf69771bSopenharmony_ci    sources = [
26cf69771bSopenharmony_ci      "src/system_date_time.cpp",
27cf69771bSopenharmony_ci      "src/system_date_time_ffi.cpp",
28cf69771bSopenharmony_ci    ]
29cf69771bSopenharmony_ci    deps = [ "${api_path}:time_client" ]
30cf69771bSopenharmony_ci    external_deps = [
31cf69771bSopenharmony_ci      "ability_runtime:abilitykit_native",
32cf69771bSopenharmony_ci      "ability_runtime:wantagent_innerkits",
33cf69771bSopenharmony_ci      "c_utils:utils",
34cf69771bSopenharmony_ci      "hilog:libhilog",
35cf69771bSopenharmony_ci      "init:libbegetutil",
36cf69771bSopenharmony_ci      "napi:cj_bind_ffi",
37cf69771bSopenharmony_ci    ]
38cf69771bSopenharmony_ci  } else {
39cf69771bSopenharmony_ci    defines += [ "PREVIEWER" ]
40cf69771bSopenharmony_ci    sources = [ "src/system_date_mock.cpp" ]
41cf69771bSopenharmony_ci    external_deps = [ "napi:cj_bind_ffi" ]
42cf69771bSopenharmony_ci  }
43cf69771bSopenharmony_ci
44cf69771bSopenharmony_ci  branch_protector_ret = "pac_ret"
45cf69771bSopenharmony_ci  sanitize = {
46cf69771bSopenharmony_ci    integer_overflow = true
47cf69771bSopenharmony_ci    ubsan = true
48cf69771bSopenharmony_ci    boundary_sanitize = true
49cf69771bSopenharmony_ci    cfi = true
50cf69771bSopenharmony_ci    cfi_cross_dso = true
51cf69771bSopenharmony_ci    debug = time_sanitize_debug
52cf69771bSopenharmony_ci  }
53cf69771bSopenharmony_ci  innerapi_tags = [ "platformsdk" ]
54cf69771bSopenharmony_ci  subsystem_name = "time"
55cf69771bSopenharmony_ci  part_name = "time_service"
56cf69771bSopenharmony_ci}
57