// Copyright (C) 2021 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Android tests related to Java 11 language features. // Use jarjar to repackage Java11LanguageFeatures, to be used in tests below. package { default_team: "trendy_team_java_core_libraries", // http://go/android-license-faq // A large-scale-change added 'default_applicable_licenses' to import // the below license kinds from "libcore_luni_license": // SPDX-license-identifier-Apache-2.0 default_applicable_licenses: ["libcore_luni_license"], } java_library { name: "core-java-11-language-features-repackaged-for-test", hostdex: true, srcs: [":core-java-11-language-features-source"], jarjar_rules: "jarjar_rules_java11_language_features.txt", java_version: "11", sdk_version: "none", system_modules: "core-all-system-modules", patch_module: "java.base", visibility: ["//visibility:private"], } // Generate a clone of Java11LanguageFeaturesTest which uses a version of // Java11LanguageFeatures repackaged by jarjar. This ensures that jarjar is able // to handle a class file which must be at least v55 and includes bytecode // compiled from Java 11 language features. filegroup { name: "core-rewrite-java-11-test-for-jarjar-sed-script", srcs: ["rewrite-test-for-jarjar.sed"], visibility: ["//visibility:private"], } filegroup { name: "core-java-11-language-features-test-src", srcs: ["java/libcore/libcore/internal/Java11LanguageFeaturesTest.java"], visibility: ["//visibility:private"], } genrule { name: "core-gen-test-repackaged-java-11-language-features", srcs: [ ":core-rewrite-java-11-test-for-jarjar-sed-script", ":core-java-11-language-features-test-src", ], out: ["libcore/libcore/internal/Java11LanguageFeaturesJarjarTest.java"], cmd: "sed -r -f $(location :core-rewrite-java-11-test-for-jarjar-sed-script) $(location :core-java-11-language-features-test-src) > $(out)", visibility: ["//visibility:private"], } java_library { name: "core-java-11-language-tests", hostdex: true, srcs: [ "java/**/*.java", ":core-gen-test-repackaged-java-11-language-features", ], sdk_version: "none", system_modules: "core-all-system-modules", static_libs: [ "core-java-11-language-features-repackaged-for-test", "junit", ], visibility: ["//libcore"], java_version: "11", }