blob: 6e51f009f76ce26e6a11de53b41a60e6c6d42c97 [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",
Jeremy Meyerdeb46f312023-11-08 12:20:24 -080089 "libpng",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080090 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020091 shared_libs: [
92 "libandroidfw",
93 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010094 "libcutils",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080095 "libprotobuf-cpp-lite",
96 "libutils",
97 "libz",
98 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020099 ],
100 },
101 host: {
102 shared: {
103 enabled: false,
104 },
105 static_libs: [
106 "libandroidfw",
107 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700108 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -0800109 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800110 "libidmap2_protos",
Jeremy Meyerdeb46f312023-11-08 12:20:24 -0800111 "libpng",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800112 "libprotobuf-cpp-lite",
113 "libutils",
114 "libz",
115 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800116 ],
117 },
118 },
119}
120
121cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800122 name: "libidmap2_protos",
123 srcs: [
124 "libidmap2/proto/*.proto",
125 ],
126 host_supported: true,
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -0800127 tidy: false,
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800128 proto: {
129 type: "lite",
130 export_proto_headers: true,
131 },
132}
133
Devin Moore39fe2cc2023-05-22 22:58:30 +0000134cc_library_static {
Winson62ac8b52019-12-04 08:36:48 -0800135 name: "libidmap2_policies",
136 defaults: [
137 "idmap2_defaults",
138 ],
139 host_supported: true,
140 export_include_dirs: ["libidmap2_policies/include"],
141 target: {
142 windows: {
143 enabled: true,
144 },
145 android: {
Winson62ac8b52019-12-04 08:36:48 -0800146 shared_libs: [
147 "libandroidfw",
148 ],
149 },
150 host: {
Winson62ac8b52019-12-04 08:36:48 -0800151 static_libs: [
152 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200153 ],
154 },
155 },
156}
157
158cc_test {
159 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100160 defaults: [
161 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200162 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100163 tidy_checks: [
164 "-readability-magic-numbers",
165 ],
166 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700167 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200168 srcs: [
169 "tests/BinaryStreamVisitorTests.cpp",
170 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800171 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200172 "tests/FileUtilsTests.cpp",
173 "tests/Idmap2BinaryTests.cpp",
174 "tests/IdmapTests.cpp",
175 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800176 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200177 "tests/PrettyPrintVisitorTests.cpp",
178 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700179 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200180 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100181 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700182 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200183 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800184 required: [
185 "idmap2",
186 ],
187 static_libs: [
188 "libgmock",
189 "libidmap2_protos",
Jeremy Meyerdeb46f312023-11-08 12:20:24 -0800190 "libpng",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800191 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200192 target: {
193 android: {
194 shared_libs: [
195 "libandroidfw",
196 "libbase",
197 "libidmap2",
198 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800199 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200200 "libutils",
201 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800202 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200203 "libziparchive",
204 ],
Devin Moore39fe2cc2023-05-22 22:58:30 +0000205 static_libs: [
206 "libidmap2_policies",
207 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200208 },
209 host: {
210 static_libs: [
211 "libandroidfw",
212 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700213 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200214 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800215 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200216 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800217 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200218 "libutils",
219 "libziparchive",
220 ],
221 shared_libs: [
222 "libz",
223 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800224 data: [
225 ":libz",
226 ":idmap2",
227 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200228 },
229 },
Julien Desprez91e03302021-02-08 16:46:08 -0800230 data: [
231 "tests/data/**/*.apk",
Jeremy Meyera761f332022-10-21 17:42:14 +0000232 "tests/data/**/*.png",
Julien Desprez91e03302021-02-08 16:46:08 -0800233 ],
234 compile_multilib: "first",
235 test_options: {
236 unit_test: true,
237 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200238}
239
240cc_binary {
241 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100242 defaults: [
243 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200244 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100245 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200246 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700247 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200248 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800249 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200250 "idmap2/Dump.cpp",
251 "idmap2/Lookup.cpp",
252 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200253 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800254 static_libs: [
255 "libidmap2_protos",
256 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200257 target: {
258 android: {
259 shared_libs: [
260 "libandroidfw",
261 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100262 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200263 "libidmap2",
Jeremy Meyerdeb46f312023-11-08 12:20:24 -0800264 "libpng",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800265 "libprotobuf-cpp-lite",
266 "libutils",
267 "libz",
268 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200269 ],
Devin Moore39fe2cc2023-05-22 22:58:30 +0000270 static_libs: [
271 "libidmap2_policies",
272 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200273 },
274 host: {
275 static_libs: [
276 "libandroidfw",
277 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700278 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200279 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800280 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200281 "liblog",
Jeremy Meyerdeb46f312023-11-08 12:20:24 -0800282 "libpng",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800283 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200284 "libutils",
285 "libziparchive",
286 ],
287 shared_libs: [
288 "libz",
289 ],
290 },
291 },
Winson62ac8b52019-12-04 08:36:48 -0800292
Mårten Kongstad02751232018-04-27 13:16:32 +0200293}
294
295cc_binary {
296 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100297 defaults: [
298 "idmap2_defaults",
299 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200300 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200301 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200302 "idmap2d/Idmap2Service.cpp",
303 "idmap2d/Main.cpp",
304 ],
305 shared_libs: [
306 "libandroidfw",
307 "libbase",
308 "libbinder",
309 "libcutils",
310 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800311 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200312 "libutils",
313 "libziparchive",
314 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100315 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800316 "libc++fs",
Devin Moore39fe2cc2023-05-22 22:58:30 +0000317 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800318 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100319 "libidmap2daidl",
320 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200321 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200322}
323
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100324cc_library_static {
325 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100326 srcs: [
327 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800328 ":idmap2_core_aidl",
329 ],
330 header_libs: [
331 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100332 ],
333 shared_libs: [
334 "libbase",
335 ],
336 aidl: {
337 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800338 local_include_dirs: [
339 "idmap2d/aidl/core",
340 "idmap2d/aidl/services/",
341 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100342 },
343}
344
Mårten Kongstad02751232018-04-27 13:16:32 +0200345filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800346 name: "idmap2_core_aidl",
347 srcs: [
348 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
349 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
350 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
351 ],
352 path: "idmap2d/aidl/core/",
353}
354
355filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200356 name: "idmap2_aidl",
357 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800358 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200359 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800360 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200361}
Winson62ac8b52019-12-04 08:36:48 -0800362
363aidl_interface {
364 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900365 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800366 srcs: [":overlayable_policy_aidl_files"],
367}
368
369filegroup {
370 name: "overlayable_policy_aidl_files",
371 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800372 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800373 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800374 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800375}