-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle.kts
79 lines (70 loc) · 2.5 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
import org.spongepowered.gradle.plugin.config.PluginLoaders
import org.spongepowered.plugin.metadata.model.PluginDependency
plugins {
val spongeGradleVersion = "2.2.0"
`java-library`
id("org.spongepowered.gradle.plugin") version spongeGradleVersion
id("org.spongepowered.gradle.ore") version spongeGradleVersion // for Ore publishing
}
group = "org.spongepowered"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
sponge {
apiVersion("11.0.0-SNAPSHOT")
license("CHANGEME")
loader {
name(PluginLoaders.JAVA_PLAIN)
version("1.0")
}
plugin("example") {
displayName("Example")
entrypoint("org.spongepowered.example.Example")
description("Just testing things...")
links {
homepage("https://spongepowered.org")
source("https://spongepowered.org/source")
issues("https://spongepowered.org/issues")
}
contributor("Spongie") {
description("Lead Developer")
}
dependency("spongeapi") {
loadOrder(PluginDependency.LoadOrder.AFTER)
optional(false)
}
}
}
val javaTarget = 21
java {
sourceCompatibility = JavaVersion.toVersion(javaTarget)
targetCompatibility = JavaVersion.toVersion(javaTarget)
if (JavaVersion.current() < JavaVersion.toVersion(javaTarget)) {
toolchain.languageVersion.set(JavaLanguageVersion.of(javaTarget))
}
}
tasks.withType(JavaCompile::class).configureEach {
options.apply {
encoding = "utf-8" // Consistent source file encoding
release.set(javaTarget)
}
}
// Make sure all tasks which produce archives (jar, sources jar, javadoc jar, etc) produce more consistent output
tasks.withType(AbstractArchiveTask::class).configureEach {
isReproducibleFileOrder = true
isPreserveFileTimestamps = false
}
// Optional: configure publication to Ore
// Publish using the publishToOre task
// An API token is needed for this, by default read from the ORE_TOKEN environment variable
oreDeployment {
// The default publication here is automatically configured by SpongeGradle
// using the first-created plugin's ID as the project ID
// A version body is optional, to provide additional information about the release
/*
defaultPublication {
// Read the version body from the file whose path is provided to the changelog gradle property
versionBody.set(providers.gradleProperty("changelog").map { file(it).readText(Charsets.UTF_8) }.orElse(""))
}*/
}