Colin Cross | c6bbef3 | 2017-08-14 14:16:06 -0700 | [diff] [blame] | 1 | // 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 | |
| 15 | package config |
| 16 | |
| 17 | import ( |
| 18 | "strings" |
| 19 | ) |
| 20 | |
| 21 | func 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 | |
Colin Cross | 3203dde | 2017-08-28 17:23:21 -0700 | [diff] [blame] | 81 | pctx.StaticVariable("ErrorProneHeapFlags", "-Xmx"+JavacHeapSize) |
| 82 | |
Colin Cross | c6bbef3 | 2017-08-14 14:16:06 -0700 | [diff] [blame] | 83 | pctx.StaticVariable("ErrorProneFlags", strings.Join([]string{ |
| 84 | "com.google.errorprone.ErrorProneCompiler", |
| 85 | "-Xdiags:verbose", |
| 86 | "-XDcompilePolicy=simple", |
| 87 | "-XDallowBetterNullChecks=false", |
| 88 | "-XDusePolyAttribution=true", |
| 89 | "-XDuseStrictMethodClashCheck=true", |
| 90 | "-XDuseStructuralMostSpecificResolution=true", |
| 91 | "-XDuseGraphInference=true", |
Colin Cross | c6bbef3 | 2017-08-14 14:16:06 -0700 | [diff] [blame] | 92 | "-XDandroidCompatible=true", |
| 93 | "-XepAllErrorsAsWarnings", |
| 94 | }, " ")) |
| 95 | |
| 96 | pctx.StaticVariable("ErrorProneCmd", |
Colin Cross | 3203dde | 2017-08-28 17:23:21 -0700 | [diff] [blame] | 97 | "${JavaCmd} ${ErrorProneHeapFlags} -Xbootclasspath/p:${ErrorProneJavacJar} "+ |
| 98 | "-cp ${ErrorProneJar}:${ErrorProneClasspath} "+ |
| 99 | "${ErrorProneFlags} ${CommonJdkFlags} ${ErrorProneChecksError}") |
Colin Cross | c6bbef3 | 2017-08-14 14:16:06 -0700 | [diff] [blame] | 100 | } |