blob: 9988a7dbc3fd9df4c8ba47b60bfbea9e46ab58f8 [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: [
87 "libidmap2_protos",
88 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020089 shared_libs: [
90 "libandroidfw",
91 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010092 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080093 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080094 "libprotobuf-cpp-lite",
95 "libutils",
96 "libz",
97 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020098 ],
99 },
100 host: {
101 shared: {
102 enabled: false,
103 },
104 static_libs: [
105 "libandroidfw",
106 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700107 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -0800108 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800109 "libidmap2_protos",
110 "libprotobuf-cpp-lite",
111 "libutils",
112 "libz",
113 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800114 ],
115 },
116 },
117}
118
119cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800120 name: "libidmap2_protos",
121 srcs: [
122 "libidmap2/proto/*.proto",
123 ],
124 host_supported: true,
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -0800125 tidy: false,
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800126 proto: {
127 type: "lite",
128 export_proto_headers: true,
129 },
130}
131
132cc_library {
Winson62ac8b52019-12-04 08:36:48 -0800133 name: "libidmap2_policies",
134 defaults: [
135 "idmap2_defaults",
136 ],
137 host_supported: true,
138 export_include_dirs: ["libidmap2_policies/include"],
139 target: {
140 windows: {
141 enabled: true,
142 },
143 android: {
Winson62ac8b52019-12-04 08:36:48 -0800144 shared_libs: [
145 "libandroidfw",
146 ],
147 },
148 host: {
149 shared: {
150 enabled: false,
151 },
152 static_libs: [
153 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200154 ],
155 },
156 },
157}
158
159cc_test {
160 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100161 defaults: [
162 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200163 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100164 tidy_checks: [
165 "-readability-magic-numbers",
166 ],
167 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700168 test_suites: ["general-tests"],
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",
191 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200192 target: {
193 android: {
194 shared_libs: [
195 "libandroidfw",
196 "libbase",
197 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800198 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200199 "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 ],
206 },
207 host: {
208 static_libs: [
209 "libandroidfw",
210 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700211 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200212 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800213 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200214 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800215 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200216 "libutils",
217 "libziparchive",
218 ],
219 shared_libs: [
220 "libz",
221 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800222 data: [
223 ":libz",
224 ":idmap2",
225 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200226 },
227 },
Julien Desprez91e03302021-02-08 16:46:08 -0800228 data: [
229 "tests/data/**/*.apk",
Jeremy Meyera761f332022-10-21 17:42:14 +0000230 "tests/data/**/*.png",
Julien Desprez91e03302021-02-08 16:46:08 -0800231 ],
232 compile_multilib: "first",
233 test_options: {
234 unit_test: true,
235 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200236}
237
238cc_binary {
239 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100240 defaults: [
241 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200242 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100243 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200244 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700245 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200246 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800247 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200248 "idmap2/Dump.cpp",
249 "idmap2/Lookup.cpp",
250 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200251 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800252 static_libs: [
253 "libidmap2_protos",
254 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200255 target: {
256 android: {
257 shared_libs: [
258 "libandroidfw",
259 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100260 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200261 "libidmap2",
Winson62ac8b52019-12-04 08:36:48 -0800262 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800263 "libprotobuf-cpp-lite",
264 "libutils",
265 "libz",
266 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200267 ],
268 },
269 host: {
270 static_libs: [
271 "libandroidfw",
272 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700273 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200274 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800275 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200276 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800277 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200278 "libutils",
279 "libziparchive",
280 ],
281 shared_libs: [
282 "libz",
283 ],
284 },
285 },
Winson62ac8b52019-12-04 08:36:48 -0800286
Mårten Kongstad02751232018-04-27 13:16:32 +0200287}
288
289cc_binary {
290 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100291 defaults: [
292 "idmap2_defaults",
293 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200294 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200295 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200296 "idmap2d/Idmap2Service.cpp",
297 "idmap2d/Main.cpp",
298 ],
299 shared_libs: [
300 "libandroidfw",
301 "libbase",
302 "libbinder",
303 "libcutils",
304 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800305 "libidmap2_policies",
306 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200307 "libutils",
308 "libziparchive",
309 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100310 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800311 "libc++fs",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800312 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100313 "libidmap2daidl",
314 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200315 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200316}
317
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100318cc_library_static {
319 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100320 srcs: [
321 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800322 ":idmap2_core_aidl",
323 ],
324 header_libs: [
325 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100326 ],
327 shared_libs: [
328 "libbase",
329 ],
330 aidl: {
331 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800332 local_include_dirs: [
333 "idmap2d/aidl/core",
334 "idmap2d/aidl/services/",
335 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100336 },
337}
338
Mårten Kongstad02751232018-04-27 13:16:32 +0200339filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800340 name: "idmap2_core_aidl",
341 srcs: [
342 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
343 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
344 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
345 ],
346 path: "idmap2d/aidl/core/",
347}
348
349filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200350 name: "idmap2_aidl",
351 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800352 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200353 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800354 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200355}
Winson62ac8b52019-12-04 08:36:48 -0800356
357aidl_interface {
358 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900359 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800360 srcs: [":overlayable_policy_aidl_files"],
361}
362
363filegroup {
364 name: "overlayable_policy_aidl_files",
365 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800366 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800367 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800368 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800369}