blob: 43729f4c810a87536747b44ae657820b84b56c2f [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 },
77 shared_libs: [
78 "libandroidfw",
79 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +010080 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +020081 "libutils",
82 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -080083 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +020084 ],
85 },
86 host: {
87 shared: {
88 enabled: false,
89 },
90 static_libs: [
91 "libandroidfw",
92 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -070093 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +020094 "libutils",
95 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -080096 "libidmap2_policies",
97 ],
98 },
99 },
100}
101
102cc_library {
103 name: "libidmap2_policies",
104 defaults: [
105 "idmap2_defaults",
106 ],
107 host_supported: true,
108 export_include_dirs: ["libidmap2_policies/include"],
109 target: {
110 windows: {
111 enabled: true,
112 },
113 android: {
114 static: {
115 enabled: false,
116 },
117 shared_libs: [
118 "libandroidfw",
119 ],
120 },
121 host: {
122 shared: {
123 enabled: false,
124 },
125 static_libs: [
126 "libandroidfw",
Mårten Kongstad02751232018-04-27 13:16:32 +0200127 ],
128 },
129 },
130}
131
132cc_test {
133 name: "idmap2_tests",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100134 defaults: [
135 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200136 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100137 tidy_checks: [
138 "-readability-magic-numbers",
139 ],
140 host_supported: true,
Ryan Mitchellbcc179a2019-03-29 14:55:51 -0700141 test_suites: ["general-tests"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200142 srcs: [
143 "tests/BinaryStreamVisitorTests.cpp",
144 "tests/CommandLineOptionsTests.cpp",
145 "tests/FileUtilsTests.cpp",
146 "tests/Idmap2BinaryTests.cpp",
147 "tests/IdmapTests.cpp",
148 "tests/Main.cpp",
Mårten Kongstadd10d06d2019-01-07 17:26:25 -0800149 "tests/PoliciesTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200150 "tests/PrettyPrintVisitorTests.cpp",
151 "tests/RawPrintVisitorTests.cpp",
Ryan Mitchell9e4f52b2019-09-19 12:15:52 -0700152 "tests/ResourceMappingTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200153 "tests/ResourceUtilsTests.cpp",
Mårten Kongstad1e99b172019-01-28 08:49:12 +0100154 "tests/ResultTests.cpp",
Ryan Mitchellcd965a32019-09-18 14:52:45 -0700155 "tests/XmlParserTests.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200156 "tests/ZipFileTests.cpp",
157 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200158 static_libs: ["libgmock"],
159 target: {
160 android: {
161 shared_libs: [
162 "libandroidfw",
163 "libbase",
164 "libidmap2",
165 "liblog",
166 "libutils",
167 "libz",
168 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800169 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200170 ],
171 },
172 host: {
173 static_libs: [
174 "libandroidfw",
175 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700176 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200177 "libidmap2",
178 "liblog",
179 "libutils",
180 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800181 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200182 ],
183 shared_libs: [
184 "libz",
185 ],
Julien Desprez91e03302021-02-08 16:46:08 -0800186 data: [
187 ":libz",
188 ":idmap2",
189 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200190 },
191 },
Julien Desprez91e03302021-02-08 16:46:08 -0800192 data: [
193 "tests/data/**/*.apk",
194 ],
195 compile_multilib: "first",
196 test_options: {
197 unit_test: true,
198 },
Mårten Kongstad02751232018-04-27 13:16:32 +0200199}
200
201cc_binary {
202 name: "idmap2",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100203 defaults: [
204 "idmap2_defaults",
Mårten Kongstad02751232018-04-27 13:16:32 +0200205 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100206 host_supported: true,
Mårten Kongstad02751232018-04-27 13:16:32 +0200207 srcs: [
Ryan Mitchella7070132020-05-13 14:17:52 -0700208 "idmap2/CommandUtils.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200209 "idmap2/Create.cpp",
Ryan Mitchell9b939422020-02-04 10:18:53 -0800210 "idmap2/CreateMultiple.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200211 "idmap2/Dump.cpp",
212 "idmap2/Lookup.cpp",
213 "idmap2/Main.cpp",
Mårten Kongstad02751232018-04-27 13:16:32 +0200214 ],
215 target: {
216 android: {
217 shared_libs: [
218 "libandroidfw",
219 "libbase",
Mårten Kongstad4cbb0072018-11-30 16:22:05 +0100220 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200221 "libidmap2",
222 "libutils",
223 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800224 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200225 ],
226 },
227 host: {
228 static_libs: [
229 "libandroidfw",
230 "libbase",
Steven Moreland598bda82019-09-18 12:58:11 -0700231 "libcutils",
Mårten Kongstad02751232018-04-27 13:16:32 +0200232 "libidmap2",
233 "liblog",
234 "libutils",
235 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800236 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200237 ],
238 shared_libs: [
239 "libz",
240 ],
241 },
242 },
Winson62ac8b52019-12-04 08:36:48 -0800243
Mårten Kongstad02751232018-04-27 13:16:32 +0200244}
245
246cc_binary {
247 name: "idmap2d",
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100248 defaults: [
249 "idmap2_defaults",
250 ],
Mårten Kongstad02751232018-04-27 13:16:32 +0200251 host_supported: false,
Mårten Kongstad02751232018-04-27 13:16:32 +0200252 srcs: [
Mårten Kongstad02751232018-04-27 13:16:32 +0200253 "idmap2d/Idmap2Service.cpp",
254 "idmap2d/Main.cpp",
255 ],
256 shared_libs: [
257 "libandroidfw",
258 "libbase",
259 "libbinder",
260 "libcutils",
261 "libidmap2",
262 "libutils",
263 "libziparchive",
Winson62ac8b52019-12-04 08:36:48 -0800264 "libidmap2_policies",
Mårten Kongstad02751232018-04-27 13:16:32 +0200265 ],
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100266 static_libs: [
267 "libidmap2daidl",
268 ],
Mårten Kongstadb87b50722018-09-21 09:58:10 +0200269 init_rc: ["idmap2d/idmap2d.rc"],
Mårten Kongstad02751232018-04-27 13:16:32 +0200270}
271
Mårten Kongstad3c9bc612018-11-19 08:26:16 +0100272cc_library_static {
273 name: "libidmap2daidl",
274 defaults: [
275 "idmap2_defaults",
276 ],
277 tidy: false,
278 host_supported: false,
279 srcs: [
280 ":idmap2_aidl",
281 ],
282 shared_libs: [
283 "libbase",
284 ],
285 aidl: {
286 export_aidl_headers: true,
287 },
288}
289
Mårten Kongstad02751232018-04-27 13:16:32 +0200290filegroup {
291 name: "idmap2_aidl",
292 srcs: [
293 "idmap2d/aidl/android/os/IIdmap2.aidl",
294 ],
Dan Willemsend1a5aa62019-06-08 08:42:07 -0700295 path: "idmap2d/aidl",
Mårten Kongstad02751232018-04-27 13:16:32 +0200296}
Winson62ac8b52019-12-04 08:36:48 -0800297
298aidl_interface {
299 name: "overlayable_policy_aidl",
Jiyong Parkdb589dd2020-04-13 12:55:24 +0900300 unstable: true,
Winson62ac8b52019-12-04 08:36:48 -0800301 srcs: [":overlayable_policy_aidl_files"],
302}
303
304filegroup {
305 name: "overlayable_policy_aidl_files",
306 srcs: [
307 "idmap2d/aidl/android/os/OverlayablePolicy.aidl",
308 ],
309 path: "idmap2d/aidl",
310}