You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by pr...@apache.org on 2019/02/13 18:02:29 UTC
[geode] branch develop updated: GEODE-6395: Use md5 as Spotless
cache value. (#3186)
This is an automated email from the ASF dual-hosted git repository.
prhomberg pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push:
new 6bec09f GEODE-6395: Use md5 as Spotless cache value. (#3186)
6bec09f is described below
commit 6bec09fcdc08502ef82b122560bbc1b833fb21b1
Author: Patrick Rhomberg <pr...@pivotal.io>
AuthorDate: Wed Feb 13 10:02:19 2019 -0800
GEODE-6395: Use md5 as Spotless cache value. (#3186)
* This acts as a safeguard against developers forgetting to bump the input to 'bumpThisNumberIfACustomStepChanges'
---
gradle/spotless.gradle | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle
index 9b40405..f742e11 100644
--- a/gradle/spotless.gradle
+++ b/gradle/spotless.gradle
@@ -15,6 +15,16 @@
* limitations under the License.
*/
+// When a custom step changes, we need to bump the value passed to the method
+// bumpThisNumberIfACustomStepChanges
+// This has been historicaly easy to forget, however, and can cause failures in some rare cases.
+// To safeguard against this, we instead use the (partial) md5 of this file as that method input.
+def thisFile = file("${scriptDir}/spotless.gradle")
+def thisFileMd5 = thisFile.text.md5() as String
+def thisFileMd5Piece = thisFileMd5.substring(0, 8)
+def thisFileIntegerHash = Integer.parseUnsignedInt(thisFileMd5Piece, 16)
+logger.debug("Using partial md5 (${thisFileIntegerHash}) of file ${thisFile} as spotless bump.")
+
subprojects {
apply plugin: "com.diffplug.gradle.spotless"
spotless {
@@ -28,7 +38,7 @@ subprojects {
// 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(3)
+ bumpThisNumberIfACustomStepChanges(thisFileIntegerHash)
removeUnusedImports()
@@ -115,7 +125,7 @@ subprojects {
// 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)
+ bumpThisNumberIfACustomStepChanges(thisFileIntegerHash)
custom 'Use single-quote in project directives.', {
it.replaceAll(/project\(":([^"]*)"\)/, 'project(\':$1\')')