blob: 5370dc360be636540f76cef3dbcf8846dc734c5c [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",
55 "-readability-named-parameter",
56 "-readability-redundant-access-specifiers",
57 "-readability-uppercase-literal-suffix",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010058 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010059}
60
61cc_library {
62 name: "libidmap2",
63 defaults: [
64 "idmap2_defaults",
65 ],
66 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +020067 srcs: [
Winson62ac8b52019-12-04 08:36:48 -080068 "libidmap2/**/*.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +020069 ],
70 export_include_dirs: ["include"],
71 target: {
72 android: {
73 static: {
74 enabled: false,
75 },
76 shared_libs: [
77 "libandroidfw",
78 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010079 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +020080 "libutils",
81 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -080082 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +020083 ],
84 },
85 host: {
86 shared: {
87 enabled: false,
88 },
89 static_libs: [
90 "libandroidfw",
91 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -070092 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +020093 "libutils",
94 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -080095 "libidmap2_policies",
96 ],
97 },
98 },
99}
100
101cc_library {
102 name: "libidmap2_policies",
103 defaults: [
104 "idmap2_defaults",
105 ],
106 host_supported: true,
107 export_include_dirs: ["libidmap2_policies/include"],
108 target: {
109 windows: {
110 enabled: true,
111 },
112 android: {
113 static: {
114 enabled: false,
115 },
116 shared_libs: [
117 "libandroidfw",
118 ],
119 },
120 host: {
121 shared: {
122 enabled: false,
123 },
124 static_libs: [
125 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200126 ],
127 },
128 },
129}
130
131cc_test {
132 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100133 defaults: [
134 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200135 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100136 tidy_checks: [
137 "-readability-magic-numbers",
138 ],
139 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700140 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200141 srcs: [
142 "tests/BinaryStreamVisitorTests.cpp",
143 "tests/CommandLineOptionsTests.cpp",
144 "tests/FileUtilsTests.cpp",
145 "tests/Idmap2BinaryTests.cpp",
146 "tests/IdmapTests.cpp",
147 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800148 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200149 "tests/PrettyPrintVisitorTests.cpp",
150 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700151 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200152 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100153 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700154 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200155 "tests/ZipFileTests.cpp",
156 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200157 static_libs: ["libgmock"],
158 target: {
159 android: {
160 shared_libs: [
161 "libandroidfw",
162 "libbase",
163 "libidmap2",
164 "liblog",
165 "libutils",
166 "libz",
167 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800168 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200169 ],
170 },
171 host: {
172 static_libs: [
173 "libandroidfw",
174 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700175 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200176 "libidmap2",
177 "liblog",
178 "libutils",
179 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800180 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200181 ],
182 shared_libs: [
183 "libz",
184 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800185 data: [
186 ":libz",
187 ":idmap2",
188 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200189 },
190 },
Julien Desprez91e03302021-02-08 16:46:08 -0800191 data: [
192 "tests/data/**/*.apk",
193 ],
194 compile_multilib: "first",
195 test_options: {
196 unit_test: true,
197 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200198}
199
200cc_binary {
201 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100202 defaults: [
203 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200204 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100205 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200206 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700207 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200208 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800209 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200210 "idmap2/Dump.cpp",
211 "idmap2/Lookup.cpp",
212 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200213 ],
214 target: {
215 android: {
216 shared_libs: [
217 "libandroidfw",
218 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100219 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200220 "libidmap2",
221 "libutils",
222 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800223 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200224 ],
225 },
226 host: {
227 static_libs: [
228 "libandroidfw",
229 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700230 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200231 "libidmap2",
232 "liblog",
233 "libutils",
234 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800235 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200236 ],
237 shared_libs: [
238 "libz",
239 ],
240 },
241 },
Winson62ac8b52019-12-04 08:36:48 -0800242
Mårten Kongstad02751232018-04-27 13:16:32 +0200243}
244
245cc_binary {
246 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100247 defaults: [
248 "idmap2_defaults",
249 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200250 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200251 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200252 "idmap2d/Idmap2Service.cpp",
253 "idmap2d/Main.cpp",
254 ],
255 shared_libs: [
256 "libandroidfw",
257 "libbase",
258 "libbinder",
259 "libcutils",
260 "libidmap2",
261 "libutils",
262 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800263 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200264 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100265 static_libs: [
266 "libidmap2daidl",
267 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200268 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200269}
270
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100271cc_library_static {
272 name: "libidmap2daidl",
273 defaults: [
274 "idmap2_defaults",
275 ],
276 tidy: false,
277 host_supported: false,
278 srcs: [
279 ":idmap2_aidl",
280 ],
281 shared_libs: [
282 "libbase",
283 ],
284 aidl: {
285 export_aidl_headers: true,
286 },
287}
288
Mårten Kongstad02751232018-04-27 13:16:32 +0200289filegroup {
290 name: "idmap2_aidl",
291 srcs: [
292 "idmap2d/aidl/android/os/IIdmap2.aidl",
293 ],
Dan Willemsend1a5aa62019-06-08 08:42:07 -0700294 path: "idmap2d/aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200295}
Winson62ac8b52019-12-04 08:36:48 -0800296
297aidl_interface {
298 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900299 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800300 srcs: [":overlayable_policy_aidl_files"],
301}
302
303filegroup {
304 name: "overlayable_policy_aidl_files",
305 srcs: [
306 "idmap2d/aidl/android/os/OverlayablePolicy.aidl",
307 ],
308 path: "idmap2d/aidl",
309}