Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Use the verify task in google-formatter instead of checkstyle (#55)
Browse files Browse the repository at this point in the history
- The checkstyle checks weren't 100pc in sync with the formatter
  checks, so we solely rely on the formatter's checks
- The build now fails if code isn't formatted correctly
  • Loading branch information
vprithvi authored Sep 20, 2016
1 parent 6ced2a7 commit 9df7efc
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ ext.apacheThriftVersion = '0.9.3'
ext.jerseyVersion = '2.22.2'
ext.slf4jVersion = '1.7.16'
ext.jacksonVersion = '2.7.4'
ext.checkstyleVersion = '7.1.1'

ext.junitVersion = '4.12'
ext.mockitoVersion = '2.0.2-beta'
Expand Down Expand Up @@ -42,30 +41,17 @@ subprojects {

[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'

// Set up checkstyle
apply plugin: 'checkstyle'
configurations {
checkstyleConfig
}

dependencies {
checkstyleConfig("com.puppycrawl.tools:checkstyle:${checkstyleVersion}") {
transitive = false
}
}

checkstyle {
config = resources.text.fromArchiveEntry(configurations.checkstyleConfig, 'google_checks.xml')
toolVersion = checkstyleVersion
}

repositories {
mavenCentral()
}

task listJars(description: 'Display all compile jars.') << {
configurations.compile.each { File file -> println file.name }
}

task verifyFormatting(type: com.github.sherter.googlejavaformatgradleplugin.VerifyGoogleJavaFormat) {
exclude '**/gen-java/**'
}

license {
header rootProject.file('license-template')
Expand All @@ -81,6 +67,7 @@ subprojects {
}

classes.dependsOn tasks.licenseFormat
classes.dependsOn tasks.verifyFormatting

apply from: '../gradle/publish.gradle'
}

0 comments on commit 9df7efc

Please sign in to comment.