blob: 55ec7dae16b1cf48172823e8fb6bf591463b142e [file] [log] [blame]
Mårten Kongstad02751232018-04-27 13:16:32 +02001// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Bob Badour8a6a2bc2021-02-12 17:07:05 -080015package {
16 // See: http://go/android-license-faq
17 // A large-scale-change added 'default_applicable_licenses' to import
18 // all of the 'license_kinds' from "frameworks_base_license"
19 // to get the below license kinds:
20 // SPDX-license-identifier-Apache-2.0
21 default_applicable_licenses: ["frameworks_base_license"],
22}
23
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010024cc_defaults {
25 name: "idmap2_defaults",
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -080026 cpp_std: "gnu++2b",
Mårten Kongstad02751232018-04-27 13:16:32 +020027 tidy: true,
Stephen Hines328a29c2020-06-09 00:14:52 -070028 tidy_checks: [
29 "modernize-*",
30 "-modernize-avoid-c-arrays",
Yurii Zubrytskyi70ded192023-05-01 21:58:51 -070031 "-modernize-use-nodiscard",
Stephen Hines328a29c2020-06-09 00:14:52 -070032 "-modernize-use-trailing-return-type",
33 "android-*",
34 "misc-*",
Yurii Zubrytskyi70ded192023-05-01 21:58:51 -070035 "-misc-const-correctness",
Stephen Hines328a29c2020-06-09 00:14:52 -070036 "readability-*",
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -080037 "-readability-identifier-length",
Yurii Zubrytskyi70ded192023-05-01 21:58:51 -070038 "-readability-implicit-bool-conversion",
Stephen Hines328a29c2020-06-09 00:14:52 -070039 ],
Stephen Hinesab170652020-06-09 00:13:57 -070040 tidy_checks_as_errors: [
Ryan Mitchell19823452019-01-29 12:01:24 -080041 "modernize-*",
42 "-modernize-avoid-c-arrays",
Yabin Cui5fa57f62021-07-14 17:25:16 -070043 "-modernize-concat-nested-namespaces",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080044 "-modernize-pass-by-value",
45 "-modernize-replace-disallow-copy-and-assign-macro",
Yabin Cui5fa57f62021-07-14 17:25:16 -070046 "-modernize-return-braced-init-list",
Yi Kongb0981d92022-02-18 01:52:21 +080047 "-modernize-use-default-member-init",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080048 "-modernize-use-equals-default",
Chih-Hung Hsieha602a8b2022-09-19 15:13:36 -070049 "-modernize-use-emplace",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080050 "-modernize-use-nodiscard",
51 "-modernize-use-override",
Yi Kongfbafa512019-07-27 14:43:50 -070052 "-modernize-use-trailing-return-type",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080053 "-modernize-use-using",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010054 "android-*",
55 "misc-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080056 "-misc-non-private-member-variables-in-classes",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010057 "readability-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080058 "-readability-braces-around-statements",
59 "-readability-const-return-type",
60 "-readability-convert-member-functions-to-static",
Pirama Arumuga Nainar8186f292022-03-10 04:56:33 +000061 "-readability-duplicate-include",
Yurii Zubrytskyi70ded192023-05-01 21:58:51 -070062 "-readability-implicit-bool-conversion",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080063 "-readability-else-after-return",
64 "-readability-named-parameter",
65 "-readability-redundant-access-specifiers",
66 "-readability-uppercase-literal-suffix",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010067 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010068}
69
70cc_library {
71 name: "libidmap2",
72 defaults: [
73 "idmap2_defaults",
74 ],
75 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +020076 srcs: [
Winson62ac8b52019-12-04 08:36:48 -080077 "libidmap2/**/*.cpp",
felkachang1039d612022-06-21 15:09:47 +080078 "self_targeting/*.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +020079 ],
80 export_include_dirs: ["include"],
81 target: {
82 android: {
83 static: {
84 enabled: false,
85 },
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080086 static_libs: [
Devin Moore39fe2cc2023-05-22 22:58:30 +000087 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080088 "libidmap2_protos",
89 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020090 shared_libs: [
91 "libandroidfw",
92 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010093 "libcutils",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080094 "libprotobuf-cpp-lite",
95 "libutils",
96 "libz",
97 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020098 ],
99 },
100 host: {
101 shared: {
102 enabled: false,
103 },
104 static_libs: [
105 "libandroidfw",
106 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700107 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -0800108 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800109 "libidmap2_protos",
110 "libprotobuf-cpp-lite",
111 "libutils",
112 "libz",
113 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800114 ],
115 },
116 },
117}
118
119cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800120 name: "libidmap2_protos",
121 srcs: [
122 "libidmap2/proto/*.proto",
123 ],
124 host_supported: true,
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -0800125 tidy: false,
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800126 proto: {
127 type: "lite",
128 export_proto_headers: true,
129 },
130}
131
Devin Moore39fe2cc2023-05-22 22:58:30 +0000132cc_library_static {
Winson62ac8b52019-12-04 08:36:48 -0800133 name: "libidmap2_policies",
134 defaults: [
135 "idmap2_defaults",
136 ],
137 host_supported: true,
138 export_include_dirs: ["libidmap2_policies/include"],
139 target: {
140 windows: {
141 enabled: true,
142 },
143 android: {
Winson62ac8b52019-12-04 08:36:48 -0800144 shared_libs: [
145 "libandroidfw",
146 ],
147 },
148 host: {
Winson62ac8b52019-12-04 08:36:48 -0800149 static_libs: [
150 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200151 ],
152 },
153 },
154}
155
156cc_test {
157 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100158 defaults: [
159 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200160 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100161 tidy_checks: [
162 "-readability-magic-numbers",
163 ],
164 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700165 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200166 srcs: [
167 "tests/BinaryStreamVisitorTests.cpp",
168 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800169 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200170 "tests/FileUtilsTests.cpp",
171 "tests/Idmap2BinaryTests.cpp",
172 "tests/IdmapTests.cpp",
173 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800174 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200175 "tests/PrettyPrintVisitorTests.cpp",
176 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700177 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200178 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100179 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700180 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200181 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800182 required: [
183 "idmap2",
184 ],
185 static_libs: [
186 "libgmock",
187 "libidmap2_protos",
188 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200189 target: {
190 android: {
191 shared_libs: [
192 "libandroidfw",
193 "libbase",
194 "libidmap2",
195 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800196 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200197 "libutils",
198 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800199 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200200 "libziparchive",
201 ],
Devin Moore39fe2cc2023-05-22 22:58:30 +0000202 static_libs: [
203 "libidmap2_policies",
204 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200205 },
206 host: {
207 static_libs: [
208 "libandroidfw",
209 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700210 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200211 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800212 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200213 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800214 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200215 "libutils",
216 "libziparchive",
217 ],
218 shared_libs: [
219 "libz",
220 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800221 data: [
222 ":libz",
223 ":idmap2",
224 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200225 },
226 },
Julien Desprez91e03302021-02-08 16:46:08 -0800227 data: [
228 "tests/data/**/*.apk",
Jeremy Meyera761f332022-10-21 17:42:14 +0000229 "tests/data/**/*.png",
Julien Desprez91e03302021-02-08 16:46:08 -0800230 ],
231 compile_multilib: "first",
232 test_options: {
233 unit_test: true,
234 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200235}
236
237cc_binary {
238 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100239 defaults: [
240 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200241 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100242 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200243 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700244 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200245 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800246 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200247 "idmap2/Dump.cpp",
248 "idmap2/Lookup.cpp",
249 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200250 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800251 static_libs: [
252 "libidmap2_protos",
253 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200254 target: {
255 android: {
256 shared_libs: [
257 "libandroidfw",
258 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100259 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200260 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800261 "libprotobuf-cpp-lite",
262 "libutils",
263 "libz",
264 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200265 ],
Devin Moore39fe2cc2023-05-22 22:58:30 +0000266 static_libs: [
267 "libidmap2_policies",
268 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200269 },
270 host: {
271 static_libs: [
272 "libandroidfw",
273 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700274 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200275 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800276 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200277 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800278 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200279 "libutils",
280 "libziparchive",
281 ],
282 shared_libs: [
283 "libz",
284 ],
285 },
286 },
Winson62ac8b52019-12-04 08:36:48 -0800287
Mårten Kongstad02751232018-04-27 13:16:32 +0200288}
289
290cc_binary {
291 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100292 defaults: [
293 "idmap2_defaults",
294 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200295 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200296 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200297 "idmap2d/Idmap2Service.cpp",
298 "idmap2d/Main.cpp",
299 ],
300 shared_libs: [
301 "libandroidfw",
302 "libbase",
303 "libbinder",
304 "libcutils",
305 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800306 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200307 "libutils",
308 "libziparchive",
309 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100310 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800311 "libc++fs",
Devin Moore39fe2cc2023-05-22 22:58:30 +0000312 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800313 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100314 "libidmap2daidl",
315 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200316 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200317}
318
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100319cc_library_static {
320 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100321 srcs: [
322 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800323 ":idmap2_core_aidl",
324 ],
325 header_libs: [
326 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100327 ],
328 shared_libs: [
329 "libbase",
330 ],
331 aidl: {
332 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800333 local_include_dirs: [
334 "idmap2d/aidl/core",
335 "idmap2d/aidl/services/",
336 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100337 },
338}
339
Mårten Kongstad02751232018-04-27 13:16:32 +0200340filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800341 name: "idmap2_core_aidl",
342 srcs: [
343 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
344 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
345 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
346 ],
347 path: "idmap2d/aidl/core/",
348}
349
350filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200351 name: "idmap2_aidl",
352 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800353 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200354 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800355 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200356}
Winson62ac8b52019-12-04 08:36:48 -0800357
358aidl_interface {
359 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900360 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800361 srcs: [":overlayable_policy_aidl_files"],
362}
363
364filegroup {
365 name: "overlayable_policy_aidl_files",
366 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800367 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800368 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800369 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800370}