1// Copyright (C) 2021 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// Android tests related to Java 17 language features. 16 17// Use jarjar to repackage Java17LanguageFeatures, to be used in tests below. 18package { 19 default_team: "trendy_team_java_core_libraries", 20 // http://go/android-license-faq 21 // A large-scale-change added 'default_applicable_licenses' to import 22 // the below license kinds from "libcore_luni_license": 23 // SPDX-license-identifier-Apache-2.0 24 default_applicable_licenses: ["libcore_luni_license"], 25} 26 27java_library { 28 name: "core-java-17-language-features-repackaged-for-test", 29 hostdex: true, 30 31 srcs: [":core-java-17-language-features-source"], 32 jarjar_rules: "jarjar_rules_java17_language_features.txt", 33 java_version: "17", 34 35 sdk_version: "none", 36 system_modules: "core-all-system-modules", 37 patch_module: "java.base", 38 39 visibility: ["//visibility:private"], 40} 41 42// Generate a clone of Java17LanguageFeaturesTest which uses a version of 43// Java17LanguageFeatures repackaged by jarjar. This ensures that jarjar is able 44// to handle a class file which must be at least v55 and includes bytecode 45// compiled from Java 17 language features. 46filegroup { 47 name: "core-rewrite-java-17-test-for-jarjar-sed-script", 48 srcs: ["rewrite-test-for-jarjar.sed"], 49 visibility: ["//visibility:private"], 50} 51 52filegroup { 53 name: "core-java-17-language-features-test-src", 54 srcs: ["java/libcore/libcore/internal/Java17LanguageFeaturesTest.java"], 55 visibility: ["//visibility:private"], 56} 57 58genrule { 59 name: "core-gen-test-repackaged-java-17-language-features", 60 srcs: [ 61 ":core-rewrite-java-17-test-for-jarjar-sed-script", 62 ":core-java-17-language-features-test-src", 63 ], 64 out: ["libcore/libcore/internal/Java17LanguageFeaturesJarjarTest.java"], 65 cmd: "sed -r -f $(location :core-rewrite-java-17-test-for-jarjar-sed-script) $(location :core-java-17-language-features-test-src) > $(out)", 66 visibility: ["//visibility:private"], 67} 68 69java_library { 70 name: "core-java-17-language-tests", 71 hostdex: true, 72 srcs: [ 73 "java/**/*.java", 74 ":core-gen-test-repackaged-java-17-language-features", 75 ], 76 sdk_version: "none", 77 system_modules: "core-all-system-modules", 78 static_libs: [ 79 "core-java-17-language-features-repackaged-for-test", 80 "junit", 81 ], 82 visibility: ["//libcore"], 83 java_version: "17", 84} 85