blob: c202f6f03b5bb6c3bcd0b83f5aa95ee286558696 [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",
55 "-readability-else-after-return",
Chih-Hung Hsieh715a6c42021-10-04 16:01:56 -070056 "-readability-identifier-length",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080057 "-readability-named-parameter",
58 "-readability-redundant-access-specifiers",
59 "-readability-uppercase-literal-suffix",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010060 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010061}
62
63cc_library {
64 name: "libidmap2",
65 defaults: [
66 "idmap2_defaults",
67 ],
68 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +020069 srcs: [
Winson62ac8b52019-12-04 08:36:48 -080070 "libidmap2/**/*.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +020071 ],
72 export_include_dirs: ["include"],
73 target: {
74 android: {
75 static: {
76 enabled: false,
77 },
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080078 static_libs: [
79 "libidmap2_protos",
80 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020081 shared_libs: [
82 "libandroidfw",
83 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010084 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080085 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080086 "libprotobuf-cpp-lite",
87 "libutils",
88 "libz",
89 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020090 ],
91 },
92 host: {
93 shared: {
94 enabled: false,
95 },
96 static_libs: [
97 "libandroidfw",
98 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -070099 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -0800100 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800101 "libidmap2_protos",
102 "libprotobuf-cpp-lite",
103 "libutils",
104 "libz",
105 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800106 ],
107 },
108 },
109}
110
111cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800112 name: "libidmap2_protos",
113 srcs: [
114 "libidmap2/proto/*.proto",
115 ],
116 host_supported: true,
117 proto: {
118 type: "lite",
119 export_proto_headers: true,
120 },
121}
122
123cc_library {
Winson62ac8b52019-12-04 08:36:48 -0800124 name: "libidmap2_policies",
125 defaults: [
126 "idmap2_defaults",
127 ],
128 host_supported: true,
129 export_include_dirs: ["libidmap2_policies/include"],
130 target: {
131 windows: {
132 enabled: true,
133 },
134 android: {
Winson62ac8b52019-12-04 08:36:48 -0800135 shared_libs: [
136 "libandroidfw",
137 ],
138 },
139 host: {
140 shared: {
141 enabled: false,
142 },
143 static_libs: [
144 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200145 ],
146 },
147 },
148}
149
150cc_test {
151 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100152 defaults: [
153 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200154 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100155 tidy_checks: [
156 "-readability-magic-numbers",
157 ],
158 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700159 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200160 srcs: [
161 "tests/BinaryStreamVisitorTests.cpp",
162 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800163 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200164 "tests/FileUtilsTests.cpp",
165 "tests/Idmap2BinaryTests.cpp",
166 "tests/IdmapTests.cpp",
167 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800168 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200169 "tests/PrettyPrintVisitorTests.cpp",
170 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700171 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200172 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100173 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700174 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200175 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800176 required: [
177 "idmap2",
178 ],
179 static_libs: [
180 "libgmock",
181 "libidmap2_protos",
182 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200183 target: {
184 android: {
185 shared_libs: [
186 "libandroidfw",
187 "libbase",
188 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800189 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200190 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800191 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200192 "libutils",
193 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800194 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200195 "libziparchive",
196 ],
197 },
198 host: {
199 static_libs: [
200 "libandroidfw",
201 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700202 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200203 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800204 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200205 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800206 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200207 "libutils",
208 "libziparchive",
209 ],
210 shared_libs: [
211 "libz",
212 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800213 data: [
214 ":libz",
215 ":idmap2",
216 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200217 },
218 },
Julien Desprez91e03302021-02-08 16:46:08 -0800219 data: [
220 "tests/data/**/*.apk",
221 ],
222 compile_multilib: "first",
223 test_options: {
224 unit_test: true,
225 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200226}
227
228cc_binary {
229 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100230 defaults: [
231 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200232 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100233 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200234 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700235 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200236 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800237 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200238 "idmap2/Dump.cpp",
239 "idmap2/Lookup.cpp",
240 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200241 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800242 static_libs: [
243 "libidmap2_protos",
244 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200245 target: {
246 android: {
247 shared_libs: [
248 "libandroidfw",
249 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100250 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200251 "libidmap2",
Winson62ac8b52019-12-04 08:36:48 -0800252 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800253 "libprotobuf-cpp-lite",
254 "libutils",
255 "libz",
256 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200257 ],
258 },
259 host: {
260 static_libs: [
261 "libandroidfw",
262 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700263 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200264 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800265 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200266 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800267 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200268 "libutils",
269 "libziparchive",
270 ],
271 shared_libs: [
272 "libz",
273 ],
274 },
275 },
Winson62ac8b52019-12-04 08:36:48 -0800276
Mårten Kongstad02751232018-04-27 13:16:32 +0200277}
278
279cc_binary {
280 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100281 defaults: [
282 "idmap2_defaults",
283 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200284 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200285 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200286 "idmap2d/Idmap2Service.cpp",
287 "idmap2d/Main.cpp",
288 ],
289 shared_libs: [
290 "libandroidfw",
291 "libbase",
292 "libbinder",
293 "libcutils",
294 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800295 "libidmap2_policies",
296 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200297 "libutils",
298 "libziparchive",
299 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100300 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800301 "libc++fs",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800302 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100303 "libidmap2daidl",
304 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200305 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200306}
307
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100308cc_library_static {
309 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100310 srcs: [
311 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800312 ":idmap2_core_aidl",
313 ],
314 header_libs: [
315 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100316 ],
317 shared_libs: [
318 "libbase",
319 ],
320 aidl: {
321 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800322 local_include_dirs: [
323 "idmap2d/aidl/core",
324 "idmap2d/aidl/services/",
325 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100326 },
327}
328
Mårten Kongstad02751232018-04-27 13:16:32 +0200329filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800330 name: "idmap2_core_aidl",
331 srcs: [
332 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
333 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
334 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
335 ],
336 path: "idmap2d/aidl/core/",
337}
338
339filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200340 name: "idmap2_aidl",
341 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800342 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200343 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800344 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200345}
Winson62ac8b52019-12-04 08:36:48 -0800346
347aidl_interface {
348 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900349 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800350 srcs: [":overlayable_policy_aidl_files"],
351}
352
353filegroup {
354 name: "overlayable_policy_aidl_files",
355 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800356 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800357 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800358 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800359}