blob: 18ec5a407b2448b6a1da8080ae8e3bb5212386f0 [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",
46 "-modernize-use-nodiscard",
47 "-modernize-use-override",
Yi Kongfbafa512019-07-27 14:43:50 -070048 "-modernize-use-trailing-return-type",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080049 "-modernize-use-using",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010050 "android-*",
51 "misc-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080052 "-misc-non-private-member-variables-in-classes",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010053 "readability-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080054 "-readability-braces-around-statements",
55 "-readability-const-return-type",
56 "-readability-convert-member-functions-to-static",
Pirama Arumuga Nainar8186f292022-03-10 04:56:33 +000057 "-readability-duplicate-include",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080058 "-readability-else-after-return",
59 "-readability-named-parameter",
60 "-readability-redundant-access-specifiers",
61 "-readability-uppercase-literal-suffix",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010062 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010063}
64
65cc_library {
66 name: "libidmap2",
67 defaults: [
68 "idmap2_defaults",
69 ],
70 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +020071 srcs: [
Winson62ac8b52019-12-04 08:36:48 -080072 "libidmap2/**/*.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +020073 ],
74 export_include_dirs: ["include"],
75 target: {
76 android: {
77 static: {
78 enabled: false,
79 },
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080080 static_libs: [
81 "libidmap2_protos",
82 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020083 shared_libs: [
84 "libandroidfw",
85 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010086 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080087 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080088 "libprotobuf-cpp-lite",
89 "libutils",
90 "libz",
91 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020092 ],
93 },
94 host: {
95 shared: {
96 enabled: false,
97 },
98 static_libs: [
99 "libandroidfw",
100 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700101 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -0800102 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800103 "libidmap2_protos",
104 "libprotobuf-cpp-lite",
105 "libutils",
106 "libz",
107 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800108 ],
109 },
110 },
111}
112
113cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800114 name: "libidmap2_protos",
115 srcs: [
116 "libidmap2/proto/*.proto",
117 ],
118 host_supported: true,
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -0800119 tidy: false,
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800120 proto: {
121 type: "lite",
122 export_proto_headers: true,
123 },
124}
125
126cc_library {
Winson62ac8b52019-12-04 08:36:48 -0800127 name: "libidmap2_policies",
128 defaults: [
129 "idmap2_defaults",
130 ],
131 host_supported: true,
132 export_include_dirs: ["libidmap2_policies/include"],
133 target: {
134 windows: {
135 enabled: true,
136 },
137 android: {
Winson62ac8b52019-12-04 08:36:48 -0800138 shared_libs: [
139 "libandroidfw",
140 ],
141 },
142 host: {
143 shared: {
144 enabled: false,
145 },
146 static_libs: [
147 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200148 ],
149 },
150 },
151}
152
153cc_test {
154 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100155 defaults: [
156 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200157 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100158 tidy_checks: [
159 "-readability-magic-numbers",
160 ],
161 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700162 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200163 srcs: [
164 "tests/BinaryStreamVisitorTests.cpp",
165 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800166 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200167 "tests/FileUtilsTests.cpp",
168 "tests/Idmap2BinaryTests.cpp",
169 "tests/IdmapTests.cpp",
170 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800171 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200172 "tests/PrettyPrintVisitorTests.cpp",
173 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700174 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200175 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100176 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700177 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200178 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800179 required: [
180 "idmap2",
181 ],
182 static_libs: [
183 "libgmock",
184 "libidmap2_protos",
185 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200186 target: {
187 android: {
188 shared_libs: [
189 "libandroidfw",
190 "libbase",
191 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800192 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200193 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800194 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200195 "libutils",
196 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800197 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200198 "libziparchive",
199 ],
200 },
201 host: {
202 static_libs: [
203 "libandroidfw",
204 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700205 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200206 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800207 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200208 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800209 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200210 "libutils",
211 "libziparchive",
212 ],
213 shared_libs: [
214 "libz",
215 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800216 data: [
217 ":libz",
218 ":idmap2",
219 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200220 },
221 },
Julien Desprez91e03302021-02-08 16:46:08 -0800222 data: [
223 "tests/data/**/*.apk",
224 ],
225 compile_multilib: "first",
226 test_options: {
227 unit_test: true,
228 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200229}
230
231cc_binary {
232 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100233 defaults: [
234 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200235 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100236 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200237 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700238 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200239 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800240 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200241 "idmap2/Dump.cpp",
242 "idmap2/Lookup.cpp",
243 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200244 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800245 static_libs: [
246 "libidmap2_protos",
247 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200248 target: {
249 android: {
250 shared_libs: [
251 "libandroidfw",
252 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100253 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200254 "libidmap2",
Winson62ac8b52019-12-04 08:36:48 -0800255 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800256 "libprotobuf-cpp-lite",
257 "libutils",
258 "libz",
259 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200260 ],
261 },
262 host: {
263 static_libs: [
264 "libandroidfw",
265 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700266 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200267 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800268 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200269 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800270 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200271 "libutils",
272 "libziparchive",
273 ],
274 shared_libs: [
275 "libz",
276 ],
277 },
278 },
Winson62ac8b52019-12-04 08:36:48 -0800279
Mårten Kongstad02751232018-04-27 13:16:32 +0200280}
281
282cc_binary {
283 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100284 defaults: [
285 "idmap2_defaults",
286 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200287 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200288 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200289 "idmap2d/Idmap2Service.cpp",
290 "idmap2d/Main.cpp",
291 ],
292 shared_libs: [
293 "libandroidfw",
294 "libbase",
295 "libbinder",
296 "libcutils",
297 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800298 "libidmap2_policies",
299 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200300 "libutils",
301 "libziparchive",
302 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100303 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800304 "libc++fs",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800305 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100306 "libidmap2daidl",
307 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200308 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200309}
310
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100311cc_library_static {
312 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100313 srcs: [
314 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800315 ":idmap2_core_aidl",
316 ],
317 header_libs: [
318 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100319 ],
320 shared_libs: [
321 "libbase",
322 ],
323 aidl: {
324 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800325 local_include_dirs: [
326 "idmap2d/aidl/core",
327 "idmap2d/aidl/services/",
328 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100329 },
330}
331
Mårten Kongstad02751232018-04-27 13:16:32 +0200332filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800333 name: "idmap2_core_aidl",
334 srcs: [
335 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
336 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
337 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
338 ],
339 path: "idmap2d/aidl/core/",
340}
341
342filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200343 name: "idmap2_aidl",
344 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800345 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200346 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800347 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200348}
Winson62ac8b52019-12-04 08:36:48 -0800349
350aidl_interface {
351 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900352 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800353 srcs: [":overlayable_policy_aidl_files"],
354}
355
356filegroup {
357 name: "overlayable_policy_aidl_files",
358 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800359 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800360 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800361 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800362}