blob: 5d64579f080e835ef1dbe9f2563e3978430de262 [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
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010015cc_defaults {
16 name: "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +020017 tidy: true,
Stephen Hines328a29c2020-06-09 00:14:52 -070018 tidy_checks: [
19 "modernize-*",
20 "-modernize-avoid-c-arrays",
21 "-modernize-use-trailing-return-type",
22 "android-*",
23 "misc-*",
24 "readability-*",
25 ],
Stephen Hinesab170652020-06-09 00:13:57 -070026 tidy_checks_as_errors: [
Ryan Mitchell19823452019-01-29 12:01:24 -080027 "modernize-*",
28 "-modernize-avoid-c-arrays",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080029 "-modernize-pass-by-value",
30 "-modernize-replace-disallow-copy-and-assign-macro",
31 "-modernize-use-equals-default",
32 "-modernize-use-nodiscard",
33 "-modernize-use-override",
Yi Kongfbafa512019-07-27 14:43:50 -070034 "-modernize-use-trailing-return-type",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080035 "-modernize-use-using",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010036 "android-*",
37 "misc-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080038 "-misc-non-private-member-variables-in-classes",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010039 "readability-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080040 "-readability-braces-around-statements",
41 "-readability-const-return-type",
42 "-readability-convert-member-functions-to-static",
43 "-readability-else-after-return",
44 "-readability-named-parameter",
45 "-readability-redundant-access-specifiers",
46 "-readability-uppercase-literal-suffix",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010047 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020048 tidy_flags: [
49 "-system-headers",
Mårten Kongstad02751232018-04-27 13:16:32 +020050 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010051}
52
53cc_library {
54 name: "libidmap2",
55 defaults: [
56 "idmap2_defaults",
57 ],
58 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +020059 srcs: [
Winson62ac8b52019-12-04 08:36:48 -080060 "libidmap2/**/*.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +020061 ],
62 export_include_dirs: ["include"],
63 target: {
64 android: {
65 static: {
66 enabled: false,
67 },
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080068 static_libs: [
69 "libidmap2_protos",
70 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020071 shared_libs: [
72 "libandroidfw",
73 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010074 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080075 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080076 "libprotobuf-cpp-lite",
77 "libutils",
78 "libz",
79 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020080 ],
81 },
82 host: {
83 shared: {
84 enabled: false,
85 },
86 static_libs: [
87 "libandroidfw",
88 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -070089 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080090 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080091 "libidmap2_protos",
92 "libprotobuf-cpp-lite",
93 "libutils",
94 "libz",
95 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -080096 ],
97 },
98 },
99}
100
101cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800102 name: "libidmap2_protos",
103 srcs: [
104 "libidmap2/proto/*.proto",
105 ],
106 host_supported: true,
107 proto: {
108 type: "lite",
109 export_proto_headers: true,
110 },
111}
112
113cc_library {
Winson62ac8b52019-12-04 08:36:48 -0800114 name: "libidmap2_policies",
115 defaults: [
116 "idmap2_defaults",
117 ],
118 host_supported: true,
119 export_include_dirs: ["libidmap2_policies/include"],
120 target: {
121 windows: {
122 enabled: true,
123 },
124 android: {
Winson62ac8b52019-12-04 08:36:48 -0800125 shared_libs: [
126 "libandroidfw",
127 ],
128 },
129 host: {
130 shared: {
131 enabled: false,
132 },
133 static_libs: [
134 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200135 ],
136 },
137 },
138}
139
140cc_test {
141 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100142 defaults: [
143 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200144 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100145 tidy_checks: [
146 "-readability-magic-numbers",
147 ],
148 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700149 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200150 srcs: [
151 "tests/BinaryStreamVisitorTests.cpp",
152 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800153 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200154 "tests/FileUtilsTests.cpp",
155 "tests/Idmap2BinaryTests.cpp",
156 "tests/IdmapTests.cpp",
157 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800158 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200159 "tests/PrettyPrintVisitorTests.cpp",
160 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700161 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200162 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100163 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700164 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200165 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800166 required: [
167 "idmap2",
168 ],
169 static_libs: [
170 "libgmock",
171 "libidmap2_protos",
172 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200173 target: {
174 android: {
175 shared_libs: [
176 "libandroidfw",
177 "libbase",
178 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800179 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200180 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800181 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200182 "libutils",
183 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800184 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200185 "libziparchive",
186 ],
187 },
188 host: {
189 static_libs: [
190 "libandroidfw",
191 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700192 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200193 "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 "libziparchive",
199 ],
200 shared_libs: [
201 "libz",
202 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800203 data: [
204 ":libz",
205 ":idmap2",
206 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200207 },
208 },
Julien Desprez91e03302021-02-08 16:46:08 -0800209 data: [
210 "tests/data/**/*.apk",
211 ],
212 compile_multilib: "first",
213 test_options: {
214 unit_test: true,
215 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200216}
217
218cc_binary {
219 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100220 defaults: [
221 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200222 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100223 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200224 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700225 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200226 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800227 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200228 "idmap2/Dump.cpp",
229 "idmap2/Lookup.cpp",
230 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200231 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800232 static_libs: [
233 "libidmap2_protos",
234 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200235 target: {
236 android: {
237 shared_libs: [
238 "libandroidfw",
239 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100240 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200241 "libidmap2",
Winson62ac8b52019-12-04 08:36:48 -0800242 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800243 "libprotobuf-cpp-lite",
244 "libutils",
245 "libz",
246 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200247 ],
248 },
249 host: {
250 static_libs: [
251 "libandroidfw",
252 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700253 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200254 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800255 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200256 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800257 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200258 "libutils",
259 "libziparchive",
260 ],
261 shared_libs: [
262 "libz",
263 ],
264 },
265 },
Winson62ac8b52019-12-04 08:36:48 -0800266
Mårten Kongstad02751232018-04-27 13:16:32 +0200267}
268
269cc_binary {
270 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100271 defaults: [
272 "idmap2_defaults",
273 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200274 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200275 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200276 "idmap2d/Idmap2Service.cpp",
277 "idmap2d/Main.cpp",
278 ],
279 shared_libs: [
280 "libandroidfw",
281 "libbase",
282 "libbinder",
283 "libcutils",
284 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800285 "libidmap2_policies",
286 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200287 "libutils",
288 "libziparchive",
289 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100290 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800291 "libc++fs",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800292 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100293 "libidmap2daidl",
294 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200295 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200296}
297
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100298cc_library_static {
299 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100300 srcs: [
301 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800302 ":idmap2_core_aidl",
303 ],
304 header_libs: [
305 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100306 ],
307 shared_libs: [
308 "libbase",
309 ],
310 aidl: {
311 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800312 local_include_dirs: [
313 "idmap2d/aidl/core",
314 "idmap2d/aidl/services/",
315 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100316 },
317}
318
Mårten Kongstad02751232018-04-27 13:16:32 +0200319filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800320 name: "idmap2_core_aidl",
321 srcs: [
322 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
323 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
324 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
325 ],
326 path: "idmap2d/aidl/core/",
327}
328
329filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200330 name: "idmap2_aidl",
331 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800332 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200333 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800334 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200335}
Winson62ac8b52019-12-04 08:36:48 -0800336
337aidl_interface {
338 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900339 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800340 srcs: [":overlayable_policy_aidl_files"],
341}
342
343filegroup {
344 name: "overlayable_policy_aidl_files",
345 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800346 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800347 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800348 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800349}