blob: 1176a1ea84d5e0dfe680c1a9f1c9cf7a34c91829 [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 },
68 shared_libs: [
69 "libandroidfw",
70 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010071 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +020072 "libutils",
73 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -080074 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +020075 ],
76 },
77 host: {
78 shared: {
79 enabled: false,
80 },
81 static_libs: [
82 "libandroidfw",
83 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -070084 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +020085 "libutils",
86 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -080087 "libidmap2_policies",
88 ],
89 },
90 },
91}
92
93cc_library {
94 name: "libidmap2_policies",
95 defaults: [
96 "idmap2_defaults",
97 ],
98 host_supported: true,
99 export_include_dirs: ["libidmap2_policies/include"],
100 target: {
101 windows: {
102 enabled: true,
103 },
104 android: {
105 static: {
106 enabled: false,
107 },
108 shared_libs: [
109 "libandroidfw",
110 ],
111 },
112 host: {
113 shared: {
114 enabled: false,
115 },
116 static_libs: [
117 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200118 ],
119 },
120 },
121}
122
123cc_test {
124 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100125 defaults: [
126 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200127 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100128 tidy_checks: [
129 "-readability-magic-numbers",
130 ],
131 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700132 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200133 srcs: [
134 "tests/BinaryStreamVisitorTests.cpp",
135 "tests/CommandLineOptionsTests.cpp",
136 "tests/FileUtilsTests.cpp",
137 "tests/Idmap2BinaryTests.cpp",
138 "tests/IdmapTests.cpp",
139 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800140 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200141 "tests/PrettyPrintVisitorTests.cpp",
142 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700143 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200144 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100145 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700146 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200147 "tests/ZipFileTests.cpp",
148 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200149 static_libs: ["libgmock"],
150 target: {
151 android: {
152 shared_libs: [
153 "libandroidfw",
154 "libbase",
155 "libidmap2",
156 "liblog",
157 "libutils",
158 "libz",
159 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800160 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200161 ],
162 },
163 host: {
164 static_libs: [
165 "libandroidfw",
166 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700167 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200168 "libidmap2",
169 "liblog",
170 "libutils",
171 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800172 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200173 ],
174 shared_libs: [
175 "libz",
176 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800177 data: [
178 ":libz",
179 ":idmap2",
180 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200181 },
182 },
Julien Desprez91e03302021-02-08 16:46:08 -0800183 data: [
184 "tests/data/**/*.apk",
185 ],
186 compile_multilib: "first",
187 test_options: {
188 unit_test: true,
189 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200190}
191
192cc_binary {
193 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100194 defaults: [
195 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200196 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100197 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200198 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700199 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200200 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800201 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200202 "idmap2/Dump.cpp",
203 "idmap2/Lookup.cpp",
204 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200205 ],
206 target: {
207 android: {
208 shared_libs: [
209 "libandroidfw",
210 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100211 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200212 "libidmap2",
213 "libutils",
214 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800215 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200216 ],
217 },
218 host: {
219 static_libs: [
220 "libandroidfw",
221 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700222 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200223 "libidmap2",
224 "liblog",
225 "libutils",
226 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800227 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200228 ],
229 shared_libs: [
230 "libz",
231 ],
232 },
233 },
Winson62ac8b52019-12-04 08:36:48 -0800234
Mårten Kongstad02751232018-04-27 13:16:32 +0200235}
236
237cc_binary {
238 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100239 defaults: [
240 "idmap2_defaults",
241 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200242 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200243 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200244 "idmap2d/Idmap2Service.cpp",
245 "idmap2d/Main.cpp",
246 ],
247 shared_libs: [
248 "libandroidfw",
249 "libbase",
250 "libbinder",
251 "libcutils",
252 "libidmap2",
253 "libutils",
254 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800255 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200256 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100257 static_libs: [
258 "libidmap2daidl",
259 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200260 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200261}
262
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100263cc_library_static {
264 name: "libidmap2daidl",
265 defaults: [
266 "idmap2_defaults",
267 ],
268 tidy: false,
269 host_supported: false,
270 srcs: [
271 ":idmap2_aidl",
272 ],
273 shared_libs: [
274 "libbase",
275 ],
276 aidl: {
277 export_aidl_headers: true,
278 },
279}
280
Mårten Kongstad02751232018-04-27 13:16:32 +0200281filegroup {
282 name: "idmap2_aidl",
283 srcs: [
284 "idmap2d/aidl/android/os/IIdmap2.aidl",
285 ],
Dan Willemsend1a5aa62019-06-08 08:42:07 -0700286 path: "idmap2d/aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200287}
Winson62ac8b52019-12-04 08:36:48 -0800288
289aidl_interface {
290 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900291 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800292 srcs: [":overlayable_policy_aidl_files"],
293}
294
295filegroup {
296 name: "overlayable_policy_aidl_files",
297 srcs: [
298 "idmap2d/aidl/android/os/OverlayablePolicy.aidl",
299 ],
300 path: "idmap2d/aidl",
301}