aboutsummaryrefslogtreecommitdiff
path: root/ojluni/src/test/Android.bp
blob: 0eeb92c53e1e8dc6a8bfb945c40b3d47032aa19d (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// Copyright (C) 2022 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.

package {
    default_visibility: ["//visibility:private"],
    default_applicable_licenses: ["libcore_ojluni_src_test_license"],
}

license {
    name: "libcore_ojluni_src_test_license",
    visibility: [":__subpackages__"],
    license_kinds: [
        "SPDX-license-identifier-Apache-2.0",
        "SPDX-license-identifier-GPL-2.0",
    ],
    license_text: [
        "LICENSE",
    ],
}

// Builds the core-ojtests library that contains test code from OpenJDK.
java_test {
    name: "core-ojtests",
    defaults: ["libcore_java_defaults"],
    hostdex: true,

    srcs: [
        "java/**/*.java",
        "javax/**/*.java",
        "sun/**/*.java",
    ],
    java_resource_dirs: [
        "resources",
    ],

    java_resources: [
        ":core-ojtests-java-resources",
        ":core-ojtests-javax-resources",
    ],

    sdk_version: "none",
    system_modules: "core-all-system-modules",
    libs: [
        "okhttp",
        "bouncycastle",
    ],

    static_libs: [
        "junit",
        "testng",
    ],

    // ojluni/src/test/java/util/stream/{bootlib,boottest}
    // contains tests that are in packages from java.base;
    // By default, OpenJDK 9's javac will only compile such
    // code if it's declared to also be in java.base at
    // compile time.
    //
    // For now, we use patch_module to put all sources
    // and dependencies from this make target into java.base;
    // other source directories in this make target are in
    // packages not from java.base; if this becomes a problem
    // in future, this could be addressed eg. by splitting
    // boot{lib,test} out into a separate make target,
    // deleting those tests or moving them to a different
    // package.
    patch_module: "java.base",

    errorprone: {
        javacflags: [
            "-Xep:AlwaysThrows:OFF",
            "-Xep:DoNotCall:OFF",
            "-Xep:ArrayToString:WARN",
            "-Xep:ReturnValueIgnored:WARN",
            "-Xep:MathRoundIntLong:WARN",
            "-Xep:FormatString:WARN",
            "-Xep:IdentityBinaryExpression:WARN",
            "-Xep:RandomModInteger:WARN",
            "-Xep:SelfEquals:WARN",
            "-Xep:DurationTemporalUnit:WARN",
            "-Xep:DurationFrom:WARN",
            "-Xep:InstantTemporalUnit:WARN",
            "-Xep:SelfComparison:WARN",
            "-Xep:PeriodFrom:WARN",
            "-Xep:BoxedPrimitiveEquality:WARN",
            "-Xep:IdentityHashMapBoxing:WARN",
            "-Xep:DoubleBraceInitialization:WARN",
            "-Xep:ComparableType:WARN",
            "-Xep:ModifyingCollectionWithItself:WARN",
            "-Xep:InvalidZoneId:WARN",
            "-Xep:HashtableContains:WARN",
        ],
    },
}

// Builds the core-ojtests-public library. Excludes any private API tests.
// Like core-ojtests but smaller.
java_test {
    name: "core-ojtests-public",
    visibility: [
        "//art/build/sdk",
        "//cts/tests/libcore/ojluni",
    ],
    defaults: ["libcore_java_defaults"],
    srcs: [
        "java/**/*.java",
        "javax/**/*.java",
        "sun/**/*.java",
    ],
    // Filter out the following:
    // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
    //     and won't actually run, and
    // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
    //     excluding them means we don't need patch_module: "java.base"
    exclude_srcs: [
        "**/DeserializeMethodTest.java",
        "**/SerializedLambdaTest.java",
        "java/util/stream/boot*/**/*",
    ],
    java_resource_dirs: [
        "resources",
        // Include source code as part of JAR
        "dist",
    ],

    java_resources: [
        ":core-ojtests-java-resources",
        ":core-ojtests-javax-resources",
    ],

    sdk_version: "none",
    system_modules: "core-all-system-modules",
    libs: [
        "bouncycastle",
        "junit",
        "okhttp",
        "testng",
    ],

    errorprone: {
        javacflags: [
            "-Xep:AlwaysThrows:OFF",
            "-Xep:DoNotCall:OFF",
            "-Xep:ArrayToString:WARN",
            "-Xep:ReturnValueIgnored:WARN",
            "-Xep:MathRoundIntLong:WARN",
            "-Xep:FormatString:WARN",
            "-Xep:IdentityBinaryExpression:WARN",
            "-Xep:RandomModInteger:WARN",
            "-Xep:SelfEquals:WARN",
            "-Xep:DurationTemporalUnit:WARN",
            "-Xep:DurationFrom:WARN",
            "-Xep:InstantTemporalUnit:WARN",
            "-Xep:SelfComparison:WARN",
            "-Xep:PeriodFrom:WARN",
            "-Xep:BoxedPrimitiveEquality:WARN",
            "-Xep:IdentityHashMapBoxing:WARN",
            "-Xep:DoubleBraceInitialization:WARN",
            "-Xep:ComparableType:WARN",
            "-Xep:ModifyingCollectionWithItself:WARN",
            "-Xep:InvalidZoneId:WARN",
            "-Xep:HashtableContains:WARN",
        ],
    },
}