Skip to content

Commit

Permalink
Apply spotless to templates so that they're neat and clean.
Browse files Browse the repository at this point in the history
  • Loading branch information
dweiss committed May 22, 2024
1 parent f30bbf6 commit 8c4cad5
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion hppc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'java-library'
alias(deps.plugins.spotless)
}

sourceSets {
Expand Down Expand Up @@ -45,7 +46,7 @@ task generateMainTemplates(type: GenerateTemplatesTask) {
}

compileJava {
dependsOn generateMainTemplates
dependsOn generateMainTemplates, "spotlessTemplatesApply"

options.compilerArgs.addAll([
'--module-version',
Expand All @@ -58,6 +59,23 @@ task generateTestTemplates(type: GenerateTemplatesTask) {
outputDir file("$buildDir/generated/test/templates")
}

spotless {
format('templates', com.diffplug.gradle.spotless.JavaExtension, {
target "$buildDir/generated/main/templates"

bumpThisNumberIfACustomStepChanges(1)
custom 'cleanimports', { str -> str.replaceAll('/\\*\\s*\\*/', "") }

lineEndings 'UNIX'
endWithNewline()
googleJavaFormat(deps.versions.googleJavaFormat.get())
})
}

tasks.named("spotlessTemplates").configure {
dependsOn(generateMainTemplates)
}

compileTestJava {
dependsOn generateTestTemplates
}
Expand Down

0 comments on commit 8c4cad5

Please sign in to comment.