aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/ijar/test/BUILD
blob: 57c9f43c1edfdb97b89535faca3daa7e98253c86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package(default_visibility = ["//visibility:__pkg__"])

licenses(["notice"])  # Apache License 2.0

exports_files(["LICENSE"])

sh_test(
    name = "ijar_test",
    size = "large",
    srcs = ["ijar_test.sh"],
    args = [
        "$(JAVAC)",
        "$(JAVA)",
        "$(JAVABASE)/bin/jar",
        "$(JAVABASE)/bin/javap",
        "$(location //third_party/ijar)",
        "$(location //tools/jdk:langtools)",
        # We assume unzip and zip to be on the path
        "unzip",
        "zip",
    ],
    data = [
        "testenv.sh",
        "//src/test/shell:bashunit",
        "//third_party/ijar",
        "A.java",
        "B.java",
        "Object.java",
        "WellCompressed1.java",
        "WellCompressed2.java",
        ":libtypeannotations2.jar",
        "TypeAnnotationTest2.java",
        # invokedynamic/ClassWithLambda.java, compiled with javac8
        ":libinvokedynamic.jar",
        # Intentionally bad test JAR: file count in central directory
        # wrong.
        "libwrongcentraldir.jar",
        "//tools/defaults:jdk",
        "//tools/jdk:langtools",
    ],
    shard_count = 5,
    tags = ["zip"],
)

sh_test(
    name = "zip_test",
    size = "large",
    srcs = ["zip_test.sh"],
    args = [
        "$(location //third_party/ijar:zipper)",
        # We assume unzip and zip to be on the path
        "unzip",
        "zip",
    ],
    data = [
        "testenv.sh",
        "//src/test/shell:bashunit",
        "//third_party/ijar:zipper",
    ],
    tags = ["zip"],
)

java_library(
    name = "invokedynamic",
    testonly = 1,
    srcs = ["invokedynamic/ClassWithLambda.java"],
    javacopts = ["-source 8 -target 8"],
    tags = ["jdk8"],
)

# For testing purposes: a class which exposes a private nested class in
# public API, classes with annotations and a class with different forms of
# deprecations markers
java_library(
    name = "ijar_testlib",
    srcs = [
        "AnnotatedClass.java",
        "Annotations.java",
        "DeprecatedParts.java",
        "DumbClass.java",
        "EnclosingMethod.java",
        "PrivateMembersClass.java",
    ],
)

# For testing purposes: an interface jar (ijar) which includes the
# interface view of the various test class from above.
genrule(
    name = "interface_ijar_testlib",
    srcs = [":ijar_testlib"],
    outs = ["interface_ijar_testlib.jar"],
    cmd = "$(location //third_party/ijar) $< $@",
    tools = ["//third_party/ijar"],
)

java_library(
    name = "typeannotations2",
    srcs = glob(["typeannotations2/**/*.java"]),
    javacopts = ["-source 8 -target 8"],
    tags = ["jdk8"],
)

java_test(
    name = "IjarTests",
    size = "small",
    srcs = [
        "IjarTests.java",
        "StripVerifyingVisitor.java",
    ],
    args = ["IjarTests"],
    data = [
        "PrivateNestedClass.java",
        "UseDeprecatedParts.java",
        "UseRestrictedAnnotation.java",
        "package-info.java",
        ":interface_ijar_testlib",
    ],
    tags = ["zip"],
    deps = [
        "//src/java_tools/buildjar:BazelJavaCompiler",
        "//third_party:asm",
        "//third_party:junit4",
    ],
)

test_suite(
    name = "all_tests",
    testonly = 1,
    visibility = ["//visibility:public"],
)