1
+ import com.diffplug.gradle.spotless.SpotlessExtension
1
2
import net.kyori.indra.IndraExtension
2
3
import net.kyori.indra.gradle.IndraPluginPublishingExtension
3
- import org.cadixdev.gradle.licenser.LicenseExtension
4
4
5
5
plugins {
6
6
id(" com.gradle.plugin-publish" ) apply false
7
7
id(" net.kyori.indra" ) apply false
8
- id(" net.kyori.indra.license-header " ) apply false
8
+ id(" com.diffplug.spotless " ) apply false
9
9
id(" net.kyori.indra.publishing.gradle-plugin" ) apply false
10
10
}
11
11
@@ -17,7 +17,7 @@ subprojects {
17
17
apply (JavaGradlePluginPlugin ::class )
18
18
apply (" com.gradle.plugin-publish" )
19
19
apply (" net.kyori.indra" )
20
- apply (" net.kyori.indra.license-header " )
20
+ apply (" com.diffplug.spotless " )
21
21
apply (" net.kyori.indra.publishing.gradle-plugin" )
22
22
apply (" net.kyori.indra.git" )
23
23
}
@@ -77,17 +77,28 @@ subprojects {
77
77
}
78
78
}
79
79
80
- extensions.configure(LicenseExtension ::class ) {
80
+ extensions.configure(SpotlessExtension ::class ) {
81
81
val name: String by project
82
82
val organization: String by project
83
83
val projectUrl: String by project
84
84
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())
89
101
}
90
- header(rootProject.file(" HEADER.txt" ))
91
102
}
92
103
93
104
extensions.configure(SigningExtension ::class ) {
0 commit comments