diff --git a/Makefile b/Makefile index 4689ef8af2..927b597232 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ GRADLE ?= ./gradlew .PHONY: all -all: check jacocoRootReport javadocAll sinttest +all: check format jacocoRootReport javadocAll sinttest .PHONY: codecov codecov: @@ -12,6 +12,10 @@ codecov: check: $(GRADLE) $@ +.PHONY: format +format: + $(GRADLE) spotlessApply + .PHONY: eclipse eclipse: $(GRADLE) $@ diff --git a/build-logic/build.gradle b/build-logic/build.gradle index 7ef7fbbc5d..d248738adb 100644 --- a/build-logic/build.gradle +++ b/build-logic/build.gradle @@ -12,4 +12,5 @@ dependencies { implementation "net.ltgt.gradle:gradle-errorprone-plugin:4.0.1" implementation "gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.2" implementation "ru.vyarus:gradle-animalsniffer-plugin:1.7.1" + implementation "com.diffplug.spotless:spotless-plugin-gradle:7.0.0.BETA2" } diff --git a/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle b/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle index aedba32fbf..e43d4f8988 100644 --- a/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle +++ b/build-logic/src/main/groovy/org.igniterealtime.smack.java-common-conventions.gradle @@ -11,6 +11,7 @@ plugins { id 'maven-publish' id 'net.ltgt.errorprone' id 'signing' + id 'com.diffplug.spotless' id 'jacoco-report-aggregation' id 'test-report-aggregation' @@ -335,6 +336,13 @@ coveralls { jacocoReportPath 'build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml' } +spotless { + java { + eclipse().configFile("${rootDir}/resources/eclipse/smack_formatter.xml") + importOrderFile("${rootDir}/resources/eclipse/smack.importorder") + } +} + def getGitCommit() { def projectDirFile = new File("$projectDir")