| 1 |
// 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 |
|
| 15 |
package { |
| 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 |
|
| 24 |
cc_defaults { |
| 25 |
name: "idmap2_defaults", |
| 26 |
tidy: true, |
| 27 |
tidy_checks: [ |
| 28 |
"modernize-*", |
| 29 |
"-modernize-avoid-c-arrays", |
| 30 |
"-modernize-use-trailing-return-type", |
| 31 |
"android-*", |
| 32 |
"misc-*", |
| 33 |
"readability-*", |
| 34 |
], |
| 35 |
tidy_checks_as_errors: [ |
| 36 |
"modernize-*", |
| 37 |
"-modernize-avoid-c-arrays", |
| 38 |
"-modernize-concat-nested-namespaces", |
| 39 |
"-modernize-pass-by-value", |
| 40 |
"-modernize-replace-disallow-copy-and-assign-macro", |
| 41 |
"-modernize-return-braced-init-list", |
| 42 |
"-modernize-use-default-member-init", |
| 43 |
"-modernize-use-equals-default", |
| 44 |
"-modernize-use-emplace", |
| 45 |
"-modernize-use-nodiscard", |
| 46 |
"-modernize-use-override", |
| 47 |
"-modernize-use-trailing-return-type", |
| 48 |
"-modernize-use-using", |
| 49 |
"android-*", |
| 50 |
"misc-*", |
| 51 |
"-misc-non-private-member-variables-in-classes", |
| 52 |
"readability-*", |
| 53 |
"-readability-braces-around-statements", |
| 54 |
"-readability-const-return-type", |
| 55 |
"-readability-convert-member-functions-to-static", |
| 56 |
"-readability-duplicate-include", |
| 57 |
"-readability-else-after-return", |
| 58 |
"-readability-identifier-length", |
| 59 |
"-readability-named-parameter", |
| 60 |
"-readability-redundant-access-specifiers", |
| 61 |
"-readability-uppercase-literal-suffix", |
| 62 |
], |
| 63 |
} |
| 64 |
|
| 65 |
cc_library { |
| 66 |
name: "libidmap2", |
| 67 |
defaults: [ |
| 68 |
"idmap2_defaults", |
| 69 |
], |
| 70 |
host_supported: true, |
| 71 |
srcs: [ |
| 72 |
"libidmap2/**/*.cpp", |
| 73 |
], |
| 74 |
export_include_dirs: ["include"], |
| 75 |
target: { |
| 76 |
android: { |
| 77 |
static: { |
| 78 |
enabled: false, |
| 79 |
}, |
| 80 |
static_libs: [ |
| 81 |
"libidmap2_protos", |
| 82 |
], |
| 83 |
shared_libs: [ |
| 84 |
"libandroidfw", |
| 85 |
"libbase", |
| 86 |
"libcutils", |
| 87 |
"libidmap2_policies", |
| 88 |
"libprotobuf-cpp-lite", |
| 89 |
"libutils", |
| 90 |
"libz", |
| 91 |
"libziparchive", |
| 92 |
], |
| 93 |
}, |
| 94 |
host: { |
| 95 |
shared: { |
| 96 |
enabled: false, |
| 97 |
}, |
| 98 |
static_libs: [ |
| 99 |
"libandroidfw", |
| 100 |
"libbase", |
| 101 |
"libcutils", |
| 102 |
"libidmap2_policies", |
| 103 |
"libidmap2_protos", |
| 104 |
"libprotobuf-cpp-lite", |
| 105 |
"libutils", |
| 106 |
"libz", |
| 107 |
"libziparchive", |
| 108 |
], |
| 109 |
}, |
| 110 |
}, |
| 111 |
} |
| 112 |
|
| 113 |
cc_library { |
| 114 |
name: "libidmap2_protos", |
| 115 |
srcs: [ |
| 116 |
"libidmap2/proto/*.proto", |
| 117 |
], |
| 118 |
host_supported: true, |
| 119 |
proto: { |
| 120 |
type: "lite", |
| 121 |
export_proto_headers: true, |
| 122 |
}, |
| 123 |
} |
| 124 |
|
| 125 |
cc_library { |
| 126 |
name: "libidmap2_policies", |
| 127 |
defaults: [ |
| 128 |
"idmap2_defaults", |
| 129 |
], |
| 130 |
host_supported: true, |
| 131 |
export_include_dirs: ["libidmap2_policies/include"], |
| 132 |
target: { |
| 133 |
windows: { |
| 134 |
enabled: true, |
| 135 |
}, |
| 136 |
android: { |
| 137 |
shared_libs: [ |
| 138 |
"libandroidfw", |
| 139 |
], |
| 140 |
}, |
| 141 |
host: { |
| 142 |
shared: { |
| 143 |
enabled: false, |
| 144 |
}, |
| 145 |
static_libs: [ |
| 146 |
"libandroidfw", |
| 147 |
], |
| 148 |
}, |
| 149 |
}, |
| 150 |
} |
| 151 |
|
| 152 |
cc_test { |
| 153 |
name: "idmap2_tests", |
| 154 |
defaults: [ |
| 155 |
"idmap2_defaults", |
| 156 |
], |
| 157 |
tidy_checks: [ |
| 158 |
"-readability-magic-numbers", |
| 159 |
], |
| 160 |
host_supported: true, |
| 161 |
test_suites: ["general-tests"], |
| 162 |
srcs: [ |
| 163 |
"tests/BinaryStreamVisitorTests.cpp", |
| 164 |
"tests/CommandLineOptionsTests.cpp", |
| 165 |
"tests/FabricatedOverlayTests.cpp", |
| 166 |
"tests/FileUtilsTests.cpp", |
| 167 |
"tests/Idmap2BinaryTests.cpp", |
| 168 |
"tests/IdmapTests.cpp", |
| 169 |
"tests/Main.cpp", |
| 170 |
"tests/PoliciesTests.cpp", |
| 171 |
"tests/PrettyPrintVisitorTests.cpp", |
| 172 |
"tests/RawPrintVisitorTests.cpp", |
| 173 |
"tests/ResourceMappingTests.cpp", |
| 174 |
"tests/ResourceUtilsTests.cpp", |
| 175 |
"tests/ResultTests.cpp", |
| 176 |
"tests/XmlParserTests.cpp", |
| 177 |
], |
| 178 |
required: [ |
| 179 |
"idmap2", |
| 180 |
], |
| 181 |
static_libs: [ |
| 182 |
"libgmock", |
| 183 |
"libidmap2_protos", |
| 184 |
], |
| 185 |
target: { |
| 186 |
android: { |
| 187 |
shared_libs: [ |
| 188 |
"libandroidfw", |
| 189 |
"libbase", |
| 190 |
"libidmap2", |
| 191 |
"libidmap2_policies", |
| 192 |
"liblog", |
| 193 |
"libprotobuf-cpp-lite", |
| 194 |
"libutils", |
| 195 |
"libz", |
| 196 |
"libz", |
| 197 |
"libziparchive", |
| 198 |
], |
| 199 |
}, |
| 200 |
host: { |
| 201 |
static_libs: [ |
| 202 |
"libandroidfw", |
| 203 |
"libbase", |
| 204 |
"libcutils", |
| 205 |
"libidmap2", |
| 206 |
"libidmap2_policies", |
| 207 |
"liblog", |
| 208 |
"libprotobuf-cpp-lite", |
| 209 |
"libutils", |
| 210 |
"libziparchive", |
| 211 |
], |
| 212 |
shared_libs: [ |
| 213 |
"libz", |
| 214 |
], |
| 215 |
data: [ |
| 216 |
":libz", |
| 217 |
":idmap2", |
| 218 |
], |
| 219 |
}, |
| 220 |
}, |
| 221 |
data: [ |
| 222 |
"tests/data/**/*.apk", |
| 223 |
], |
| 224 |
compile_multilib: "first", |
| 225 |
test_options: { |
| 226 |
unit_test: true, |
| 227 |
}, |
| 228 |
} |
| 229 |
|
| 230 |
cc_binary { |
| 231 |
name: "idmap2", |
| 232 |
defaults: [ |
| 233 |
"idmap2_defaults", |
| 234 |
], |
| 235 |
host_supported: true, |
| 236 |
srcs: [ |
| 237 |
"idmap2/CommandUtils.cpp", |
| 238 |
"idmap2/Create.cpp", |
| 239 |
"idmap2/CreateMultiple.cpp", |
| 240 |
"idmap2/Dump.cpp", |
| 241 |
"idmap2/Lookup.cpp", |
| 242 |
"idmap2/Main.cpp", |
| 243 |
], |
| 244 |
static_libs: [ |
| 245 |
"libidmap2_protos", |
| 246 |
], |
| 247 |
target: { |
| 248 |
android: { |
| 249 |
shared_libs: [ |
| 250 |
"libandroidfw", |
| 251 |
"libbase", |
| 252 |
"libcutils", |
| 253 |
"libidmap2", |
| 254 |
"libidmap2_policies", |
| 255 |
"libprotobuf-cpp-lite", |
| 256 |
"libutils", |
| 257 |
"libz", |
| 258 |
"libziparchive", |
| 259 |
], |
| 260 |
}, |
| 261 |
host: { |
| 262 |
static_libs: [ |
| 263 |
"libandroidfw", |
| 264 |
"libbase", |
| 265 |
"libcutils", |
| 266 |
"libidmap2", |
| 267 |
"libidmap2_policies", |
| 268 |
"liblog", |
| 269 |
"libprotobuf-cpp-lite", |
| 270 |
"libutils", |
| 271 |
"libziparchive", |
| 272 |
], |
| 273 |
shared_libs: [ |
| 274 |
"libz", |
| 275 |
], |
| 276 |
}, |
| 277 |
}, |
| 278 |
|
| 279 |
} |
| 280 |
|
| 281 |
cc_binary { |
| 282 |
name: "idmap2d", |
| 283 |
defaults: [ |
| 284 |
"idmap2_defaults", |
| 285 |
], |
| 286 |
host_supported: false, |
| 287 |
srcs: [ |
| 288 |
"idmap2d/Idmap2Service.cpp", |
| 289 |
"idmap2d/Main.cpp", |
| 290 |
], |
| 291 |
shared_libs: [ |
| 292 |
"libandroidfw", |
| 293 |
"libbase", |
| 294 |
"libbinder", |
| 295 |
"libcutils", |
| 296 |
"libidmap2", |
| 297 |
"libidmap2_policies", |
| 298 |
"libprotobuf-cpp-lite", |
| 299 |
"libutils", |
| 300 |
"libziparchive", |
| 301 |
], |
| 302 |
static_libs: [ |
| 303 |
"libc++fs", |
| 304 |
"libidmap2_protos", |
| 305 |
"libidmap2daidl", |
| 306 |
], |
| 307 |
init_rc: ["idmap2d/idmap2d.rc"], |
| 308 |
} |
| 309 |
|
| 310 |
cc_library_static { |
| 311 |
name: "libidmap2daidl", |
| 312 |
srcs: [ |
| 313 |
":idmap2_aidl", |
| 314 |
":idmap2_core_aidl", |
| 315 |
], |
| 316 |
header_libs: [ |
| 317 |
"libbinder_headers", |
| 318 |
], |
| 319 |
shared_libs: [ |
| 320 |
"libbase", |
| 321 |
], |
| 322 |
aidl: { |
| 323 |
export_aidl_headers: true, |
| 324 |
local_include_dirs: [ |
| 325 |
"idmap2d/aidl/core", |
| 326 |
"idmap2d/aidl/services/", |
| 327 |
], |
| 328 |
}, |
| 329 |
} |
| 330 |
|
| 331 |
filegroup { |
| 332 |
name: "idmap2_core_aidl", |
| 333 |
srcs: [ |
| 334 |
"idmap2d/aidl/core/android/os/FabricatedOverlayInternal.aidl", |
| 335 |
"idmap2d/aidl/core/android/os/FabricatedOverlayInternalEntry.aidl", |
| 336 |
"idmap2d/aidl/core/android/os/FabricatedOverlayInfo.aidl", |
| 337 |
], |
| 338 |
path: "idmap2d/aidl/core/", |
| 339 |
} |
| 340 |
|
| 341 |
filegroup { |
| 342 |
name: "idmap2_aidl", |
| 343 |
srcs: [ |
| 344 |
"idmap2d/aidl/services/android/os/IIdmap2.aidl", |
| 345 |
], |
| 346 |
path: "idmap2d/aidl/services/", |
| 347 |
} |
| 348 |
|
| 349 |
aidl_interface { |
| 350 |
name: "overlayable_policy_aidl", |
| 351 |
unstable: true, |
| 352 |
srcs: [":overlayable_policy_aidl_files"], |
| 353 |
} |
| 354 |
|
| 355 |
filegroup { |
| 356 |
name: "overlayable_policy_aidl_files", |
| 357 |
srcs: [ |
| 358 |
"idmap2d/aidl/services/android/os/OverlayablePolicy.aidl", |
| 359 |
], |
| 360 |
path: "idmap2d/aidl/services/", |
| 361 |
} |