blob: aad5d23f854699c165277a88bb9b4dcd7c08ddc3 [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 Kongstad02751232018-04-27 13:16:32 +020059 tidy_flags: [
60 "-system-headers",
Mårten Kongstad02751232018-04-27 13:16:32 +020061 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +010062}
63
64cc_library {
65 name: "libidmap2",
66 defaults: [
67 "idmap2_defaults",
68 ],
69 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +020070 srcs: [
Winson62ac8b52019-12-04 08:36:48 -080071 "libidmap2/**/*.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +020072 ],
73 export_include_dirs: ["include"],
74 target: {
75 android: {
76 static: {
77 enabled: false,
78 },
79 shared_libs: [
80 "libandroidfw",
81 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010082 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +020083 "libutils",
84 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -080085 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +020086 ],
87 },
88 host: {
89 shared: {
90 enabled: false,
91 },
92 static_libs: [
93 "libandroidfw",
94 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -070095 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +020096 "libutils",
97 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -080098 "libidmap2_policies",
99 ],
100 },
101 },
102}
103
104cc_library {
105 name: "libidmap2_policies",
106 defaults: [
107 "idmap2_defaults",
108 ],
109 host_supported: true,
110 export_include_dirs: ["libidmap2_policies/include"],
111 target: {
112 windows: {
113 enabled: true,
114 },
115 android: {
116 static: {
117 enabled: false,
118 },
119 shared_libs: [
120 "libandroidfw",
121 ],
122 },
123 host: {
124 shared: {
125 enabled: false,
126 },
127 static_libs: [
128 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200129 ],
130 },
131 },
132}
133
134cc_test {
135 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100136 defaults: [
137 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200138 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100139 tidy_checks: [
140 "-readability-magic-numbers",
141 ],
142 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700143 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200144 srcs: [
145 "tests/BinaryStreamVisitorTests.cpp",
146 "tests/CommandLineOptionsTests.cpp",
147 "tests/FileUtilsTests.cpp",
148 "tests/Idmap2BinaryTests.cpp",
149 "tests/IdmapTests.cpp",
150 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800151 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200152 "tests/PrettyPrintVisitorTests.cpp",
153 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700154 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200155 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100156 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700157 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200158 "tests/ZipFileTests.cpp",
159 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200160 static_libs: ["libgmock"],
161 target: {
162 android: {
163 shared_libs: [
164 "libandroidfw",
165 "libbase",
166 "libidmap2",
167 "liblog",
168 "libutils",
169 "libz",
170 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800171 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200172 ],
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",
180 "liblog",
181 "libutils",
182 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800183 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200184 ],
185 shared_libs: [
186 "libz",
187 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800188 data: [
189 ":libz",
190 ":idmap2",
191 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200192 },
193 },
Julien Desprez91e03302021-02-08 16:46:08 -0800194 data: [
195 "tests/data/**/*.apk",
196 ],
197 compile_multilib: "first",
198 test_options: {
199 unit_test: true,
200 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200201}
202
203cc_binary {
204 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100205 defaults: [
206 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200207 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100208 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200209 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700210 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200211 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800212 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200213 "idmap2/Dump.cpp",
214 "idmap2/Lookup.cpp",
215 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200216 ],
217 target: {
218 android: {
219 shared_libs: [
220 "libandroidfw",
221 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100222 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200223 "libidmap2",
224 "libutils",
225 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800226 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200227 ],
228 },
229 host: {
230 static_libs: [
231 "libandroidfw",
232 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700233 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200234 "libidmap2",
235 "liblog",
236 "libutils",
237 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800238 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200239 ],
240 shared_libs: [
241 "libz",
242 ],
243 },
244 },
Winson62ac8b52019-12-04 08:36:48 -0800245
Mårten Kongstad02751232018-04-27 13:16:32 +0200246}
247
248cc_binary {
249 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100250 defaults: [
251 "idmap2_defaults",
252 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200253 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200254 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200255 "idmap2d/Idmap2Service.cpp",
256 "idmap2d/Main.cpp",
257 ],
258 shared_libs: [
259 "libandroidfw",
260 "libbase",
261 "libbinder",
262 "libcutils",
263 "libidmap2",
264 "libutils",
265 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800266 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200267 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100268 static_libs: [
269 "libidmap2daidl",
270 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200271 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200272}
273
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100274cc_library_static {
275 name: "libidmap2daidl",
276 defaults: [
277 "idmap2_defaults",
278 ],
279 tidy: false,
280 host_supported: false,
281 srcs: [
282 ":idmap2_aidl",
283 ],
284 shared_libs: [
285 "libbase",
286 ],
287 aidl: {
288 export_aidl_headers: true,
289 },
290}
291
Mårten Kongstad02751232018-04-27 13:16:32 +0200292filegroup {
293 name: "idmap2_aidl",
294 srcs: [
295 "idmap2d/aidl/android/os/IIdmap2.aidl",
296 ],
Dan Willemsend1a5aa62019-06-08 08:42:07 -0700297 path: "idmap2d/aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200298}
Winson62ac8b52019-12-04 08:36:48 -0800299
300aidl_interface {
301 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900302 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800303 srcs: [":overlayable_policy_aidl_files"],
304}
305
306filegroup {
307 name: "overlayable_policy_aidl_files",
308 srcs: [
309 "idmap2d/aidl/android/os/OverlayablePolicy.aidl",
310 ],
311 path: "idmap2d/aidl",
312}