summaryrefslogtreecommitdiffstats
path: root/tools/BUILD
blob: 646414037a928f12097349ae93c5db336ea1134a (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
load(
    "@bazel_tools//tools/jdk:default_java_toolchain.bzl",
    "JDK9_JVM_OPTS",
    "default_java_toolchain",
)
load("@rules_java//java:defs.bzl", "java_package_configuration")
load("@rules_python//python:defs.bzl", "py_binary")

py_binary(
    name = "merge_jars",
    srcs = ["merge_jars.py"],
    main = "merge_jars.py",
    visibility = ["//visibility:public"],
)

default_java_toolchain(
    name = "error_prone_warnings_toolchain",
    bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"],
    jvm_opts = JDK9_JVM_OPTS,
    package_configuration = [
        ":error_prone",
    ],
    visibility = ["//visibility:public"],
)

# Error Prone errors enabled by default; see ../.bazelrc for how this is
# enabled. This warnings list is originally based on:
# https://github.com/bazelbuild/BUILD_file_generator/blob/master/tools/bazel_defs/java.bzl
# However, feel free to add any additional errors. Thus far they have all been pretty useful.
java_package_configuration(
    name = "error_prone",
    javacopts = [
        "-XepDisableWarningsInGeneratedCode",
        "-Xep:MissingCasesInEnumSwitch:ERROR",
        "-Xep:ReferenceEquality:WARN",
        "-Xep:StringEquality:WARN",
        "-Xep:WildcardImport:WARN",
        "-Xep:AmbiguousMethodReference:WARN",
        "-Xep:BadAnnotationImplementation:WARN",
        "-Xep:BadComparable:WARN",
        "-Xep:BoxedPrimitiveConstructor:ERROR",
        "-Xep:CannotMockFinalClass:WARN",
        "-Xep:ClassCanBeStatic:WARN",
        "-Xep:ClassNewInstance:WARN",
        "-Xep:DateFormatConstant:ERROR",
        "-Xep:DefaultCharset:ERROR",
        "-Xep:DoubleCheckedLocking:WARN",
        "-Xep:ElementsCountedInLoop:WARN",
        "-Xep:EqualsHashCode:WARN",
        "-Xep:EqualsIncompatibleType:WARN",
        "-Xep:ExpectedExceptionChecker:ERROR",
        "-Xep:Finally:WARN",
        "-Xep:FloatingPointLiteralPrecision:WARN",
        "-Xep:FragmentInjection:WARN",
        "-Xep:FragmentNotInstantiable:WARN",
        "-Xep:FunctionalInterfaceClash:WARN",
        "-Xep:FutureReturnValueIgnored:WARN",
        "-Xep:GetClassOnEnum:WARN",
        "-Xep:ImmutableAnnotationChecker:WARN",
        "-Xep:ImmutableEnumChecker:WARN",
        "-Xep:IncompatibleModifiers:WARN",
        "-Xep:InjectOnConstructorOfAbstractClass:WARN",
        "-Xep:InputStreamSlowMultibyteRead:WARN",
        "-Xep:IterableAndIterator:WARN",
        "-Xep:JUnit3FloatingPointComparisonWithoutDelta:WARN",
        "-Xep:JUnitAmbiguousTestClass:WARN",
        "-Xep:LiteralClassName:WARN",
        "-Xep:MissingFail:ERROR",
        "-Xep:MissingOverride:WARN",
        "-Xep:MutableConstantField:WARN",
        "-Xep:NarrowingCompoundAssignment:WARN",
        "-Xep:NonAtomicVolatileUpdate:WARN",
        "-Xep:NonOverridingEquals:WARN",
        "-Xep:NullableConstructor:WARN",
        "-Xep:NullablePrimitive:WARN",
        "-Xep:NullableVoid:WARN",
        "-Xep:OperatorPrecedence:WARN",
        "-Xep:OverridesGuiceInjectableMethod:WARN",
        "-Xep:PreconditionsInvalidPlaceholder:WARN",
        "-Xep:ProtoFieldPreconditionsCheckNotNull:WARN",
        "-Xep:ProtocolBufferOrdinal:WARN",
        "-Xep:RequiredModifiers:WARN",
        "-Xep:ShortCircuitBoolean:WARN",
        "-Xep:SimpleDateFormatConstant:WARN",
        "-Xep:StaticGuardedByInstance:WARN",
        "-Xep:SynchronizeOnNonFinalField:WARN",
        "-Xep:TruthConstantAsserts:WARN",
        "-Xep:TypeParameterShadowing:WARN",
        "-Xep:TypeParameterUnusedInFormals:WARN",
        "-Xep:URLEqualsHashCode:WARN",
        "-Xep:UnsynchronizedOverridesSynchronized:WARN",
        "-Xep:WaitNotInLoop:WARN",
    ],
    packages = ["error_prone_packages"],
)

package_group(
    name = "error_prone_packages",
    packages = [
        "//gerrit-acceptance-framework/...",
        "//gerrit-acceptance-tests/...",
        "//gerrit-cache-h2/...",
        "//gerrit-cache-mem/...",
        "//gerrit-common/...",
        "//gerrit-elasticsearch/...",
        "//gerrit-extension-api/...",
        "//gerrit-gpg/...",
        "//gerrit-httpd/...",
        "//gerrit-launcher/...",
        "//gerrit-lucene/...",
        "//gerrit-main/...",
        "//gerrit-oauth/...",
        "//gerrit-openid/...",
        "//gerrit-patch-commonsnet/...",
        "//gerrit-patch-jgit/...",
        "//gerrit-pgm/...",
        "//gerrit-plugin-api/...",
        "//gerrit-plugin-gwtui/...",
        "//gerrit-prettify/...",
        "//gerrit-reviewdb/...",
        "//gerrit-server/...",
        "//gerrit-sshd/...",
        "//gerrit-test-util/...",
        "//gerrit-util-cli/...",
        "//gerrit-util-http/...",
        "//gerrit-util-ssl/...",
        "//gerrit-war/...",
        "//plugins/commit-message-length-validator/...",
        "//plugins/download-commands/...",
        "//plugins/hooks/...",
        "//plugins/replication/...",
        "//plugins/reviewnotes/...",
        "//plugins/singleusergroup/...",
    ],
)