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