Skip to content

Commit

Permalink
disable werr locally (#53666)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgao authored Feb 13, 2025
1 parent 0b62b7c commit 6aacfa2
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ allprojects {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
compileJava {
options.compilerArgs += ["-Werror", "-Xlint:all,-serial,-processing"]
options.compilerArgs += ["-Xlint:all,-serial,-processing"] + getJavaCompilerArgs()
}
compileTestJava {
//rawtypes and unchecked are necessary for mockito
//deprecation and removal are removed from error since we should still test those constructs.
options.compilerArgs += ["-Werror", "-Xlint:all,-serial,-processing,-rawtypes,-unchecked,-deprecation,-removal"]
options.compilerArgs += ["-Xlint:all,-serial,-processing,-rawtypes,-unchecked,-deprecation,-removal"] + getJavaCompilerArgs()
}
compileTestFixturesJava {
//rawtypes and unchecked are necessary for mockito
options.compilerArgs += ["-Werror", "-Xlint:all,-serial,-processing,-rawtypes,-unchecked"]
options.compilerArgs += ["-Xlint:all,-serial,-processing,-rawtypes,-unchecked"] + getJavaCompilerArgs()
}
}

Expand All @@ -76,7 +76,7 @@ allprojects {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
languageVersion = KotlinVersion.KOTLIN_1_9
allWarningsAsErrors = true
allWarningsAsErrors = isInCi()
freeCompilerArgs = ["-Xjvm-default=all"]
}
dependsOn {
Expand All @@ -87,7 +87,7 @@ allprojects {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
languageVersion = KotlinVersion.KOTLIN_1_9
allWarningsAsErrors = true
allWarningsAsErrors = isInCi()
freeCompilerArgs = ["-Xjvm-default=all"]
}
dependsOn {
Expand All @@ -98,7 +98,7 @@ allprojects {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
languageVersion = KotlinVersion.KOTLIN_1_9
allWarningsAsErrors = true
allWarningsAsErrors = isInCi()
freeCompilerArgs = ["-Xjvm-default=all"]
}
dependsOn {
Expand Down Expand Up @@ -236,3 +236,15 @@ allprojects {
options.addStringOption('Xdoclint:none', '-quiet')
}
}

static def isInCi() {
return System.getenv("CI") == "true"
}

static def getJavaCompilerArgs() {
if (isInCi()) {
return ["-Werror"]
} else {
return []
}
}

0 comments on commit 6aacfa2

Please sign in to comment.