blob: 4f8faca59e4ce20630519d2f30c88dbfc382e51e [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",
225 ],
226 compile_multilib: "first",
227 test_options: {
228 unit_test: true,
229 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200230}
231
232cc_binary {
233 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100234 defaults: [
235 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200236 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100237 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200238 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700239 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200240 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800241 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200242 "idmap2/Dump.cpp",
243 "idmap2/Lookup.cpp",
244 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200245 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800246 static_libs: [
247 "libidmap2_protos",
248 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200249 target: {
250 android: {
251 shared_libs: [
252 "libandroidfw",
253 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100254 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200255 "libidmap2",
Winson62ac8b52019-12-04 08:36:48 -0800256 "libidmap2_policies",
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 ],
262 },
263 host: {
264 static_libs: [
265 "libandroidfw",
266 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700267 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200268 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800269 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200270 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800271 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200272 "libutils",
273 "libziparchive",
274 ],
275 shared_libs: [
276 "libz",
277 ],
278 },
279 },
Winson62ac8b52019-12-04 08:36:48 -0800280
Mårten Kongstad02751232018-04-27 13:16:32 +0200281}
282
283cc_binary {
284 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100285 defaults: [
286 "idmap2_defaults",
287 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200288 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200289 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200290 "idmap2d/Idmap2Service.cpp",
291 "idmap2d/Main.cpp",
292 ],
293 shared_libs: [
294 "libandroidfw",
295 "libbase",
296 "libbinder",
297 "libcutils",
298 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800299 "libidmap2_policies",
300 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200301 "libutils",
302 "libziparchive",
303 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100304 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800305 "libc++fs",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800306 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100307 "libidmap2daidl",
308 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200309 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200310}
311
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100312cc_library_static {
313 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100314 srcs: [
315 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800316 ":idmap2_core_aidl",
317 ],
318 header_libs: [
319 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100320 ],
321 shared_libs: [
322 "libbase",
323 ],
324 aidl: {
325 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800326 local_include_dirs: [
327 "idmap2d/aidl/core",
328 "idmap2d/aidl/services/",
329 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100330 },
331}
332
Mårten Kongstad02751232018-04-27 13:16:32 +0200333filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800334 name: "idmap2_core_aidl",
335 srcs: [
336 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
337 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
338 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
339 ],
340 path: "idmap2d/aidl/core/",
341}
342
343filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200344 name: "idmap2_aidl",
345 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800346 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200347 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800348 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200349}
Winson62ac8b52019-12-04 08:36:48 -0800350
351aidl_interface {
352 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900353 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800354 srcs: [":overlayable_policy_aidl_files"],
355}
356
357filegroup {
358 name: "overlayable_policy_aidl_files",
359 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800360 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800361 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800362 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800363}