Skip to content

Commit

Permalink
Geode-4950 + GEODE-4951: Upgrade spotless version and reduce run time.
Browse files Browse the repository at this point in the history
* GEODE-4950: Update spotless plugin to newest version.
* GEODE-4951: Allow spotless to skip UP-TO-DATE files.
  • Loading branch information
PurelyApplied authored Apr 3, 2018
1 parent 8894267 commit caf588b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ buildscript {
classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.2.0"
classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.0.1'
classpath "com.diffplug.gradle.spotless:spotless:2.2.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.10.0"
classpath "me.champeau.gradle:jmh-gradle-plugin:0.3.1"
classpath "com.pedjak.gradle.plugins:dockerized-test:0.5.4"
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
Expand Down
27 changes: 16 additions & 11 deletions gradle/spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,17 @@ subprojects {
exclude '**/generated-src/**'
}

// As the method name suggests, bump this number if any of the below "custom" rules change.
// Spotless will not run on unchanged files unless this number changes.
bumpThisNumberIfACustomStepChanges(0)

custom 'Remove commented-out import statements', {
it.replaceAll(/\n\/\/ import .*?;.*/, '')
}

custom 'End files with a single blank line', {
it.replaceAll(/\s+$/, '\n')
}

// Removes end-of-line whitespace
trimTrailingWhitespace()

// Enforce style import order
importOrderFile "${project(':geode-core').projectDir}/../etc/eclipseOrganizeImports.importorder"

// The formatter is relative to geode-core and not the root project as the root project would change
// if Geode and submodules are included as part of a different gradle project.
eclipseFormatFile "${project(':geode-core').projectDir}/../etc/eclipse-java-google-style.xml"

// Enforce style modifier order
custom 'Modifier ordering', {
def modifierRanking = [
Expand Down Expand Up @@ -70,6 +63,18 @@ subprojects {
}
)
}


// Notes on eclipse formatter version:
// 4.6.3 is consistent with existing / previous behavior.
// 4.7.1 works, but had different default whitespace rules, notably with mid-ternary linebreak.
// 4.7.2 exists but is currently incompatible with our style file, raising NPEs.

// The format file is relative to geode-core and not the root project as the root project would change
// if Geode and submodules are included as part of a different gradle project.
eclipse('4.6.3').configFile "${project(':geode-core').projectDir}/../etc/eclipse-java-google-style.xml"
trimTrailingWhitespace()
endWithNewline()
}
}
}

0 comments on commit caf588b

Please sign in to comment.