blob: de60581564b1c61a226c8ca0cfcc33d4211d8a66 [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",
31 "-modernize-use-trailing-return-type",
32 "android-*",
33 "misc-*",
34 "readability-*",
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -080035 "-readability-identifier-length",
Stephen Hines328a29c2020-06-09 00:14:52 -070036 ],
Stephen Hinesab170652020-06-09 00:13:57 -070037 tidy_checks_as_errors: [
Ryan Mitchell19823452019-01-29 12:01:24 -080038 "modernize-*",
39 "-modernize-avoid-c-arrays",
Yabin Cui5fa57f62021-07-14 17:25:16 -070040 "-modernize-concat-nested-namespaces",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080041 "-modernize-pass-by-value",
42 "-modernize-replace-disallow-copy-and-assign-macro",
Yabin Cui5fa57f62021-07-14 17:25:16 -070043 "-modernize-return-braced-init-list",
Yi Kongb0981d92022-02-18 01:52:21 +080044 "-modernize-use-default-member-init",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080045 "-modernize-use-equals-default",
Chih-Hung Hsieha602a8b2022-09-19 15:13:36 -070046 "-modernize-use-emplace",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080047 "-modernize-use-nodiscard",
48 "-modernize-use-override",
Yi Kongfbafa512019-07-27 14:43:50 -070049 "-modernize-use-trailing-return-type",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080050 "-modernize-use-using",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010051 "android-*",
52 "misc-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080053 "-misc-non-private-member-variables-in-classes",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010054 "readability-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080055 "-readability-braces-around-statements",
56 "-readability-const-return-type",
57 "-readability-convert-member-functions-to-static",
Pirama Arumuga Nainar8186f292022-03-10 04:56:33 +000058 "-readability-duplicate-include",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080059 "-readability-else-after-return",
60 "-readability-named-parameter",
61 "-readability-redundant-access-specifiers",
62 "-readability-uppercase-literal-suffix",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010063 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010064}
65
66cc_library {
67 name: "libidmap2",
68 defaults: [
69 "idmap2_defaults",
70 ],
71 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +020072 srcs: [
Winson62ac8b52019-12-04 08:36:48 -080073 "libidmap2/**/*.cpp",
felkachang1039d612022-06-21 15:09:47 +080074 "self_targeting/*.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +020075 ],
76 export_include_dirs: ["include"],
77 target: {
78 android: {
79 static: {
80 enabled: false,
81 },
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080082 static_libs: [
Devin Moore39fe2cc2023-05-22 22:58:30 +000083 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080084 "libidmap2_protos",
85 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020086 shared_libs: [
87 "libandroidfw",
88 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010089 "libcutils",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080090 "libprotobuf-cpp-lite",
91 "libutils",
92 "libz",
93 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020094 ],
95 },
96 host: {
97 shared: {
98 enabled: false,
99 },
100 static_libs: [
101 "libandroidfw",
102 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700103 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -0800104 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800105 "libidmap2_protos",
106 "libprotobuf-cpp-lite",
107 "libutils",
108 "libz",
109 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800110 ],
111 },
112 },
113}
114
115cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800116 name: "libidmap2_protos",
117 srcs: [
118 "libidmap2/proto/*.proto",
119 ],
120 host_supported: true,
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -0800121 tidy: false,
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800122 proto: {
123 type: "lite",
124 export_proto_headers: true,
125 },
126}
127
Devin Moore39fe2cc2023-05-22 22:58:30 +0000128cc_library_static {
Winson62ac8b52019-12-04 08:36:48 -0800129 name: "libidmap2_policies",
130 defaults: [
131 "idmap2_defaults",
132 ],
133 host_supported: true,
134 export_include_dirs: ["libidmap2_policies/include"],
135 target: {
136 windows: {
137 enabled: true,
138 },
139 android: {
Winson62ac8b52019-12-04 08:36:48 -0800140 shared_libs: [
141 "libandroidfw",
142 ],
143 },
144 host: {
Winson62ac8b52019-12-04 08:36:48 -0800145 static_libs: [
146 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200147 ],
148 },
149 },
150}
151
152cc_test {
153 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100154 defaults: [
155 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200156 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100157 tidy_checks: [
158 "-readability-magic-numbers",
159 ],
160 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700161 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200162 srcs: [
163 "tests/BinaryStreamVisitorTests.cpp",
164 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800165 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200166 "tests/FileUtilsTests.cpp",
167 "tests/Idmap2BinaryTests.cpp",
168 "tests/IdmapTests.cpp",
169 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800170 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200171 "tests/PrettyPrintVisitorTests.cpp",
172 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700173 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200174 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100175 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700176 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200177 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800178 required: [
179 "idmap2",
180 ],
181 static_libs: [
182 "libgmock",
183 "libidmap2_protos",
184 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200185 target: {
186 android: {
187 shared_libs: [
188 "libandroidfw",
189 "libbase",
190 "libidmap2",
191 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800192 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200193 "libutils",
194 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800195 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200196 "libziparchive",
197 ],
Devin Moore39fe2cc2023-05-22 22:58:30 +0000198 static_libs: [
199 "libidmap2_policies",
200 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200201 },
202 host: {
203 static_libs: [
204 "libandroidfw",
205 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700206 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200207 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800208 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200209 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800210 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200211 "libutils",
212 "libziparchive",
213 ],
214 shared_libs: [
215 "libz",
216 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800217 data: [
218 ":libz",
219 ":idmap2",
220 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200221 },
222 },
Julien Desprez91e03302021-02-08 16:46:08 -0800223 data: [
224 "tests/data/**/*.apk",
Jeremy Meyera761f332022-10-21 17:42:14 +0000225 "tests/data/**/*.png",
Julien Desprez91e03302021-02-08 16:46:08 -0800226 ],
227 compile_multilib: "first",
228 test_options: {
229 unit_test: true,
230 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200231}
232
233cc_binary {
234 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100235 defaults: [
236 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200237 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100238 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200239 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700240 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200241 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800242 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200243 "idmap2/Dump.cpp",
244 "idmap2/Lookup.cpp",
245 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200246 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800247 static_libs: [
248 "libidmap2_protos",
249 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200250 target: {
251 android: {
252 shared_libs: [
253 "libandroidfw",
254 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100255 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200256 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800257 "libprotobuf-cpp-lite",
258 "libutils",
259 "libz",
260 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200261 ],
Devin Moore39fe2cc2023-05-22 22:58:30 +0000262 static_libs: [
263 "libidmap2_policies",
264 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200265 },
266 host: {
267 static_libs: [
268 "libandroidfw",
269 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700270 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200271 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800272 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200273 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800274 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200275 "libutils",
276 "libziparchive",
277 ],
278 shared_libs: [
279 "libz",
280 ],
281 },
282 },
Winson62ac8b52019-12-04 08:36:48 -0800283
Mårten Kongstad02751232018-04-27 13:16:32 +0200284}
285
286cc_binary {
287 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100288 defaults: [
289 "idmap2_defaults",
290 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200291 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200292 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200293 "idmap2d/Idmap2Service.cpp",
294 "idmap2d/Main.cpp",
295 ],
296 shared_libs: [
297 "libandroidfw",
298 "libbase",
299 "libbinder",
300 "libcutils",
301 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800302 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200303 "libutils",
304 "libziparchive",
305 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100306 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800307 "libc++fs",
Devin Moore39fe2cc2023-05-22 22:58:30 +0000308 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800309 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100310 "libidmap2daidl",
311 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200312 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200313}
314
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100315cc_library_static {
316 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100317 srcs: [
318 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800319 ":idmap2_core_aidl",
320 ],
321 header_libs: [
322 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100323 ],
324 shared_libs: [
325 "libbase",
326 ],
327 aidl: {
328 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800329 local_include_dirs: [
330 "idmap2d/aidl/core",
331 "idmap2d/aidl/services/",
332 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100333 },
334}
335
Mårten Kongstad02751232018-04-27 13:16:32 +0200336filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800337 name: "idmap2_core_aidl",
338 srcs: [
339 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
340 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
341 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
342 ],
343 path: "idmap2d/aidl/core/",
344}
345
346filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200347 name: "idmap2_aidl",
348 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800349 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200350 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800351 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200352}
Winson62ac8b52019-12-04 08:36:48 -0800353
354aidl_interface {
355 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900356 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800357 srcs: [":overlayable_policy_aidl_files"],
358}
359
360filegroup {
361 name: "overlayable_policy_aidl_files",
362 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800363 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800364 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800365 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800366}