blob: da9b775356ce7e3747e9914cc80564796c490a3b [file] [log] [blame]
Colin Crossc6bbef32017-08-14 14:16:06 -07001// Copyright 2017 Google Inc. All rights reserved.
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
15package config
16
17import (
18 "strings"
19)
20
21func init() {
22 pctx.SourcePathVariable("ErrorProneJavacJar", "external/error_prone/javac/javac-9-dev-r3297-4.jar")
23 pctx.SourcePathVariable("ErrorProneJar", "external/error_prone/error_prone/error_prone_core-2.0.19-with-dependencies.jar")
24 pctx.SourcePathsVariable("ErrorProneClasspath", ":",
25 "external/error_prone/error_prone/error_prone_annotations-2.0.19.jar",
26 "external/error_prone/checkerframework/dataflow-1.8.10.jar",
27 "external/error_prone/checkerframework/javacutil-1.8.10.jar",
28 "external/error_prone/jFormatString/jFormatString-3.0.0.jar")
29
30 // The checks that are fatal to the build.
31 pctx.StaticVariable("ErrorProneChecksError", strings.Join([]string{
32 "-Xep:AsyncCallableReturnsNull:ERROR",
33 "-Xep:AsyncFunctionReturnsNull:ERROR",
34 "-Xep:BundleDeserializationCast:ERROR",
35 "-Xep:CompatibleWithAnnotationMisuse:ERROR",
36 "-Xep:CompileTimeConstant:ERROR",
37 "-Xep:DaggerProvidesNull:ERROR",
38 "-Xep:DoNotCall:ERROR",
39 "-Xep:ForOverride:ERROR",
40 "-Xep:FunctionalInterfaceMethodChanged:ERROR",
41 "-Xep:FuturesGetCheckedIllegalExceptionType:ERROR",
42 "-Xep:GuiceAssistedInjectScoping:ERROR",
43 "-Xep:GuiceAssistedParameters:ERROR",
44 "-Xep:GuiceInjectOnFinalField:ERROR",
45 "-Xep:Immutable:ERROR",
46 "-Xep:ImmutableModification:ERROR",
47 "-Xep:IncompatibleArgumentType:ERROR",
48 "-Xep:IndexOfChar:ERROR",
49 "-Xep:InjectMoreThanOneScopeAnnotationOnClass:ERROR",
50 "-Xep:JavaxInjectOnAbstractMethod:ERROR",
51 "-Xep:JUnit4SetUpNotRun:ERROR",
52 "-Xep:JUnit4TearDownNotRun:ERROR",
53 "-Xep:JUnit4TestNotRun:ERROR",
54 "-Xep:JUnitAssertSameCheck:ERROR",
55 "-Xep:LiteByteStringUtf8:ERROR",
56 "-Xep:LoopConditionChecker:ERROR",
57 "-Xep:MockitoCast:ERROR",
58 "-Xep:MockitoUsage:ERROR",
59 "-Xep:MoreThanOneInjectableConstructor:ERROR",
60 "-Xep:MustBeClosedChecker:ERROR",
61 "-Xep:NonCanonicalStaticImport:ERROR",
62 "-Xep:NonFinalCompileTimeConstant:ERROR",
63 "-Xep:OptionalEquality:ERROR",
64 "-Xep:OverlappingQualifierAndScopeAnnotation:ERROR",
65 "-Xep:PackageInfo:ERROR",
66 "-Xep:PreconditionsCheckNotNull:ERROR",
67 "-Xep:PreconditionsCheckNotNullPrimitive:ERROR",
68 "-Xep:ProtoFieldNullComparison:ERROR",
69 "-Xep:ProvidesMethodOutsideOfModule:ERROR",
70 "-Xep:RestrictedApiChecker:ERROR",
71 "-Xep:SelfAssignment:ERROR",
72 "-Xep:StreamToString:ERROR",
73 "-Xep:SuppressWarningsDeprecated:ERROR",
74 "-Xep:ThrowIfUncheckedKnownChecked:ERROR",
75 "-Xep:ThrowNull:ERROR",
76 "-Xep:TypeParameterQualifier:ERROR",
77 "-Xep:UnnecessaryTypeArgument:ERROR",
78 "-Xep:UnusedAnonymousClass:ERROR",
79 }, " "))
80
81 pctx.StaticVariable("ErrorProneFlags", strings.Join([]string{
82 "com.google.errorprone.ErrorProneCompiler",
83 "-Xdiags:verbose",
84 "-XDcompilePolicy=simple",
85 "-XDallowBetterNullChecks=false",
86 "-XDusePolyAttribution=true",
87 "-XDuseStrictMethodClashCheck=true",
88 "-XDuseStructuralMostSpecificResolution=true",
89 "-XDuseGraphInference=true",
90 "-Xmaxwarns 100000",
91 "-XDandroidCompatible=true",
92 "-XepAllErrorsAsWarnings",
93 }, " "))
94
95 pctx.StaticVariable("ErrorProneCmd",
96 "${JavaCmd} -Xbootclasspath/p:${ErrorProneJavacJar} -cp ${ErrorProneJar}:${ErrorProneClasspath} ${ErrorProneFlags} ${ErrorProneChecksError}")
97}