Skip to content

Commit

Permalink
Set up spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
williewillus committed Jul 4, 2022
1 parent f90ed7e commit 4b9cd1d
Show file tree
Hide file tree
Showing 5 changed files with 459 additions and 0 deletions.
25 changes: 25 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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')
Expand Down
5 changes: 5 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pluginManagement {
repositories {
gradlePluginPortal()
}
}
14 changes: 14 additions & 0 deletions spotless/eclipse.importorder
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 4b9cd1d

Please sign in to comment.