• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2025 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("../../access_token.gni")
16
17config("accesstoken_common_cxx_public_config") {
18  visibility = [ ":*" ]
19  include_dirs = [ "include" ]
20}
21
22action("permission_definition_check") {
23  script = "permission_check.py"
24  args = [
25    "--source-root-dir",
26    rebase_path("//", root_build_dir),
27    "--input-full-permissions",
28    rebase_path("${access_token_path}") +
29        "/services/accesstokenmanager/permission_definitions.json",
30  ]
31  inputs = [ rebase_path("${access_token_path}") +
32             "/services/accesstokenmanager/permission_definitions.json" ]
33  outputs = [ "$target_out_dir/permission_definition_check.stamp" ]
34}
35
36action("permission_definition_parse") {
37  script = "permission_definition_parser.py"
38  inputs = [ rebase_path("${access_token_path}") +
39             "/services/accesstokenmanager/permission_definitions.json" ]
40  args = [
41    "--input-json",
42    rebase_path("${access_token_path}") +
43        "/services/accesstokenmanager/permission_definitions.json",
44    "--output-path",
45    rebase_path(target_out_dir) + "/permission_map_constant.h",
46    "--target-platform",
47    target_platform,
48  ]
49  outputs = [ "$target_out_dir" + "/permission_map_constant.h" ]
50  if (!ohos_indep_compiler_enable) {
51    deps = [ ":permission_definition_check" ]
52  }
53}
54
55ohos_static_library("accesstoken_hisysevent") {
56  subsystem_name = "security"
57  part_name = "access_token"
58  sanitize = {
59    cfi = true
60    cfi_cross_dso = true
61    debug = false
62  }
63  branch_protector_ret = "pac_ret"
64
65  public_configs = [ ":accesstoken_common_cxx_public_config" ]
66
67  include_dirs =
68      [ "${access_token_path}/interfaces/innerkits/accesstoken/include" ]
69
70  sources = [ "src/hisysevent_adapter.cpp" ]
71
72  external_deps = [
73    "hilog:libhilog",
74    "hisysevent:libhisysevent",
75  ]
76
77  configs = [
78    "${access_token_path}/config:access_token_compile_flags",
79    "${access_token_path}/config:coverage_flags",
80  ]
81
82  cflags_cc = [ "-DHILOG_ENABLE" ]
83}
84
85ohos_static_library("accesstoken_static_log") {
86  subsystem_name = "security"
87  part_name = "access_token"
88  sanitize = {
89    cfi = true
90    cfi_cross_dso = true
91    debug = false
92  }
93  branch_protector_ret = "pac_ret"
94
95  public_configs = [ ":accesstoken_common_cxx_public_config" ]
96
97  include_dirs = [ "include" ]
98
99  sources = [ "src/accesstoken_common_log.cpp" ]
100
101  external_deps = [
102    "c_utils:utils",
103    "hilog:libhilog",
104  ]
105
106  configs = [
107    "${access_token_path}/config:access_token_compile_flags",
108    "${access_token_path}/config:coverage_flags",
109  ]
110
111  cflags_cc = [ "-DHILOG_ENABLE" ]
112}
113
114ohos_static_library("accesstoken_static_log_for_nativetoken") {
115  subsystem_name = "security"
116  part_name = "access_token"
117  sanitize = {
118    cfi = true
119    cfi_cross_dso = true
120    debug = false
121  }
122  branch_protector_ret = "pac_ret"
123
124  public_configs = [ ":accesstoken_common_cxx_public_config" ]
125
126  include_dirs = [
127    "include",
128    "${access_token_path}/interfaces/innerkits/nativetoken/include",
129  ]
130  cflags_cc = [ "-DUSE_NATIVE_TOKEN_KLOG" ]
131
132  sources = [
133    "src/accesstoken_common_log.cpp",
134    "src/accesstoken_klog.cpp",
135  ]
136
137  external_deps = [ "c_utils:utils" ]
138
139  configs = [
140    "${access_token_path}/config:access_token_compile_flags",
141    "${access_token_path}/config:coverage_flags",
142  ]
143}
144
145ohos_shared_library("accesstoken_common_cxx") {
146  subsystem_name = "security"
147  innerapi_tags = [
148    "platformsdk_indirect",
149    "chipsetsdk_indirect",
150  ]
151  part_name = "access_token"
152  sanitize = {
153    cfi = true
154    cfi_cross_dso = true
155    debug = false
156  }
157  branch_protector_ret = "pac_ret"
158
159  public_configs = [ ":accesstoken_common_cxx_public_config" ]
160
161  include_dirs = [
162    "${access_token_path}/interfaces/innerkits/accesstoken/include",
163    "${access_token_path}/interfaces/innerkits/privacy/include",
164    "include",
165    rebase_path(target_out_dir),
166  ]
167
168  sources = [
169    "src/constant_common.cpp",
170    "src/data_validator.cpp",
171    "src/permission_map.cpp",
172    "src/permission_validator.cpp",
173    "src/time_util.cpp",
174    "src/tokenid_attributes.cpp",
175  ]
176
177  deps = [
178    ":accesstoken_static_log",
179    ":permission_definition_parse",
180  ]
181
182  external_deps = [
183    "c_utils:utils",
184    "hilog:libhilog",
185    "init:libbegetutil",
186  ]
187
188  configs = [
189    "${access_token_path}/config:access_token_compile_flags",
190    "${access_token_path}/config:coverage_flags",
191  ]
192
193  cflags_cc = [ "-DHILOG_ENABLE" ]
194}
195