blob: 3bad889f1715f320f58d3f29c39e3bdcd2ab4ce2 [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",
Yi Kongfbafa512019-07-27 14:43:50 -070029 "-modernize-use-trailing-return-type",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010030 "android-*",
31 "misc-*",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010032 "readability-*",
33 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020034 tidy_flags: [
35 "-system-headers",
Mårten Kongstad02751232018-04-27 13:16:32 +020036 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010037}
38
39cc_library {
40 name: "libidmap2",
41 defaults: [
42 "idmap2_defaults",
43 ],
44 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +020045 srcs: [
Winson62ac8b52019-12-04 08:36:48 -080046 "libidmap2/**/*.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +020047 ],
48 export_include_dirs: ["include"],
49 target: {
50 android: {
51 static: {
52 enabled: false,
53 },
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080054 static_libs: [
55 "libidmap2_protos",
56 ],
Mårten Kongstad02751232018-04-27 13:16:32 +020057 shared_libs: [
58 "libandroidfw",
59 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010060 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080061 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080062 "libprotobuf-cpp-lite",
63 "libutils",
64 "libz",
65 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +020066 ],
67 },
68 host: {
69 shared: {
70 enabled: false,
71 },
72 static_libs: [
73 "libandroidfw",
74 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -070075 "libcutils",
Winson62ac8b52019-12-04 08:36:48 -080076 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080077 "libidmap2_protos",
78 "libprotobuf-cpp-lite",
79 "libutils",
80 "libz",
81 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -080082 ],
83 },
84 },
85}
86
87cc_library {
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -080088 name: "libidmap2_protos",
89 srcs: [
90 "libidmap2/proto/*.proto",
91 ],
92 host_supported: true,
93 proto: {
94 type: "lite",
95 export_proto_headers: true,
96 },
97}
98
99cc_library {
Winson62ac8b52019-12-04 08:36:48 -0800100 name: "libidmap2_policies",
101 defaults: [
102 "idmap2_defaults",
103 ],
104 host_supported: true,
105 export_include_dirs: ["libidmap2_policies/include"],
106 target: {
107 windows: {
108 enabled: true,
109 },
110 android: {
Winson62ac8b52019-12-04 08:36:48 -0800111 shared_libs: [
112 "libandroidfw",
113 ],
114 },
115 host: {
116 shared: {
117 enabled: false,
118 },
119 static_libs: [
120 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200121 ],
122 },
123 },
124}
125
126cc_test {
127 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100128 defaults: [
129 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200130 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100131 tidy_checks: [
132 "-readability-magic-numbers",
133 ],
134 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700135 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200136 srcs: [
137 "tests/BinaryStreamVisitorTests.cpp",
138 "tests/CommandLineOptionsTests.cpp",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800139 "tests/FabricatedOverlayTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200140 "tests/FileUtilsTests.cpp",
141 "tests/Idmap2BinaryTests.cpp",
142 "tests/IdmapTests.cpp",
143 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800144 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200145 "tests/PrettyPrintVisitorTests.cpp",
146 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700147 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200148 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100149 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700150 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200151 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800152 required: [
153 "idmap2",
154 ],
155 static_libs: [
156 "libgmock",
157 "libidmap2_protos",
158 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200159 target: {
160 android: {
161 shared_libs: [
162 "libandroidfw",
163 "libbase",
164 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800165 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200166 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800167 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200168 "libutils",
169 "libz",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800170 "libz",
Mårten Kongstad02751232018-04-27 13:16:32 +0200171 "libziparchive",
172 ],
173 },
174 host: {
175 static_libs: [
176 "libandroidfw",
177 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700178 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200179 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800180 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200181 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800182 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200183 "libutils",
184 "libziparchive",
185 ],
186 shared_libs: [
187 "libz",
188 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800189 data: [
190 ":libz",
191 ":idmap2",
192 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200193 },
194 },
Julien Desprez91e03302021-02-08 16:46:08 -0800195 data: [
196 "tests/data/**/*.apk",
197 ],
198 compile_multilib: "first",
199 test_options: {
200 unit_test: true,
201 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200202}
203
204cc_binary {
205 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100206 defaults: [
207 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200208 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100209 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200210 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700211 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200212 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800213 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200214 "idmap2/Dump.cpp",
215 "idmap2/Lookup.cpp",
216 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200217 ],
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800218 static_libs: [
219 "libidmap2_protos",
220 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200221 target: {
222 android: {
223 shared_libs: [
224 "libandroidfw",
225 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100226 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200227 "libidmap2",
Winson62ac8b52019-12-04 08:36:48 -0800228 "libidmap2_policies",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800229 "libprotobuf-cpp-lite",
230 "libutils",
231 "libz",
232 "libziparchive",
Mårten Kongstad02751232018-04-27 13:16:32 +0200233 ],
234 },
235 host: {
236 static_libs: [
237 "libandroidfw",
238 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700239 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200240 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800241 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200242 "liblog",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800243 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200244 "libutils",
245 "libziparchive",
246 ],
247 shared_libs: [
248 "libz",
249 ],
250 },
251 },
Winson62ac8b52019-12-04 08:36:48 -0800252
Mårten Kongstad02751232018-04-27 13:16:32 +0200253}
254
255cc_binary {
256 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100257 defaults: [
258 "idmap2_defaults",
259 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200260 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200261 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200262 "idmap2d/Idmap2Service.cpp",
263 "idmap2d/Main.cpp",
264 ],
265 shared_libs: [
266 "libandroidfw",
267 "libbase",
268 "libbinder",
269 "libcutils",
270 "libidmap2",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800271 "libidmap2_policies",
272 "libprotobuf-cpp-lite",
Mårten Kongstad02751232018-04-27 13:16:32 +0200273 "libutils",
274 "libziparchive",
275 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100276 static_libs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800277 "libc++fs",
Ryan Mitchell2ed8bfa2021-01-08 13:34:28 -0800278 "libidmap2_protos",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100279 "libidmap2daidl",
280 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200281 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200282}
283
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100284cc_library_static {
285 name: "libidmap2daidl",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100286 srcs: [
287 ":idmap2_aidl",
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800288 ":idmap2_core_aidl",
289 ],
290 header_libs: [
291 "libbinder_headers",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100292 ],
293 shared_libs: [
294 "libbase",
295 ],
296 aidl: {
297 export_aidl_headers: true,
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800298 local_include_dirs: [
299 "idmap2d/aidl/core",
300 "idmap2d/aidl/services/",
301 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100302 },
303}
304
Mårten Kongstad02751232018-04-27 13:16:32 +0200305filegroup {
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800306 name: "idmap2_core_aidl",
307 srcs: [
308 "idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl",
309 "idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl",
310 "idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl",
311 ],
312 path: "idmap2d/aidl/core/",
313}
314
315filegroup {
Mårten Kongstad02751232018-04-27 13:16:32 +0200316 name: "idmap2_aidl",
317 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800318 "idmap2d/aidl/services/android/os/IIdmap2.aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200319 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800320 path: "idmap2d/aidl/services/",
Mårten Kongstad02751232018-04-27 13:16:32 +0200321}
Winson62ac8b52019-12-04 08:36:48 -0800322
323aidl_interface {
324 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900325 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800326 srcs: [":overlayable_policy_aidl_files"],
327}
328
329filegroup {
330 name: "overlayable_policy_aidl_files",
331 srcs: [
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800332 "idmap2d/aidl/services/android/os/OverlayablePolicy.aidl",
Winson62ac8b52019-12-04 08:36:48 -0800333 ],
Ryan Mitchell6a2ca782021-01-19 13:51:15 -0800334 path: "idmap2d/aidl/services/",
Winson62ac8b52019-12-04 08:36:48 -0800335}