blob: c134822585e048f69d4d17812115ccdc8831983b [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",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080042 "-modernize-use-equals-default",
43 "-modernize-use-nodiscard",
44 "-modernize-use-override",
Yi Kongfbafa512019-07-27 14:43:50 -070045 "-modernize-use-trailing-return-type",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080046 "-modernize-use-using",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010047 "android-*",
48 "misc-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080049 "-misc-non-private-member-variables-in-classes",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010050 "readability-*",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080051 "-readability-braces-around-statements",
52 "-readability-const-return-type",
53 "-readability-convert-member-functions-to-static",
54 "-readability-else-after-return",
Chih-Hung Hsieh715a6c42021-10-04 16:01:56 -070055 "-readability-identifier-length",
Chih-Hung Hsieh14d955f2021-02-11 11:52:15 -080056 "-readability-named-parameter",
57 "-readability-redundant-access-specifiers",
58 "-readability-uppercase-literal-suffix",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010059 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010060}
61
62cc_library {
63 name: "libidmap2",
64 defaults: [
65 "idmap2_defaults",
66 ],
67 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +020068 srcs: [
Winson62ac8b52019-12-04 08:36:48 -080069 "libidmap2/**/*.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +020070 ],
71 export_include_dirs: ["include"],
72 target: {
73 android: {
74 static: {
75 enabled: false,
76 },
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080077 static_libs: [
78 "libidmap2_protos",
79 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020080 shared_libs: [
81 "libandroidfw",
82 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010083 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080084 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080085 "libprotobuf-cpp-lite",
86 "libutils",
87 "libz",
88 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020089 ],
90 },
91 host: {
92 shared: {
93 enabled: false,
94 },
95 static_libs: [
96 "libandroidfw",
97 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -070098 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080099 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800100 "libidmap2_protos",
101 "libprotobuf-cpp-lite",
102 "libutils",
103 "libz",
104 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800105 ],
106 },
107 },
108}
109
110cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800111 name: "libidmap2_protos",
112 srcs: [
113 "libidmap2/proto/*.proto",
114 ],
115 host_supported: true,
116 proto: {
117 type: "lite",
118 export_proto_headers: true,
119 },
120}
121
122cc_library {
Winson62ac8b52019-12-04 08:36:48 -0800123 name: "libidmap2_policies",
124 defaults: [
125 "idmap2_defaults",
126 ],
127 host_supported: true,
128 export_include_dirs: ["libidmap2_policies/include"],
129 target: {
130 windows: {
131 enabled: true,
132 },
133 android: {
Winson62ac8b52019-12-04 08:36:48 -0800134 shared_libs: [
135 "libandroidfw",
136 ],
137 },
138 host: {
139 shared: {
140 enabled: false,
141 },
142 static_libs: [
143 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200144 ],
145 },
146 },
147}
148
149cc_test {
150 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100151 defaults: [
152 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200153 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100154 tidy_checks: [
155 "-readability-magic-numbers",
156 ],
157 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700158 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200159 srcs: [
160 "tests/BinaryStreamVisitorTests.cpp",
161 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800162 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200163 "tests/FileUtilsTests.cpp",
164 "tests/Idmap2BinaryTests.cpp",
165 "tests/IdmapTests.cpp",
166 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800167 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200168 "tests/PrettyPrintVisitorTests.cpp",
169 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700170 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200171 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100172 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700173 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200174 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800175 required: [
176 "idmap2",
177 ],
178 static_libs: [
179 "libgmock",
180 "libidmap2_protos",
181 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200182 target: {
183 android: {
184 shared_libs: [
185 "libandroidfw",
186 "libbase",
187 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800188 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200189 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800190 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200191 "libutils",
192 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800193 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200194 "libziparchive",
195 ],
196 },
197 host: {
198 static_libs: [
199 "libandroidfw",
200 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700201 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200202 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800203 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200204 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800205 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200206 "libutils",
207 "libziparchive",
208 ],
209 shared_libs: [
210 "libz",
211 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800212 data: [
213 ":libz",
214 ":idmap2",
215 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200216 },
217 },
Julien Desprez91e03302021-02-08 16:46:08 -0800218 data: [
219 "tests/data/**/*.apk",
220 ],
221 compile_multilib: "first",
222 test_options: {
223 unit_test: true,
224 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200225}
226
227cc_binary {
228 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100229 defaults: [
230 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200231 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100232 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200233 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700234 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200235 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800236 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200237 "idmap2/Dump.cpp",
238 "idmap2/Lookup.cpp",
239 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200240 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800241 static_libs: [
242 "libidmap2_protos",
243 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200244 target: {
245 android: {
246 shared_libs: [
247 "libandroidfw",
248 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100249 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200250 "libidmap2",
Winson62ac8b52019-12-04 08:36:48 -0800251 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800252 "libprotobuf-cpp-lite",
253 "libutils",
254 "libz",
255 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200256 ],
257 },
258 host: {
259 static_libs: [
260 "libandroidfw",
261 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700262 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200263 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800264 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200265 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800266 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200267 "libutils",
268 "libziparchive",
269 ],
270 shared_libs: [
271 "libz",
272 ],
273 },
274 },
Winson62ac8b52019-12-04 08:36:48 -0800275
Mårten Kongstad02751232018-04-27 13:16:32 +0200276}
277
278cc_binary {
279 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100280 defaults: [
281 "idmap2_defaults",
282 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200283 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200284 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200285 "idmap2d/Idmap2Service.cpp",
286 "idmap2d/Main.cpp",
287 ],
288 shared_libs: [
289 "libandroidfw",
290 "libbase",
291 "libbinder",
292 "libcutils",
293 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800294 "libidmap2_policies",
295 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200296 "libutils",
297 "libziparchive",
298 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100299 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800300 "libc++fs",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800301 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100302 "libidmap2daidl",
303 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200304 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200305}
306
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100307cc_library_static {
308 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100309 srcs: [
310 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800311 ":idmap2_core_aidl",
312 ],
313 header_libs: [
314 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100315 ],
316 shared_libs: [
317 "libbase",
318 ],
319 aidl: {
320 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800321 local_include_dirs: [
322 "idmap2d/aidl/core",
323 "idmap2d/aidl/services/",
324 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100325 },
326}
327
Mårten Kongstad02751232018-04-27 13:16:32 +0200328filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800329 name: "idmap2_core_aidl",
330 srcs: [
331 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
332 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
333 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
334 ],
335 path: "idmap2d/aidl/core/",
336}
337
338filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200339 name: "idmap2_aidl",
340 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800341 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200342 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800343 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200344}
Winson62ac8b52019-12-04 08:36:48 -0800345
346aidl_interface {
347 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900348 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800349 srcs: [":overlayable_policy_aidl_files"],
350}
351
352filegroup {
353 name: "overlayable_policy_aidl_files",
354 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800355 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800356 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800357 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800358}