blob: 5f06c971ba987a3692fe7754bd35e9d87cbe4246 [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: [
83 "libidmap2_protos",
84 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020085 shared_libs: [
86 "libandroidfw",
87 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010088 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080089 "libidmap2_policies",
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
128cc_library {
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: {
145 shared: {
146 enabled: false,
147 },
148 static_libs: [
149 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200150 ],
151 },
152 },
153}
154
155cc_test {
156 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100157 defaults: [
158 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200159 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100160 tidy_checks: [
161 "-readability-magic-numbers",
162 ],
163 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700164 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200165 srcs: [
166 "tests/BinaryStreamVisitorTests.cpp",
167 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800168 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200169 "tests/FileUtilsTests.cpp",
170 "tests/Idmap2BinaryTests.cpp",
171 "tests/IdmapTests.cpp",
172 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800173 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200174 "tests/PrettyPrintVisitorTests.cpp",
175 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700176 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200177 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100178 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700179 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200180 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800181 required: [
182 "idmap2",
183 ],
184 static_libs: [
185 "libgmock",
186 "libidmap2_protos",
187 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200188 target: {
189 android: {
190 shared_libs: [
191 "libandroidfw",
192 "libbase",
193 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800194 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200195 "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 ],
202 },
203 host: {
204 static_libs: [
205 "libandroidfw",
206 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700207 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200208 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800209 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200210 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800211 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200212 "libutils",
213 "libziparchive",
214 ],
215 shared_libs: [
216 "libz",
217 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800218 data: [
219 ":libz",
220 ":idmap2",
221 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200222 },
223 },
Julien Desprez91e03302021-02-08 16:46:08 -0800224 data: [
225 "tests/data/**/*.apk",
Jeremy Meyera761f332022-10-21 17:42:14 +0000226 "tests/data/**/*.png",
Julien Desprez91e03302021-02-08 16:46:08 -0800227 ],
228 compile_multilib: "first",
229 test_options: {
230 unit_test: true,
231 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200232}
233
234cc_binary {
235 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100236 defaults: [
237 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200238 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100239 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200240 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700241 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200242 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800243 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200244 "idmap2/Dump.cpp",
245 "idmap2/Lookup.cpp",
246 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200247 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800248 static_libs: [
249 "libidmap2_protos",
250 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200251 target: {
252 android: {
253 shared_libs: [
254 "libandroidfw",
255 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100256 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200257 "libidmap2",
Winson62ac8b52019-12-04 08:36:48 -0800258 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800259 "libprotobuf-cpp-lite",
260 "libutils",
261 "libz",
262 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200263 ],
264 },
265 host: {
266 static_libs: [
267 "libandroidfw",
268 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700269 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200270 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800271 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200272 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800273 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200274 "libutils",
275 "libziparchive",
276 ],
277 shared_libs: [
278 "libz",
279 ],
280 },
281 },
Winson62ac8b52019-12-04 08:36:48 -0800282
Mårten Kongstad02751232018-04-27 13:16:32 +0200283}
284
285cc_binary {
286 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100287 defaults: [
288 "idmap2_defaults",
289 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200290 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200291 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200292 "idmap2d/Idmap2Service.cpp",
293 "idmap2d/Main.cpp",
294 ],
295 shared_libs: [
296 "libandroidfw",
297 "libbase",
298 "libbinder",
299 "libcutils",
300 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800301 "libidmap2_policies",
302 "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",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800308 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100309 "libidmap2daidl",
310 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200311 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200312}
313
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100314cc_library_static {
315 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100316 srcs: [
317 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800318 ":idmap2_core_aidl",
319 ],
320 header_libs: [
321 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100322 ],
323 shared_libs: [
324 "libbase",
325 ],
326 aidl: {
327 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800328 local_include_dirs: [
329 "idmap2d/aidl/core",
330 "idmap2d/aidl/services/",
331 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100332 },
333}
334
Mårten Kongstad02751232018-04-27 13:16:32 +0200335filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800336 name: "idmap2_core_aidl",
337 srcs: [
338 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
339 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
340 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
341 ],
342 path: "idmap2d/aidl/core/",
343}
344
345filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200346 name: "idmap2_aidl",
347 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800348 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200349 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800350 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200351}
Winson62ac8b52019-12-04 08:36:48 -0800352
353aidl_interface {
354 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900355 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800356 srcs: [":overlayable_policy_aidl_files"],
357}
358
359filegroup {
360 name: "overlayable_policy_aidl_files",
361 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800362 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800363 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800364 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800365}