blob: 6ef6845c75f2591bff7d7f115b06ae3feb197533 [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 Badour051ef782021-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",
Mårten Kongstad02751232018-04-27 13:16:32 +020026 tidy: true,
Stephen Hines328a29c2020-06-09 00:14:52 -070027 tidy_checks: [
28 "modernize-*",
29 "-modernize-avoid-c-arrays",
30 "-modernize-use-trailing-return-type",
31 "android-*",
32 "misc-*",
33 "readability-*",
34 ],
Stephen Hinesab170652020-06-09 00:13:57 -070035 tidy_checks_as_errors: [
Ryan Mitchell19823452019-01-29 12:01:24 -080036 "modernize-*",
37 "-modernize-avoid-c-arrays",
Yabin Cui5fa57f62021-07-14 17:25:16 -070038 "-modernize-concat-nested-namespaces",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080039 "-modernize-pass-by-value",
40 "-modernize-replace-disallow-copy-and-assign-macro",
Yabin Cui5fa57f62021-07-14 17:25:16 -070041 "-modernize-return-braced-init-list",
Yi Kongb0981d92022-02-18 01:52:21 +080042 "-modernize-use-default-member-init",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080043 "-modernize-use-equals-default",
44 "-modernize-use-nodiscard",
45 "-modernize-use-override",
Yi Kongfbafa512019-07-27 14:43:50 -070046 "-modernize-use-trailing-return-type",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080047 "-modernize-use-using",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010048 "android-*",
49 "misc-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080050 "-misc-non-private-member-variables-in-classes",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010051 "readability-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080052 "-readability-braces-around-statements",
53 "-readability-const-return-type",
54 "-readability-convert-member-functions-to-static",
Pirama Arumuga Nainar8186f292022-03-10 04:56:33 +000055 "-readability-duplicate-include",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080056 "-readability-else-after-return",
Chih-Hung Hsieh715a6c42021-10-04 16:01:56 -070057 "-readability-identifier-length",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080058 "-readability-named-parameter",
59 "-readability-redundant-access-specifiers",
60 "-readability-uppercase-literal-suffix",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010061 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010062}
63
64cc_library {
65 name: "libidmap2",
66 defaults: [
67 "idmap2_defaults",
68 ],
69 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +020070 srcs: [
Winson62ac8b52019-12-04 08:36:48 -080071 "libidmap2/**/*.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +020072 ],
73 export_include_dirs: ["include"],
74 target: {
75 android: {
76 static: {
77 enabled: false,
78 },
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080079 static_libs: [
80 "libidmap2_protos",
81 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020082 shared_libs: [
83 "libandroidfw",
84 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010085 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080086 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080087 "libprotobuf-cpp-lite",
88 "libutils",
89 "libz",
90 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020091 ],
92 },
93 host: {
94 shared: {
95 enabled: false,
96 },
97 static_libs: [
98 "libandroidfw",
99 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700100 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -0800101 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800102 "libidmap2_protos",
103 "libprotobuf-cpp-lite",
104 "libutils",
105 "libz",
106 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800107 ],
108 },
109 },
110}
111
112cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800113 name: "libidmap2_protos",
114 srcs: [
115 "libidmap2/proto/*.proto",
116 ],
117 host_supported: true,
118 proto: {
119 type: "lite",
120 export_proto_headers: true,
121 },
122}
123
124cc_library {
Winson62ac8b52019-12-04 08:36:48 -0800125 name: "libidmap2_policies",
126 defaults: [
127 "idmap2_defaults",
128 ],
129 host_supported: true,
130 export_include_dirs: ["libidmap2_policies/include"],
131 target: {
132 windows: {
133 enabled: true,
134 },
135 android: {
Winson62ac8b52019-12-04 08:36:48 -0800136 shared_libs: [
137 "libandroidfw",
138 ],
139 },
140 host: {
141 shared: {
142 enabled: false,
143 },
144 static_libs: [
145 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200146 ],
147 },
148 },
149}
150
151cc_test {
152 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100153 defaults: [
154 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200155 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100156 tidy_checks: [
157 "-readability-magic-numbers",
158 ],
159 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700160 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200161 srcs: [
162 "tests/BinaryStreamVisitorTests.cpp",
163 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800164 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200165 "tests/FileUtilsTests.cpp",
166 "tests/Idmap2BinaryTests.cpp",
167 "tests/IdmapTests.cpp",
168 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800169 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200170 "tests/PrettyPrintVisitorTests.cpp",
171 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700172 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200173 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100174 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700175 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200176 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800177 required: [
178 "idmap2",
179 ],
180 static_libs: [
181 "libgmock",
182 "libidmap2_protos",
183 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200184 target: {
185 android: {
186 shared_libs: [
187 "libandroidfw",
188 "libbase",
189 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800190 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200191 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800192 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200193 "libutils",
194 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800195 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200196 "libziparchive",
197 ],
198 },
199 host: {
200 static_libs: [
201 "libandroidfw",
202 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700203 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200204 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800205 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200206 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800207 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200208 "libutils",
209 "libziparchive",
210 ],
211 shared_libs: [
212 "libz",
213 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800214 data: [
215 ":libz",
216 ":idmap2",
217 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200218 },
219 },
Julien Desprez91e03302021-02-08 16:46:08 -0800220 data: [
221 "tests/data/**/*.apk",
222 ],
223 compile_multilib: "first",
224 test_options: {
225 unit_test: true,
226 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200227}
228
229cc_binary {
230 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100231 defaults: [
232 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200233 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100234 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200235 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700236 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200237 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800238 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200239 "idmap2/Dump.cpp",
240 "idmap2/Lookup.cpp",
241 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200242 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800243 static_libs: [
244 "libidmap2_protos",
245 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200246 target: {
247 android: {
248 shared_libs: [
249 "libandroidfw",
250 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100251 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200252 "libidmap2",
Winson62ac8b52019-12-04 08:36:48 -0800253 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800254 "libprotobuf-cpp-lite",
255 "libutils",
256 "libz",
257 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200258 ],
259 },
260 host: {
261 static_libs: [
262 "libandroidfw",
263 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700264 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200265 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800266 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200267 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800268 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200269 "libutils",
270 "libziparchive",
271 ],
272 shared_libs: [
273 "libz",
274 ],
275 },
276 },
Winson62ac8b52019-12-04 08:36:48 -0800277
Mårten Kongstad02751232018-04-27 13:16:32 +0200278}
279
280cc_binary {
281 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100282 defaults: [
283 "idmap2_defaults",
284 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200285 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200286 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200287 "idmap2d/Idmap2Service.cpp",
288 "idmap2d/Main.cpp",
289 ],
290 shared_libs: [
291 "libandroidfw",
292 "libbase",
293 "libbinder",
294 "libcutils",
295 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800296 "libidmap2_policies",
297 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200298 "libutils",
299 "libziparchive",
300 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100301 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800302 "libc++fs",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800303 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100304 "libidmap2daidl",
305 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200306 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200307}
308
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100309cc_library_static {
310 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100311 srcs: [
312 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800313 ":idmap2_core_aidl",
314 ],
315 header_libs: [
316 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100317 ],
318 shared_libs: [
319 "libbase",
320 ],
321 aidl: {
322 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800323 local_include_dirs: [
324 "idmap2d/aidl/core",
325 "idmap2d/aidl/services/",
326 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100327 },
328}
329
Mårten Kongstad02751232018-04-27 13:16:32 +0200330filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800331 name: "idmap2_core_aidl",
332 srcs: [
333 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
334 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
335 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
336 ],
337 path: "idmap2d/aidl/core/",
338}
339
340filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200341 name: "idmap2_aidl",
342 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800343 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200344 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800345 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200346}
Winson62ac8b52019-12-04 08:36:48 -0800347
348aidl_interface {
349 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900350 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800351 srcs: [":overlayable_policy_aidl_files"],
352}
353
354filegroup {
355 name: "overlayable_policy_aidl_files",
356 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800357 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800358 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800359 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800360}