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