Skip to content

Commit 3c03eb7

Browse files
committed
travis,jenkins: Fail build if javac emits warnings
1 parent 7fb43d2 commit 3c03eb7

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ before_install:
2121
- ln -s "/tmp/protobuf-${PROTOBUF_VERSION}/$(uname -s)-$(uname -p)" /tmp/protobuf
2222
- mkdir -p $HOME/.gradle
2323
- echo "checkstyle.ignoreFailures=false" >> $HOME/.gradle/gradle.properties
24+
- echo "failOnWarnings=true" >> $HOME/.gradle/gradle.properties
2425

2526
install:
2627
- ./gradlew assemble generateTestProto

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ subprojects {
3232
[compileJava, compileTestJava].each() {
3333
it.options.compilerArgs += ["-Xlint:all", "-Xlint:-options"]
3434
it.options.encoding = "UTF-8"
35+
if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
36+
it.options.compilerArgs += ["-Werror"]
37+
}
3538
}
3639

3740
compileTestJava {

buildscripts/jenkins-pre.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ cd "%WORKSPACE%"
1313
set ESCWORKSPACE=%WORKSPACE:\=\\%
1414

1515
echo targetArch=x86_32> gradle.properties
16+
echo failOnWarnings=true>> gradle.properties
1617
echo vcProtobufLibs=%ESCWORKSPACE%\\grpc-java-helper\\protobuf-3.0.0-beta-3\\cmake\\build\\Release>> gradle.properties
1718
echo vcProtobufInclude=%ESCWORKSPACE%\\grpc-java-helper\\protobuf-3.0.0-beta-3\\cmake\\build\\include>> gradle.properties

0 commit comments

Comments
 (0)