blob: 7a08cbdcddd4af4778a6ee76a52156416673969a [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",
Mårten Kongstad02751232018-04-27 13:16:32 +020074 ],
75 export_include_dirs: ["include"],
76 target: {
77 android: {
78 static: {
79 enabled: false,
80 },
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080081 static_libs: [
82 "libidmap2_protos",
83 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020084 shared_libs: [
85 "libandroidfw",
86 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010087 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080088 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080089 "libprotobuf-cpp-lite",
90 "libutils",
91 "libz",
92 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020093 ],
94 },
95 host: {
96 shared: {
97 enabled: false,
98 },
99 static_libs: [
100 "libandroidfw",
101 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700102 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -0800103 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800104 "libidmap2_protos",
105 "libprotobuf-cpp-lite",
106 "libutils",
107 "libz",
108 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800109 ],
110 },
111 },
112}
113
114cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800115 name: "libidmap2_protos",
116 srcs: [
117 "libidmap2/proto/*.proto",
118 ],
119 host_supported: true,
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -0800120 tidy: false,
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800121 proto: {
122 type: "lite",
123 export_proto_headers: true,
124 },
125}
126
127cc_library {
Winson62ac8b52019-12-04 08:36:48 -0800128 name: "libidmap2_policies",
129 defaults: [
130 "idmap2_defaults",
131 ],
132 host_supported: true,
133 export_include_dirs: ["libidmap2_policies/include"],
134 target: {
135 windows: {
136 enabled: true,
137 },
138 android: {
Winson62ac8b52019-12-04 08:36:48 -0800139 shared_libs: [
140 "libandroidfw",
141 ],
142 },
143 host: {
144 shared: {
145 enabled: false,
146 },
147 static_libs: [
148 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200149 ],
150 },
151 },
152}
153
154cc_test {
155 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100156 defaults: [
157 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200158 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100159 tidy_checks: [
160 "-readability-magic-numbers",
161 ],
162 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700163 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200164 srcs: [
165 "tests/BinaryStreamVisitorTests.cpp",
166 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800167 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200168 "tests/FileUtilsTests.cpp",
169 "tests/Idmap2BinaryTests.cpp",
170 "tests/IdmapTests.cpp",
171 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800172 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200173 "tests/PrettyPrintVisitorTests.cpp",
174 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700175 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200176 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100177 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700178 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200179 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800180 required: [
181 "idmap2",
182 ],
183 static_libs: [
184 "libgmock",
185 "libidmap2_protos",
186 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200187 target: {
188 android: {
189 shared_libs: [
190 "libandroidfw",
191 "libbase",
192 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800193 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200194 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800195 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200196 "libutils",
197 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800198 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200199 "libziparchive",
200 ],
201 },
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",
Winson62ac8b52019-12-04 08:36:48 -0800257 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800258 "libprotobuf-cpp-lite",
259 "libutils",
260 "libz",
261 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200262 ],
263 },
264 host: {
265 static_libs: [
266 "libandroidfw",
267 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700268 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200269 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800270 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200271 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800272 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200273 "libutils",
274 "libziparchive",
275 ],
276 shared_libs: [
277 "libz",
278 ],
279 },
280 },
Winson62ac8b52019-12-04 08:36:48 -0800281
Mårten Kongstad02751232018-04-27 13:16:32 +0200282}
283
284cc_binary {
285 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100286 defaults: [
287 "idmap2_defaults",
288 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200289 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200290 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200291 "idmap2d/Idmap2Service.cpp",
292 "idmap2d/Main.cpp",
293 ],
294 shared_libs: [
295 "libandroidfw",
296 "libbase",
297 "libbinder",
298 "libcutils",
299 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800300 "libidmap2_policies",
301 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200302 "libutils",
303 "libziparchive",
304 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100305 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800306 "libc++fs",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800307 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100308 "libidmap2daidl",
309 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200310 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200311}
312
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100313cc_library_static {
314 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100315 srcs: [
316 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800317 ":idmap2_core_aidl",
318 ],
319 header_libs: [
320 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100321 ],
322 shared_libs: [
323 "libbase",
324 ],
325 aidl: {
326 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800327 local_include_dirs: [
328 "idmap2d/aidl/core",
329 "idmap2d/aidl/services/",
330 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100331 },
332}
333
Mårten Kongstad02751232018-04-27 13:16:32 +0200334filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800335 name: "idmap2_core_aidl",
336 srcs: [
337 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
338 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
339 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
340 ],
341 path: "idmap2d/aidl/core/",
342}
343
344filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200345 name: "idmap2_aidl",
346 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800347 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200348 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800349 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200350}
Winson62ac8b52019-12-04 08:36:48 -0800351
352aidl_interface {
353 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900354 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800355 srcs: [":overlayable_policy_aidl_files"],
356}
357
358filegroup {
359 name: "overlayable_policy_aidl_files",
360 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800361 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800362 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800363 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800364}