blob: d9ff19051de9fbe70ef6de239b3d53e3dac73490 [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"],
Yurii Zubrytskyi93ff40f2024-11-27 14:13:35 -0800168 require_root: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200169 srcs: [
170 "tests/BinaryStreamVisitorTests.cpp",
171 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800172 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200173 "tests/FileUtilsTests.cpp",
174 "tests/Idmap2BinaryTests.cpp",
175 "tests/IdmapTests.cpp",
176 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800177 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200178 "tests/PrettyPrintVisitorTests.cpp",
179 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700180 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200181 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100182 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700183 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200184 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800185 required: [
186 "idmap2",
187 ],
188 static_libs: [
189 "libgmock",
190 "libidmap2_protos",
Jeremy Meyerdeb46f312023-11-08 12:20:24 -0800191 "libpng",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800192 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200193 target: {
194 android: {
195 shared_libs: [
196 "libandroidfw",
197 "libbase",
198 "libidmap2",
199 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800200 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200201 "libutils",
202 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800203 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200204 "libziparchive",
205 ],
Devin Moore39fe2cc2023-05-22 22:58:30 +0000206 static_libs: [
207 "libidmap2_policies",
208 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200209 },
210 host: {
211 static_libs: [
212 "libandroidfw",
213 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700214 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200215 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800216 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200217 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800218 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200219 "libutils",
220 "libziparchive",
221 ],
222 shared_libs: [
223 "libz",
224 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800225 data: [
226 ":libz",
227 ":idmap2",
228 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200229 },
230 },
Julien Desprez91e03302021-02-08 16:46:08 -0800231 data: [
232 "tests/data/**/*.apk",
Jeremy Meyera761f332022-10-21 17:42:14 +0000233 "tests/data/**/*.png",
Julien Desprez91e03302021-02-08 16:46:08 -0800234 ],
235 compile_multilib: "first",
236 test_options: {
237 unit_test: true,
238 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200239}
240
241cc_binary {
242 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100243 defaults: [
244 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200245 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100246 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200247 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700248 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200249 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800250 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200251 "idmap2/Dump.cpp",
252 "idmap2/Lookup.cpp",
253 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200254 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800255 static_libs: [
256 "libidmap2_protos",
257 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200258 target: {
259 android: {
260 shared_libs: [
261 "libandroidfw",
262 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100263 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200264 "libidmap2",
Jeremy Meyerdeb46f312023-11-08 12:20:24 -0800265 "libpng",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800266 "libprotobuf-cpp-lite",
267 "libutils",
268 "libz",
269 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200270 ],
Devin Moore39fe2cc2023-05-22 22:58:30 +0000271 static_libs: [
272 "libidmap2_policies",
273 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200274 },
275 host: {
276 static_libs: [
277 "libandroidfw",
278 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700279 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200280 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800281 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200282 "liblog",
Jeremy Meyerdeb46f312023-11-08 12:20:24 -0800283 "libpng",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800284 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200285 "libutils",
286 "libziparchive",
287 ],
288 shared_libs: [
289 "libz",
290 ],
291 },
292 },
Winson62ac8b52019-12-04 08:36:48 -0800293
Mårten Kongstad02751232018-04-27 13:16:32 +0200294}
295
296cc_binary {
297 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100298 defaults: [
299 "idmap2_defaults",
300 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200301 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200302 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200303 "idmap2d/Idmap2Service.cpp",
304 "idmap2d/Main.cpp",
305 ],
306 shared_libs: [
307 "libandroidfw",
308 "libbase",
309 "libbinder",
310 "libcutils",
311 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800312 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200313 "libutils",
314 "libziparchive",
315 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100316 static_libs: [
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}