1// Copyright (C) 2007 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// 16// Definitions for building the Android core library and associated tests. 17// 18 19// The Android core library provides low-level APIs for use by the rest of the 20// Android software stack. It is made up of various parts, some of which can be 21// found in libcore/ and other parts that can be found in various external/ 22// directories. 23// 24// libcore has some sub-directories that follow a common structure: 25// e.g. dalvik, dom, harmony-tests, json, jsr166-tests, luni, libart, ojluni, 26// support, xml, xmlpull. 27// 28// The structure of these is generally: 29// 30// src/ 31// main/ # To be shipped on every device. 32// java/ # Java source for library code. 33// native/ # C/C++ source for library code. 34// resources/ # Support files. 35// test/ # Built only on demand, for testing. 36// java/ # Java source for tests. 37// native/ # C/C++ source for tests (rare). 38// resources/ # Support files. 39// 40// All subdirectories are optional. 41 42build = [ 43 "openjdk_java_files.bp", 44 "non_openjdk_java_files.bp", 45] 46 47// The Java files and their associated resources. 48filegroup { 49 name: "core-luni-resources", 50 visibility: [ 51 "//libcore:__subpackages__", 52 ], 53 path: "luni/src/main/java/", 54 srcs: [ 55 "luni/src/main/java/java/util/logging/logging.properties", 56 "luni/src/main/java/java/security/security.properties", 57 ], 58} 59 60filegroup { 61 name: "core-ojluni-resources", 62 visibility: [ 63 "//libcore:__subpackages__", 64 ], 65 path: "ojluni/src/main/resources/", 66 srcs: [ 67 "ojluni/src/main/resources/**/*", 68 ], 69} 70 71core_resources = [ 72 ":core-luni-resources", 73 ":core-ojluni-resources", 74] 75 76// The source files that go into core-oj. 77filegroup { 78 name: "core_oj_java_files", 79 visibility: [ 80 "//libcore:__subpackages__", 81 ], 82 srcs: [":openjdk_java_files"], 83} 84 85// http://b/129765390, http://b/188966706 86// Rewrite links to "platform" or "technotes" folders which are siblings 87// (and thus outside of) {@docRoot}. 88// 89// We have to escape \ as \\ and $ as $$ here because they get resolved by 90// different layers of the build tooling. The arguments are wrapped in '' so 91// that the shell doesn't add yet another level of escaping. 92rewrite_openjdk_doc_links = "sed -E 's" + 93 "!(\\{@docRoot\\}/\\.\\./|[./]+)((platform|technotes).+)\">" + 94 "!https://docs.oracle.com/javase/8/docs/\\2\">!' " + 95 "$(in) " + 96 "| sed -E 's" + // Android doesn't have java.base in the API docs 97 "!(\\{@docRoot\\}/)(java\\.base/)(.+)\">" + 98 "!\\1reference/\\3\">!' " + 99 "| sed -E 's" + 100 "!(\\{@docRoot\\}/\\.\\./)(specs/.+)\">" + 101 "!https://docs.oracle.com/en/java/javase/17/docs/\\2\">!' " + 102 " > $(out) " + 103 "&& ! grep '{@docRoot}/../' $(out)" // exit with 1 if "{@docRoot}/../" still exists. 104 105// OpenJDK source is not annotated with @hide so we need this separate 106// filegroup for just the parts that contribute to the API. 107gensrcs { 108 name: "core_oj_api_files", 109 cmd: rewrite_openjdk_doc_links, 110 srcs: [":openjdk_javadoc_files"], 111 output_extension: "java", 112} 113 114// The source files that go into core-libart.l 115filegroup { 116 name: "core_libart_java_files", 117 visibility: [ 118 "//libcore:__subpackages__", 119 ], 120 srcs: [ 121 ":non_openjdk_java_files", 122 ], 123} 124 125// Some parts of libart are not annotated with @hide so we need this separate 126// filegroup for just the parts that contribute to the API. 127filegroup { 128 name: "core_libart_api_files", 129 srcs: [ 130 ":non_openjdk_javadoc_files", 131 ], 132} 133 134// The set of files for the ART module that contribute to one or more API 135// surfaces. This includes files that are in the public API as well as those 136// that are not but which have been marked up with @hide plus one or more of 137// the API defining annotations. 138// 139// Some source files in :core_oj_api_files and :openjdk_mmodule_extra_files are 140// annotated by applying annotations to the .annotated.java stubs files in 141// ojluni/annotated/mmodules and rather than in the original source. See the comments 142// in openjdk_java_files.bp for more details. 143filegroup { 144 name: "art_module_api_files", 145 visibility: [ 146 "//libcore:__subpackages__", 147 ], 148 srcs: [ 149 ":apache-xml_api_files", 150 ":bouncycastle_java_files", 151 ":core_oj_api_files", 152 ":core_libart_api_files", 153 ":okhttp_api_files", 154 ":openjdk_mmodule_extra_files", 155 ], 156} 157 158java_defaults { 159 name: "libcore_java_defaults", 160 visibility: [ 161 "//libcore:__subpackages__", 162 ], 163 javacflags: [ 164 //"-Xlint:all", 165 //"-Xlint:-serial,-deprecation,-unchecked", 166 ], 167 dxflags: [ 168 "--android-platform-build", 169 "--core-library", 170 ], 171 errorprone: { 172 javacflags: [ 173 "-Xep:MissingOverride:OFF", // Ignore missing @Override. 174 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom 175 "-Xep:UnicodeInCode:WARN", // XML parser uses line feeds in whitespace 176 "-Xep:ReturnValueIgnored:WARN", 177 "-Xep:HashtableContains:WARN", 178 "-Xep:ComparableType:WARN", 179 "-Xep:IdentityBinaryExpression:WARN", 180 "-Xep:BoxedPrimitiveEquality:WARN", 181 "-Xep:EmptyTopLevelDeclaration:WARN", 182 "-Xep:GetClassOnClass:WARN", 183 "-Xep:NullableOnContainingClass:WARN", 184 "-Xep:GetClassOnAnnotation:WARN", 185 ], 186 }, 187 lint: { 188 warning_checks: [ 189 "SuspiciousIndentation", 190 "NewApi", 191 ], 192 }, 193 min_sdk_version: "31", 194} 195 196// 197// Build for the target (device). 198// 199 200// A target used to bootstrap compilation for the core library. 201// 202// See core-all-system-modules for more details. 203java_library { 204 name: "core-all", 205 defaults: ["libcore_java_defaults"], 206 207 srcs: [ 208 // Use the source code for the I18N module intra core API as using the 209 // compiled version does not work due to limitations in either soong or the javac 210 // toolchain. See http://b/142056316 for more details. 211 ":i18n.module.intra.core.api{.public.stubs.source}", 212 ":core_oj_java_files", 213 ":core_libart_java_files", 214 // framework-api-annotations contain API annotations, e.g. @SystemApi. 215 ":framework-api-annotations", 216 ":openjdk_lambda_stub_files", 217 ":app-compat-annotations-source", 218 219 // Use the okhttp source too to allow libcore code to reference it 220 // directly. 221 ":okhttp_impl_files", 222 ], 223 224 sdk_version: "none", 225 system_modules: "none", 226 patch_module: "java.base", 227 openjdk9: { 228 srcs: ["luni/src/module/java/module-info.java"], 229 }, 230 231 java_resources: core_resources, 232 233 installable: false, 234 235 plugins: [ 236 "compat-changeid-annotation-processor", 237 "unsupportedappusage-annotation-processor", 238 ], 239 libs: [ 240 "conscrypt.module.intra.core.api", 241 ], 242} 243 244platform_compat_config { 245 name: "libcore-platform-compat-config", 246 src: ":core-all", 247 visibility: [ 248 "//art/build/apex", 249 "//art/build/sdk", 250 ], 251} 252 253// A system modules definition for use by core library targets only. It only 254// contains the core-all jar, which contains the classes that end up in core-oj, 255// core-libart as well as the lambda stubs needed to compile Java lambda code. 256// It does not contain other parts of core library like conscrypt, bouncycastle, 257// etc. This system_modules definition is used to bootstrap compilation for 258// other parts of the core library like core-oj, core-libart, conscrypt, 259// bouncycastle, etc. It is also used to compile Libcore tests, as well as ART 260// Java tests (run-tests). 261java_system_modules { 262 name: "core-all-system-modules", 263 264 // Visibility is deliberately restricted to a small set of build modules that 265 // the core library team control. 266 visibility: [ 267 "//art/test:__subpackages__", 268 "//external/apache-harmony:__subpackages__", 269 "//external/apache-xml", 270 "//external/okhttp", 271 "//libcore:__subpackages__", 272 ], 273 274 libs: ["core-all"], 275} 276 277// Contains the parts of core library associated with OpenJDK. 278java_library { 279 name: "core-oj", 280 visibility: [ 281 "//art/build/apex", 282 "//art/build/sdk", 283 "//external/wycheproof", 284 "//libcore/benchmarks", 285 "//packages/modules/ArtPrebuilt", 286 ], 287 apex_available: [ 288 "com.android.art", 289 "com.android.art.debug", 290 ], 291 defaults: ["libcore_java_defaults"], 292 installable: true, 293 hostdex: true, 294 295 srcs: [":core_oj_java_files"], 296 java_resources: core_resources, 297 298 sdk_version: "none", 299 system_modules: "core-all-system-modules", 300 patch_module: "java.base", 301 302 jacoco: { 303 exclude_filter: [ 304 "java.lang.Class", 305 "java.lang.Long", 306 "java.lang.Number", 307 "java.lang.Object", 308 "java.lang.String", 309 "java.lang.invoke.MethodHandle", 310 "java.lang.invoke.VarHandle", 311 "java.lang.ref.Reference", 312 "java.lang.reflect.Proxy", 313 "java.util.AbstractMap", 314 "java.util.HashMap", 315 "java.util.HashMap$Node", 316 "java.util.Map", 317 ], 318 }, 319 320 hiddenapi_additional_annotations: [ 321 "core-oj-hiddenapi-annotations", 322 ], 323 324 errorprone: { 325 javacflags: [ 326 "-Xep:ReturnValueIgnored:WARN", 327 "-Xep:HashtableContains:WARN", 328 "-Xep:ComparableType:WARN", 329 "-Xep:IdentityBinaryExpression:WARN", 330 "-Xep:BoxedPrimitiveEquality:WARN", 331 "-Xep:EmptyTopLevelDeclaration:WARN", 332 "-Xep:GetClassOnClass:WARN", 333 ], 334 }, 335} 336 337// Contains parts of core library not associated with OpenJDK. Contains not 338// just java.*, javax.* code but also android.system.* and various internal 339// libcore.* packages. 340java_library { 341 name: "core-libart", 342 visibility: [ 343 "//art/build/apex", 344 "//art/build/sdk", 345 "//external/wycheproof", 346 "//libcore/benchmarks", 347 "//packages/modules/ArtPrebuilt", 348 ], 349 apex_available: [ 350 "com.android.art", 351 "com.android.art.debug", 352 ], 353 defaults: ["libcore_java_defaults"], 354 installable: true, 355 hostdex: true, 356 357 srcs: [":core_libart_java_files"], 358 359 sdk_version: "none", 360 system_modules: "core-all-system-modules", 361 patch_module: "java.base", 362 363 jacoco: { 364 exclude_filter: [ 365 "java.lang.DexCache", 366 "dalvik.system.ClassExt", 367 ], 368 }, 369 370 target: { 371 hostdex: { 372 required: [ 373 // Files used to simulate the /system, runtime APEX and tzdata 374 // APEX dir structure on host. 375 "icu_tzdata.dat_host_tzdata_apex", 376 "tzdata_host", 377 "tzdata_host_tzdata_apex", 378 "tzlookup.xml_host_tzdata_apex", 379 "tz_version_host", 380 "tz_version_host_tzdata_apex", 381 ], 382 }, 383 darwin: { 384 enabled: false, 385 }, 386 }, 387 388 errorprone: { 389 javacflags: [ 390 "-Xep:EmptyTopLevelDeclaration:WARN", 391 "-Xep:GetClassOnAnnotation:WARN", 392 "-Xep:NullableOnContainingClass:WARN", 393 ], 394 }, 395} 396 397// Java library for use on host, e.g. by robolectric or layoutlib. 398java_library { 399 name: "core-libart-for-host", 400 visibility: [ 401 "//art/build/sdk", 402 "//external/robolectric", 403 "//external/robolectric-shadows", 404 "//frameworks/layoutlib", 405 ], 406 static_libs: [ 407 "core-libart", 408 ], 409 sdk_version: "none", 410 system_modules: "none", 411} 412 413// Provided solely to contribute information about which hidden parts of the 414// core-oj API are used by apps. 415// 416// Usually, e.g. for core-libart, the UnsupportedAppUsage annotations are 417// added to the source that is compiled directly into the bootjar and the build 418// system extracts the information about UnsupportedAppUsage directly from 419// there. 420// 421// This approach of having separate annotated source and a separate build 422// target was taken for ojluni to avoid having to maintain local patches in the 423// ojluni source for UnsupportedAppUsage annotations as that would make it more 424// difficult to pull down changes from upstream. 425// 426java_library { 427 name: "core-oj-hiddenapi-annotations", 428 // Do not allow this to be accessed from outside this directory. 429 visibility: ["//libcore:__subpackages__"], 430 defaults: ["libcore_java_defaults"], 431 compile_dex: true, 432 433 srcs: [":openjdk_hiddenapi_javadoc_files"], 434 435 sdk_version: "none", 436 system_modules: "core-all-system-modules", 437 patch_module: "java.base", 438 plugins: ["unsupportedappusage-annotation-processor"], 439 440 errorprone: { 441 javacflags: [ 442 "-Xep:ComparableType:WARN", 443 ], 444 }, 445} 446 447java_defaults { 448 name: "core_lambda_stubs_defaults", 449 defaults: ["libcore_java_defaults"], 450 hostdex: true, 451 452 sdk_version: "none", 453 system_modules: "core-all-system-modules", 454 patch_module: "java.base", 455 456 installable: false, 457 include_srcs: true, 458} 459 460// Creates a jar that exists to satisfy javac when compiling source code that 461// contains lambdas. This contains all classes / methods required by javac 462// when generating invoke-dynamic lambda implementation code, even those that 463// are also in the public SDK API from API level 26 onwards. 464java_library { 465 name: "core-lambda-stubs", 466 visibility: ["//visibility:public"], 467 defaults: ["core_lambda_stubs_defaults"], 468 srcs: [ 469 ":openjdk_lambda_stub_files", 470 ":openjdk_lambda_duplicate_stub_files", 471 ], 472 // This jar is packaged as part of the SDK, use -target 8 so that it works 473 // with old JDKs. 474 java_version: "1.8", 475} 476 477// An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files 478// because those classes are also part of the core library public SDK API 479// (since API level 26). 480java_library { 481 name: "core-lambda-stubs-for-system-modules", 482 visibility: [ 483 "//art/build/sdk", 484 "//build/soong/java/core-libraries", 485 "//frameworks/base", 486 "//frameworks/base/api", 487 ], 488 defaults: ["core_lambda_stubs_defaults"], 489 srcs: [ 490 ":openjdk_lambda_stub_files", 491 ], 492 include_srcs: true, 493 // This jar is packaged as part of the SDK, use -target 8 so that it works 494 // with old JDKs. 495 java_version: "1.8", 496} 497 498// This is an empty jar that exists for backwards compatibility with T (and below). 499// Historically, it existed to satisfy javac when compiling source code that 500// contains @Generated annotations. 501// This is no longer necessary since @Generated was added to ART's Public API 502// surface in U. 503java_library { 504 name: "core-generated-annotation-stubs", 505 visibility: [ 506 "//art/build/sdk", 507 "//build/soong/java/core-libraries", 508 "//frameworks/base", 509 "//frameworks/base/api", 510 ], 511 defaults: ["libcore_java_defaults"], 512 srcs: [ 513 ], 514 hostdex: true, 515 sdk_version: "none", 516 system_modules: "core-all-system-modules", 517 patch_module: "java.base", 518 installable: false, 519 include_srcs: true, 520 // This jar is packaged as part of the SDK, use -target 8 so that it works 521 // with old JDKs. 522 java_version: "1.8", 523} 524 525// Builds libcore test rules 526java_library_static { 527 name: "core-test-rules", 528 visibility: [ 529 "//art/build/sdk", 530 "//cts/tests/tests/util", 531 "//external/conscrypt", 532 "//external/conscrypt/apex/tests", 533 "//frameworks/base/location/tests/locationtests", 534 "//frameworks/base/core/tests/coretests", 535 "//frameworks/base/wifi/tests", 536 "//libcore/luni/src/test/java9compatibility", 537 "//packages/modules/Wifi/framework/tests", 538 ], 539 hostdex: true, 540 srcs: [ 541 "dalvik/test-rules/src/main/**/*.java", 542 "test-rules/src/main/**/*.java", 543 ], 544 static_libs: ["junit"], 545 546 sdk_version: "none", 547 system_modules: "core-all-system-modules", 548} 549 550// Builds platform_compat test rules 551java_library_static { 552 name: "core-compat-test-rules", 553 visibility: [ 554 "//art/build/sdk", 555 "//frameworks/base/tests/PlatformCompatGating/test-rules", 556 ], 557 srcs: [ 558 "luni/src/main/java/android/compat/**/*.java", 559 "test-rules/src/platform_compat/**/*.java", 560 "luni/src/main/java/libcore/api/CorePlatformApi.java", 561 "luni/src/main/java/libcore/api/IntraCoreApi.java", 562 ], 563 static_libs: [ 564 "junit", 565 "guava", 566 ], 567 sdk_version: "none", 568 system_modules: "core-all-system-modules", 569 // This builds classes that are in the java.base Java module: 570 patch_module: "java.base", 571 hostdex: true, 572 573 errorprone: { 574 javacflags: [ 575 "-Xep:EmptyTopLevelDeclaration:WARN", 576 "-Xep:GetClassOnAnnotation:WARN", 577 ], 578 }, 579} 580 581// Builds the core-tests-support library used by various tests. 582java_library_static { 583 name: "core-tests-support", 584 visibility: [ 585 "//art/build/sdk", 586 "//cts/apps/CtsVerifier", 587 "//cts/tests/tests/keystore", 588 "//cts/tests/tests/net", 589 "//cts/hostsidetests/statsdatom/apps/statsdapp", 590 "//cts/tests/tests/net/api23Test", 591 "//external/apache-harmony", 592 "//frameworks/base/core/tests/coretests", 593 "//frameworks/base/apct-tests/perftests/core", 594 "//libcore/benchmarks", 595 "//packages/apps/KeyChain/tests", 596 "//system/timezone/distro/core", 597 "//packages/modules/Connectivity/tests:__subpackages__", 598 ], 599 hostdex: true, 600 srcs: ["support/src/test/java/**/*.java"], 601 602 sdk_version: "core_platform", 603 // Make sure that this will be added to the sdk snapshot for S. 604 min_sdk_version: "S", 605 libs: ["junit"], 606 static_libs: [ 607 "bouncycastle-unbundled", 608 "bouncycastle-bcpkix-unbundled", 609 "bouncycastle-ocsp-unbundled", 610 ], 611 errorprone: { 612 javacflags: [ 613 "-Xep:BoxedPrimitiveEquality:WARN", 614 ], 615 }, 616} 617 618// Used to generate the prebuilt file luni/src/test/resources/prebuilt-dex-from-java.dex. 619// The reason why we pre-build this dex file is to stabilize the test result from the 620// dexer / javac / other toolchains change. 621// Regenerate the prebuilt file with the following command: 622// m core-tests-prebuilt-dex-from-java && 623// unzip out/soong/.intermediates/libcore/core-tests-prebuilt-dex-from-java/android_common/dex/core-tests-prebuilt-dex-from-java.jar classes.dex \ 624// -d libcore/luni/src/test/resources/ && mv libcore/luni/src/test/resources/classes.dex libcore/luni/src/test/resources/prebuilt-dex-from-java.dex 625java_test { 626 name: "core-tests-prebuilt-dex-from-java", 627 srcs: ["luni/src/test/dex_src/**/*.java"], 628 compile_dex: true, 629 defaults: ["libcore_java_defaults"], 630 sdk_version: "none", 631 system_modules: "core-all-system-modules", 632 633 visibility: [ 634 "//libcore:__subpackages__", 635 ], 636} 637 638// Builds the jsr166-tests library. 639java_test { 640 name: "jsr166-tests", 641 visibility: [ 642 "//art/build/sdk", 643 "//cts/tests/libcore/jsr166", 644 ], 645 srcs: ["jsr166-tests/src/test/java/**/*.java"], 646 sdk_version: "none", 647 system_modules: "core-all-system-modules", 648 libs: [ 649 "junit", 650 ], 651 errorprone: { 652 javacflags: [ 653 "-Xep:DoNotCall:OFF", 654 "-Xep:ModifyingCollectionWithItself:WARN", 655 "-Xep:ReturnValueIgnored:WARN", 656 "-Xep:HashtableContains:WARN", 657 ], 658 }, 659} 660 661// A filegroup that provides access to a source file for a toolchain test that 662// checks Java 9 language features are handled properly by JarJar. 663filegroup { 664 name: "core-java-9-language-features-source", 665 srcs: ["luni/src/main/java/libcore/internal/Java9LanguageFeatures.java"], 666 visibility: ["//libcore/luni/src/test/java9language"], 667} 668 669// A filegroup that provides access to a source file for a toolchain test that 670// checks Java 11 language features are handled properly by JarJar. 671filegroup { 672 name: "core-java-11-language-features-source", 673 srcs: ["luni/src/main/java/libcore/internal/Java11LanguageFeatures.java"], 674 visibility: ["//libcore/luni/src/test/java11language"], 675} 676 677// A filegroup that provides access to a source file for a toolchain test that 678// checks Java 17 language features are handled properly by JarJar. 679filegroup { 680 name: "core-java-17-language-features-source", 681 srcs: ["luni/src/main/java/libcore/internal/Java17LanguageFeatures.java"], 682 visibility: ["//libcore/luni/src/test/java17language"], 683} 684 685genrule { 686 name: "core-tests-smali-dex", 687 srcs: ["luni/src/test/java/**/*.smali"], 688 cmd: "$(location smali) ass --api 28 -o $(out) $(in)", 689 out: ["core-tests-smali.dex"], 690 tools: ["smali"], 691} 692 693filegroup { 694 name: "core-ojtests-javax-resources", 695 // Set path to keep the resources and .class files in the same directory in the jar file. 696 path: "ojluni/src", 697 srcs: ["ojluni/src/test/javax/**/*"], 698 exclude_srcs: ["ojluni/src/test/javax/**/*.java"], 699} 700 701filegroup { 702 name: "core-ojtests-java-resources", 703 // Set path to keep the resources and .class files in the same directory in the jar file. 704 path: "ojluni/src", 705 srcs: [ 706 "ojluni/src/test/java/util/regex/**/*", 707 "ojluni/src/test/java/util/Base64/**/*", 708 "ojluni/src/test/java/util/Scanner/**/*", 709 ], 710 exclude_srcs: ["ojluni/src/test/java/**/*.java"], 711} 712 713// Builds the core-tests library. 714java_test { 715 name: "core-tests", 716 visibility: [ 717 "//art/build/sdk", 718 "//cts/tests/libcore/luni", 719 ], 720 defaults: ["libcore_java_defaults"], 721 hostdex: true, 722 srcs: [ 723 "dalvik/src/test/java/**/*.java", 724 "dalvik/test-rules/src/test/java/**/*.java", 725 "dom/src/test/java/**/*.java", 726 "harmony-tests/src/test/java/**/*.java", 727 "json/src/test/java/**/*.java", 728 "luni/src/test/java/**/*.java", 729 "test-rules/src/test/java/**/*.java", 730 "xml/src/test/java/**/*.java", 731 ], 732 exclude_srcs: [ 733 "harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/*.java", 734 "luni/src/test/java/libcore/java/util/zip/Zip64Test.java", 735 "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java", 736 "luni/src/test/java/libcore/javax/crypto/**/*.java", 737 "luni/src/test/java/libcore/javax/net/ssl/**/*.java", 738 "luni/src/test/java/org/apache/harmony/crypto/**/*.java", 739 ], 740 741 java_resource_dirs: [ 742 "*/src/test/java", 743 "*/src/test/resources", 744 ], 745 exclude_java_resource_dirs: [ 746 "ojluni/src/test/java", 747 "ojluni/src/test/javax", 748 "ojluni/src/test/resources", 749 ], 750 751 java_resources: [ 752 ":annotations-test", 753 ":filesystemstest", 754 ":parameter-metadata-test", 755 ":core-tests-smali-dex", 756 ], 757 758 sdk_version: "none", 759 system_modules: "core-all-system-modules", 760 libs: [ 761 "okhttp", 762 "bouncycastle", 763 ], 764 765 static_libs: [ 766 "core-compat-test-rules", 767 "core-java-9-compatibility-tests", 768 "core-java-9-language-tests", 769 "core-java-11-language-tests", 770 "core-java-17-language-tests", 771 "core-test-rules", 772 "core-tests-support", 773 "junit-params", 774 "libcore-crypto-tests", 775 "mockftpserver", 776 "mockito-target", 777 "mockwebserver", 778 "nist-pkix-tests", 779 "slf4j-jdk14", 780 "sqlite-jdbc", 781 ], 782 783 errorprone: { 784 javacflags: [ 785 "-Xep:TryFailThrowable:ERROR", 786 "-Xep:ComparisonOutOfRange:ERROR", 787 "-Xep:DoNotCall:OFF", 788 "-Xep:ArrayToString:WARN", 789 "-Xep:SelfEquals:WARN", 790 "-Xep:SelfComparison:WARN", 791 "-Xep:ReturnValueIgnored:WARN", 792 "-Xep:BoxedPrimitiveEquality:WARN", 793 "-Xep:SizeGreaterThanOrEqualsZero:WARN", 794 "-Xep:MisusedDayOfYear:WARN", 795 "-Xep:InvalidTimeZoneID:WARN", 796 "-Xep:CollectionToArraySafeParameter:WARN", 797 "-Xep:ModifyingCollectionWithItself:WARN", 798 "-Xep:ComparableType:WARN", 799 "-Xep:UnusedCollectionModifiedInPlace:WARN", 800 "-Xep:HashtableContains:WARN", 801 "-Xep:DoubleBraceInitialization:WARN", 802 "-Xep:RandomModInteger:WARN", 803 "-Xep:IdentityBinaryExpression:WARN", 804 ], 805 }, 806 807 test_config: "AndroidTest-core-tests.xml", 808} 809 810java_test { 811 name: "libcore-crypto-tests", 812 813 visibility: [ 814 "//art/build/sdk", 815 "//external/conscrypt/apex/tests", 816 ], 817 srcs: [ 818 "harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/*.java", 819 "luni/src/test/java/libcore/javax/crypto/**/*.java", 820 "luni/src/test/java/libcore/javax/net/ssl/**/*.java", 821 "luni/src/test/java/libcore/libcore/util/SerializationTester.java", 822 "luni/src/test/java/libcore/sun/security/**/*.java", 823 "luni/src/test/java/org/apache/harmony/crypto/**/*.java", 824 ], 825 826 java_resource_dirs: [ 827 "luni/src/test/java", 828 "luni/src/test/resources", 829 "support/src/test/java", 830 ], 831 832 sdk_version: "none", 833 system_modules: "core-all-system-modules", 834 835 static_libs: [ 836 "core-test-rules", 837 "core-tests-support", 838 "junit-params", 839 "mockito-target", 840 ], 841 842 errorprone: { 843 javacflags: [ 844 "-Xep:ArrayToString:WARN", 845 "-Xep:ReturnValueIgnored:WARN", 846 ], 847 }, 848} 849 850// Exports annotated stubs source files in ojluni/annotations/sdk to make them 851// available to metalava. Used for nullability annotations in OpenJDK source. 852droiddoc_exported_dir { 853 name: "ojluni-annotated-sdk-stubs", 854 visibility: [ 855 "//libcore:__subpackages__", 856 ], 857 path: "ojluni/annotations/sdk", 858} 859 860droiddoc_exported_dir { 861 name: "ojluni-annotated-nullability-stubs", 862 path: "ojluni/annotations/sdk/nullability", 863} 864 865// Exports annotated stubs source files in ojluni/annotations/mmodules to make 866// them available to metalava. Used for core platform API and intra-core API 867// annotations in OpenJDK source. 868droiddoc_exported_dir { 869 name: "ojluni-annotated-mmodule-stubs", 870 visibility: [ 871 "//libcore/mmodules/intracoreapi", 872 ], 873 path: "ojluni/annotations/mmodule", 874} 875 876// A file containing the list of tags that are "known" to us from the OpenJdk 877// source code and so should not cause an error or warning. 878filegroup { 879 name: "known-oj-tags", 880 visibility: [ 881 "//frameworks/base", 882 "//frameworks/base/api", 883 ], 884 srcs: [ 885 "known_oj_tags.txt", 886 ], 887} 888 889// A special set of stubs containing the minimal set of self consistent 890// classes for which a system module can be created. Every system module must 891// contain the java.lang classes so the set was constructed by starting with 892// the java.lang classes and then adding their transitive dependencies without 893// splitting packages. So, if one class from a package is used then all classes 894// in that package were added to the set. 895// 896// Needed for java-current-stubs-system-modules. 897droidstubs { 898 name: "java-current-stubs-source", 899 srcs: [ 900 ":core_oj_api_files", 901 ":core_libart_api_files", 902 ], 903 installable: false, 904 sdk_version: "none", 905 system_modules: "none", 906 907 args: "--stub-packages java.*:javax.*:org.w3c.dom.*:org.xml.sax.*", 908} 909 910java_library { 911 name: "java.current.stubs", 912 srcs: [":java-current-stubs-source"], 913 errorprone: { 914 javacflags: [ 915 "-Xep:MissingOverride:OFF", 916 ], 917 }, 918 patch_module: "java.base", 919 sdk_version: "none", 920 system_modules: "none", 921} 922 923// A special set of system modules needed to build art.module.public.api 924// that contain nullability annotations when targeting java language level 1.9 925// and above. 926java_system_modules { 927 name: "java-current-stubs-system-modules", 928 libs: [ 929 // Minimal set of classes required for a system module. 930 "java.current.stubs", 931 932 // The nullability annotations used by the generated stubs. 933 "stub-annotations", 934 ], 935} 936 937java_library { 938 name: "framework-api-annotations-lib", 939 srcs: [":framework-api-annotations"], 940 sdk_version: "none", 941 patch_module: "java.base", 942 system_modules: "core-all-system-modules", 943 installable: false, 944 visibility: [ 945 "//visibility:private", 946 ], 947} 948 949// Define the public SDK API provided by the ART module. 950java_sdk_library { 951 name: "art.module.public.api", 952 visibility: [ 953 "//art/build/sdk", 954 "//build/soong/java/core-libraries", 955 "//frameworks/base", 956 "//frameworks/base/api", 957 958 // DO NOT REMOVE: Legacy visibility, needed for snapshots that are 959 // generated for the S build. 960 "//libcore/mmodules/core_platform_api", 961 ], 962 srcs: [ 963 ":core_oj_api_files", 964 ":core_libart_api_files", 965 966 // Some source files in :core_oj_api_files and :openjdk_mmodule_extra_files are 967 // annotated by applying annotations to the .annotated.java stubs files in 968 // ojluni/annotated/mmodules and rather than in the original source. See the comments 969 // in openjdk_java_files.bp for more details. 970 ":openjdk_mmodule_extra_files", 971 ":okhttp_api_files", 972 ], 973 libs: [ 974 // Put framework-api-annotations into libs to avoid exposing the definition of framework's 975 // annotations from libcore (wrong place) instead of framework (correct place). 976 "framework-api-annotations-lib", 977 // Provide access to I18N constants that are used to initialize 978 // constants in the public API. i.e. to allow the value of the 979 // java.text.CollectionElementIterator.NULLORDER to be initialized from 980 // android.icu.text.CollationElementIterator.NULLORDER. 981 "i18n.module.intra.core.api.stubs", 982 ], 983 stub_only_static_libs: ["notices-for-stubs-jar"], 984 985 // Make dex jars for the stubs available for use by hiddenapi processing. 986 compile_dex: true, 987 988 public: { 989 enabled: true, 990 }, 991 system: { 992 enabled: true, 993 }, 994 module_lib: { 995 enabled: true, 996 }, 997 998 api_only: true, 999 droiddoc_options: [ 1000 "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* ", 1001 "--hide-annotation libcore.api.Hide", 1002 ], 1003 1004 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"], 1005 // Emit nullability annotations from the source to the stub files. 1006 annotations_enabled: true, 1007 1008 merge_annotations_dirs: [ 1009 "metalava-manual", 1010 "ojluni-annotated-sdk-stubs", 1011 ], 1012 1013 doctag_files: [ 1014 ":known-oj-tags", 1015 ], 1016 1017 errorprone: { 1018 javacflags: [ 1019 "-Xep:MissingOverride:OFF", 1020 ], 1021 }, 1022 patch_module: "java.base", 1023 sdk_version: "none", 1024 system_modules: "java-current-stubs-system-modules", 1025 // The base name for the artifacts that are automatically published to the 1026 // dist and which end up in one of the sub-directories of prebuilts/sdk. 1027 // As long as this matches the name of the artifacts in prebuilts/sdk then 1028 // the API will be checked for compatibility against the latest released 1029 // version of the API. 1030 dist_stem: "art", 1031 dist_group: "android", 1032} 1033 1034// Target for validating nullability annotations for correctness and 1035// completeness. To check that there are no nullability errors: 1036// m art-module-public-api-stubs-nullability-validation 1037// To check that there are only the expected nullability warnings: 1038// m art-module-public-api-stubs-nullability-validation-check-nullability-warnings 1039// (If that check fails, it will provide instructions on how to proceed, 1040// including the command to run to update the expected warnings file.) 1041droidstubs { 1042 name: "art-module-public-api-stubs-nullability-validation", 1043 srcs: [":art_module_api_files"], 1044 installable: false, 1045 sdk_version: "none", 1046 system_modules: "none", 1047 annotations_enabled: true, 1048 args: "--hide-annotation libcore.api.Hide " + 1049 "--validate-nullability-from-merged-stubs ", 1050 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"], 1051 merge_annotations_dirs: [ 1052 // N.B. Stubs in this filegroup will be validated: 1053 "ojluni-annotated-nullability-stubs", 1054 ], 1055 // The list of classes which have nullability annotations included in the source. 1056 // (This is in addition to those which have annotations in the merged stubs.) 1057 validate_nullability_from_list: "nullability_annotated_classes.txt", 1058 // The expected set of warnings about missing annotations: 1059 check_nullability_warnings: "nullability_warnings.txt", 1060} 1061 1062// A special set of system modules for building the following library for use 1063// in the art-module-public-api-system-modules. 1064java_system_modules { 1065 name: "api-annotations-system-modules", 1066 libs: [ 1067 "art.module.public.api.stubs", 1068 ], 1069} 1070 1071// A library that contains annotations that define API surfaces (core 1072// platform, intra core and the hidden API) along with some supporting 1073// constants. The annotations are source only and do not introduce any runtime 1074// dependencies. Specially built for use in system modules definitions to 1075// avoid introducing compile time cycles. 1076java_library { 1077 name: "art.module.api.annotations.for.system.modules", 1078 visibility: [ 1079 "//build/soong/java/core-libraries", 1080 ], 1081 srcs: [ 1082 ":api_surface_annotation_files", 1083 ], 1084 1085 installable: false, 1086 sdk_version: "none", 1087 system_modules: "api-annotations-system-modules", 1088 patch_module: "java.base", 1089 // This jar is packaged as part of the SDK, use -target 8 so that it works 1090 // with old JDKs. 1091 java_version: "1.8", 1092} 1093 1094// Create a library containing the api surface annotations, built against 1095// core_current for use by the annotation processor in frameworks/base. 1096java_library { 1097 name: "art.module.api.annotations", 1098 visibility: [ 1099 "//art/build/sdk", 1100 "//external/icu/android_icu4j", 1101 "//frameworks/base", 1102 "//frameworks/base/api", 1103 ], 1104 host_supported: true, 1105 srcs: [ 1106 ":api_surface_annotation_files", 1107 ], 1108 sdk_version: "core_current", 1109 // Make sure that this will be added to the sdk snapshot for S. 1110 min_sdk_version: "S", 1111 // This jar is packaged as part of the ART module host exports, use -target 8 so that it works 1112 // with old JDKs. 1113 java_version: "1.8", 1114} 1115 1116java_api_contribution { 1117 name: "art-module-public-api-public-stubs", 1118 api_surface: "public", 1119 api_file: "api/current.txt", 1120 visibility: [ 1121 "//build/orchestrator/apis", 1122 ], 1123} 1124 1125java_api_contribution { 1126 name: "art-module-public-api-module-lib-stubs", 1127 api_surface: "module-lib", 1128 api_file: "api/module-lib-current.txt", 1129 visibility: [ 1130 "//build/orchestrator/apis", 1131 ], 1132} 1133 1134java_api_contribution { 1135 name: "art-module-public-api-system-stubs", 1136 api_surface: "system", 1137 api_file: "api/system-current.txt", 1138 visibility: [ 1139 "//build/orchestrator/apis", 1140 ], 1141} 1142