-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild.gradle.kts
125 lines (106 loc) · 3.82 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import com.diffplug.gradle.spotless.FormatExtension
plugins {
eclipse
alias(libs.plugins.ideaExt)
alias(libs.plugins.indra) apply false
alias(libs.plugins.indra.publishing) apply false
alias(libs.plugins.indra.git) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.indra.licenserSpotless) apply false
alias(libs.plugins.eclipseApt) apply false
}
group = "org.spongepowered"
version = "0.2.1-SNAPSHOT"
spotless {
format("configs") {
target("**/*.yaml", "**/*.yml", "**/*.xml", "**/*.json")
val excludedTargets = mutableListOf(".idea/**", "build/**", ".gradle/**")
project.subprojects {
excludedTargets.add(projectDir.toRelativeString(rootDir) + "/**")
}
targetExclude(excludedTargets)
endWithNewline()
trimTrailingWhitespace()
}
}
subprojects {
apply(plugin="net.kyori.indra")
apply(plugin="net.kyori.indra.licenser.spotless")
apply(plugin="net.kyori.indra.git")
apply(plugin="com.diffplug.eclipse.apt")
apply(plugin="signing")
extensions.configure(net.kyori.indra.IndraExtension::class) {
github("SpongePowered", "VanillaGradle") {
ci(true)
}
mitLicense()
javaVersions {
testWith(8, 11, 17)
}
configurePublications {
pom {
organization {
name.set("SpongePowered")
url.set("https://spongepowered.org")
}
}
}
signWithKeyFromPrefixedProperties("sponge")
if (
project.hasProperty("spongeSnapshotRepo") &&
project.hasProperty("spongeReleaseRepo")
) {
publishSnapshotsTo("sponge", project.property("spongeSnapshotRepo") as String)
publishReleasesTo("sponge", project.property("spongeReleaseRepo") as String)
}
}
extensions.configure(net.kyori.indra.licenser.spotless.IndraSpotlessLicenserExtension::class) {
val organization: String by project
val projectUrl: String by project
properties().apply {
put("name", "VanillaGradle")
put("organization", organization)
put("url", projectUrl)
}
licenseHeaderFile(rootProject.file("HEADER.txt"))
}
spotless {
fun FormatExtension.applyCommonSettings() {
endWithNewline()
indentWithSpaces(4)
trimTrailingWhitespace()
toggleOffOn("@formatter:off", "@formatter:on")
}
java {
targetExclude("build/generated/**")
applyCommonSettings()
importOrderFile(rootProject.file(".spotless/sponge.importorder"))
}
kotlinGradle {
applyCommonSettings()
// ktlint()
// .editorConfigOverride(mapOf("ij_kotlin_imports_layout" to "$*,|,*,|,java.**,|,javax.**"))
}
}
tasks {
withType(Jar::class).configureEach {
// project.extensions.getByType(net.kyori.indra.git.IndraGitExtension::class).applyVcsInformationToManifest(manifest)
manifest.attributes(
"Specification-Title" to "VanillaGradle",
"Specification-Vendor" to "SpongePowered",
"Specification-Version" to project.version,
"Implementation-Title" to project.name,
"Implementation-Version" to project.version,
"Implementation-Vendor" to "SpongePowered"
)
}
withType(JavaCompile::class).configureEach {
options.compilerArgs.add("-Xlint:-processing")
doFirst {
if (javaCompiler.get().metadata.languageVersion >= JavaLanguageVersion.of(21)) {
options.compilerArgs.add("-Xlint:-this-escape")
}
}
}
}
}