1+ import com.diffplug.gradle.spotless.SpotlessExtension
12import net.kyori.indra.IndraExtension
23import net.kyori.indra.gradle.IndraPluginPublishingExtension
3- import org.cadixdev.gradle.licenser.LicenseExtension
44
55plugins {
66 id(" com.gradle.plugin-publish" ) apply false
77 id(" net.kyori.indra" ) apply false
8- id(" net.kyori.indra.license-header " ) apply false
8+ id(" com.diffplug.spotless " ) apply false
99 id(" net.kyori.indra.publishing.gradle-plugin" ) apply false
1010}
1111
@@ -17,7 +17,7 @@ subprojects {
1717 apply (JavaGradlePluginPlugin ::class )
1818 apply (" com.gradle.plugin-publish" )
1919 apply (" net.kyori.indra" )
20- apply (" net.kyori.indra.license-header " )
20+ apply (" com.diffplug.spotless " )
2121 apply (" net.kyori.indra.publishing.gradle-plugin" )
2222 apply (" net.kyori.indra.git" )
2323 }
@@ -77,17 +77,28 @@ subprojects {
7777 }
7878 }
7979
80- extensions.configure(LicenseExtension ::class ) {
80+ extensions.configure(SpotlessExtension ::class ) {
8181 val name: String by project
8282 val organization: String by project
8383 val projectUrl: String by project
8484
85- properties {
86- this [" name" ] = name
87- this [" organization" ] = organization
88- this [" url" ] = projectUrl
85+ java {
86+ val lineSep = System .lineSeparator()
87+ val contents = rootProject.file(" HEADER.txt" )
88+ .readLines().asSequence()
89+ .map { (" * " + it).trimEnd() }
90+ .joinToString(prefix = " /*${lineSep} " , postfix = " ${lineSep} */" , separator = lineSep)
91+
92+ val formattedContents = groovy.text.SimpleTemplateEngine ()
93+ .createTemplate(contents)
94+ .make(mutableMapOf (
95+ " name" to name,
96+ " organization" to organization,
97+ " url" to projectUrl
98+ ))
99+
100+ licenseHeader(formattedContents.toString())
89101 }
90- header(rootProject.file(" HEADER.txt" ))
91102 }
92103
93104 extensions.configure(SigningExtension ::class ) {
0 commit comments