Skip to content

Commit

Permalink
Add checkstyle config
Browse files Browse the repository at this point in the history
  • Loading branch information
pnwpedro committed Nov 4, 2024
1 parent adf0495 commit b346859
Show file tree
Hide file tree
Showing 3 changed files with 455 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/gradle-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
java-version: '17'
distribution: corretto

- name: Run checkstyle
run: ./gradlew checkstyleMain

- name: Run Gradle test
run: ./gradlew test -i

Expand Down
22 changes: 19 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import com.vanniktech.maven.publish.SonatypeHost

plugins {
id 'checkstyle'
id 'java'

// this is a hopefully temporary plugin until maven central can add official gradle support
id 'com.vanniktech.maven.publish' version '0.29.0'
}
Expand Down Expand Up @@ -47,7 +51,7 @@ dependencies {
}

mavenPublishing {
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()

coordinates(project.group, project.name, project.version)
Expand Down Expand Up @@ -88,13 +92,13 @@ mavenPublishing {

// tasks

task printVersion {
tasks.register('printVersion') {
doLast {
println project.version
}
}

task writeProps(type: WriteProperties) {
tasks.register('writeProps', WriteProperties) {
destinationFile = file("src/main/resources/version.properties")
encoding = 'UTF-8'
property('version', project.version)
Expand All @@ -109,5 +113,17 @@ tasks.register('packageJar', Zip) {
}
}

checkstyle {
toolVersion = '10.19.0' // Latest Checkstyle version at the time of writing
ignoreFailures = false
}

tasks.withType(Checkstyle).configureEach {
reports {
xml.required = false
html.required = true
}
}

processResources.dependsOn(writeProps)
sourcesJar.dependsOn(writeProps)
Loading

0 comments on commit b346859

Please sign in to comment.