Skip to content
This repository was archived by the owner on Dec 23, 2023. It is now read-only.

Commit 3bfca42

Browse files
author
Bogdan Drutu
authored
Remove format and licence tasks for tests and move to gradle. (#1691)
1 parent e538b2e commit 3bfca42

File tree

6 files changed

+28
-41
lines changed

6 files changed

+28
-41
lines changed

.travis.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ matrix:
2525
os: linux
2626

2727
# Build example projects last, since they are affected by fewer pull requests.
28-
- jdk: oraclejdk8
29-
env: TASK=CHECK_EXAMPLES_LICENSE
30-
os: linux
31-
3228
- jdk: oraclejdk8
3329
env: TASK=BUILD_EXAMPLES_GRADLE
3430
os: linux
@@ -41,10 +37,6 @@ matrix:
4137
env: TASK=BUILD_EXAMPLES_BAZEL
4238
os: linux
4339

44-
- jdk: oraclejdk8
45-
env: TASK=CHECK_EXAMPLES_FORMAT
46-
os: linux
47-
4840
# Work around https://github.com/travis-ci/travis-ci/issues/2317
4941
- env: TASK=BUILD
5042
# Set the java version to 1.8 until we fix the build for java10.

buildscripts/kokoro/linux_example_format.cfg

Lines changed: 0 additions & 9 deletions
This file was deleted.

buildscripts/kokoro/linux_example_license.cfg

Lines changed: 0 additions & 10 deletions
This file was deleted.

buildscripts/kokoro/linux_presubmit.sh

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ valid_tasks() {
2222
echo "- BUILD_EXAMPLES_GRADLE"
2323
echo "- BUILD_EXAMPLES_MAVEN"
2424
echo "- CHECKER_FRAMEWORK"
25-
echo "- CHECK_EXAMPLES_FORMAT"
26-
echo "- CHECK_EXAMPLES_LICENSE"
2725
echo "- CHECK_GIT_HISTORY"
2826
}
2927

@@ -63,17 +61,8 @@ case "$TASK" in
6361
"CHECKER_FRAMEWORK")
6462
./gradlew clean assemble -PcheckerFramework=true
6563
;;
66-
"CHECK_EXAMPLES_LICENSE")
67-
curl -L -o checkstyle-8.12-all.jar https://github.com/checkstyle/checkstyle/releases/download/checkstyle-8.12/checkstyle-8.12-all.jar
68-
java -DrootDir=. -jar checkstyle-8.12-all.jar -c buildscripts/checkstyle.xml examples/src/
69-
;;
70-
"CHECK_EXAMPLES_FORMAT")
71-
curl -L -o google-java-format-1.5-all-deps.jar \
72-
https://github.com/google/google-java-format/releases/download/google-java-format-1.5/google-java-format-1.5-all-deps.jar
73-
java -jar google-java-format-1.5-all-deps.jar --set-exit-if-changed --dry-run `find examples/src/ -name '*.java'`
74-
;;
7564
"BUILD_EXAMPLES_GRADLE")
76-
pushd examples && ./gradlew clean assemble --stacktrace && popd
65+
pushd examples && ./gradlew clean assemble --stacktrace && ./gradlew check && ./gradlew verGJF && popd
7766
;;
7867
"BUILD_EXAMPLES_MAVEN")
7968
pushd examples && mvn clean package appassembler:assemble -e && popd

buildscripts/travis_script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ case "$TASK" in
6363
java -jar google-java-format-1.5-all-deps.jar --set-exit-if-changed --dry-run `find examples/src/ -name '*.java'`
6464
;;
6565
"BUILD_EXAMPLES_GRADLE")
66-
pushd examples && ./gradlew clean assemble --stacktrace && popd
66+
pushd examples && ./gradlew clean assemble --stacktrace && ./gradlew check && ./gradlew verGJF && popd
6767
;;
6868
"BUILD_EXAMPLES_MAVEN")
6969
pushd examples && mvn clean package appassembler:assemble -e && popd

examples/build.gradle

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ buildscript {
1111
dependencies {
1212
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
1313
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
14+
classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8"
1415
}
1516
}
1617

18+
apply plugin: "checkstyle"
19+
apply plugin: 'com.google.protobuf'
20+
apply plugin: 'com.github.sherter.google-java-format'
1721
apply plugin: 'idea'
1822
apply plugin: 'java'
19-
apply plugin: 'com.google.protobuf'
2023

2124
// Display the version report using: ./gradlew dependencyUpdates
2225
// Also see https://github.com/ben-manes/gradle-versions-plugin.
@@ -69,6 +72,17 @@ dependencies {
6972
"io.netty:netty-tcnative-boringssl-static:2.0.8.Final"
7073
}
7174

75+
googleJavaFormat {
76+
toolVersion '1.7'
77+
source = 'src/main'
78+
include '**/*.java'
79+
}
80+
81+
verifyGoogleJavaFormat {
82+
source = 'src/main'
83+
include '**/*.java'
84+
}
85+
7286
protobuf {
7387
protoc {
7488
artifact = 'com.google.protobuf:protoc:3.6.1'
@@ -99,6 +113,17 @@ sourceSets {
99113
}
100114
}
101115

116+
checkstyle {
117+
configFile = file("$rootDir/../buildscripts/checkstyle.xml")
118+
toolVersion = "8.12"
119+
ignoreFailures = false
120+
configProperties["rootDir"] = "$rootDir/.."
121+
}
122+
123+
// Disable checkstyle if no java8.
124+
checkstyleMain.source = 'src/main'
125+
checkstyleTest.source = 'src/main'
126+
102127
// Provide convenience executables for trying out the examples.
103128
apply plugin: 'application'
104129

0 commit comments

Comments
 (0)