• 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.
18java_library {
19    name: "core-java-9-language-features-repackaged-for-test",
20    hostdex: true,
21
22    srcs: [":core-java-9-language-features-source"],
23    jarjar_rules: "jarjar_rules_java9_language_features.txt",
24    java_version: "1.9",
25
26    sdk_version: "none",
27    system_modules: "core-all-system-modules",
28    patch_module: "java.base",
29
30    visibility: ["//visibility:private"],
31}
32
33// Generate a clone of Java9LanguageFeaturesTest which uses a version of
34// Java9LanguageFeatures repackaged by jarjar. This ensures that jarjar is able
35// to handle a class file which must be at least v53 and includes bytecode
36// compiled from Java 9 language features.
37filegroup {
38    name: "core-rewrite-test-for-jarjar-sed-script",
39    srcs: ["rewrite-test-for-jarjar.sed"],
40    visibility: ["//visibility:private"],
41}
42
43filegroup {
44    name: "core-java-9-language-features-test-src",
45    srcs: ["java/libcore/libcore/internal/Java9LanguageFeaturesTest.java"],
46    visibility: ["//visibility:private"],
47}
48
49genrule {
50    name: "core-gen-test-repackaged-java-9-language-features",
51    srcs: [
52        ":core-rewrite-test-for-jarjar-sed-script",
53        ":core-java-9-language-features-test-src",
54    ],
55    out: ["libcore/libcore/internal/Java9LanguageFeaturesJarjarTest.java"],
56    cmd: "sed -r -f $(location :core-rewrite-test-for-jarjar-sed-script) $(location :core-java-9-language-features-test-src) > $(out)",
57    visibility: ["//visibility:private"],
58}
59
60java_library {
61    name: "core-java-9-language-tests",
62    hostdex: true,
63    srcs: [
64        "java/**/*.java",
65        ":core-gen-test-repackaged-java-9-language-features",
66    ],
67    sdk_version: "none",
68    system_modules: "core-all-system-modules",
69    static_libs: [
70        "core-java-9-language-features-repackaged-for-test",
71        "junit",
72    ],
73    visibility: ["//libcore"],
74}
75