diff --git a/build.gradle b/build.gradle index c089896..dfe284e 100644 --- a/build.gradle +++ b/build.gradle @@ -7,8 +7,15 @@ buildscript { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true } } + +plugins { + id 'com.diffplug.spotless' version '5.12.5' apply false +} + apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' +apply plugin: "pmd" +apply plugin: "com.diffplug.spotless" apply plugin: 'maven-publish' version = "${project.version}-${project.build_number}" @@ -19,6 +26,24 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17) compileJava.options.compilerArgs << "-Xlint:all,-classfile,-processing,-serial" << "-Werror" +pmd { + toolVersion '6.35.0' + incrementalAnalysis.set(true) + ruleSets.clear() + ruleSetFiles = rootProject.files("spotless/pmd-ruleset.xml") +} + +spotless { + enforceCheck = false // workaround around jenkins having wrong line endings in some files + // we explicitly check in github actions builds + java { + indentWithTabs() + eclipse().configFile rootProject.file('spotless/eclipseformat.xml') + removeUnusedImports() + importOrderFile rootProject.file('spotless/eclipse.importorder') + } +} + minecraft { mappings channel: "official", version: "${project.mc_version}" // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..c665ff9 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,5 @@ +pluginManagement { + repositories { + gradlePluginPortal() + } +} diff --git a/spotless/eclipse.importorder b/spotless/eclipse.importorder new file mode 100644 index 0000000..28d72d7 --- /dev/null +++ b/spotless/eclipse.importorder @@ -0,0 +1,14 @@ +#Organize Import Order +#Sat Mar 07 20:20:06 CET 2020 +11=\# +10=java +9=javax +8=vazkii +7=top +6=org +5=net +4=mezz +3=me +2=it +1=dev +0=com diff --git a/spotless/eclipseformat.xml b/spotless/eclipseformat.xml new file mode 100644 index 0000000..b7474f6 --- /dev/null +++ b/spotless/eclipseformat.xml @@ -0,0 +1,365 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spotless/pmd-ruleset.xml b/spotless/pmd-ruleset.xml new file mode 100644 index 0000000..eaeece0 --- /dev/null +++ b/spotless/pmd-ruleset.xml @@ -0,0 +1,50 @@ + + + + + + Botania PMD rules + + + + + + + + + + + + + + + + + + + + + Debug annotation makes Mixin export the class + or output the bytecode to the game log, + and should not be left in committed code. + + 3 + + + + + + + + + + +