-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.gradle.kts
123 lines (102 loc) · 4.12 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
plugins {
`java-library`
alias(libs.plugins.vanilla.gradle) apply false
`maven-publish`
signing
alias(libs.plugins.nexuspublish)
}
group = "net.minestom"
version = System.getenv("TAG_VERSION") ?: "${libs.versions.minecraft.get()}-dev"
description = "Generator for Minecraft game data values"
java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.register("generateData") {
logger.warn("Mojang requires all source-code and mappings used to be governed by the Minecraft EULA.")
logger.warn("Please read the Minecraft EULA located at https://account.mojang.com/documents/minecraft_eula.")
logger.warn("In order to agree to the EULA you must create a file called eula.txt with the text 'eula=true'.")
val eulaTxt = File("${rootProject.projectDir}/eula.txt")
logger.warn("The file must be located at '${eulaTxt.absolutePath}'.")
if ((eulaTxt.exists() && eulaTxt.readText(Charsets.UTF_8).equals("eula=true", true))
|| project.properties["eula"].toString().toBoolean()
|| System.getenv("EULA")?.toBoolean() == true
) {
logger.warn("")
logger.warn("The EULA has been accepted and signed.")
logger.warn("")
} else {
throw GradleException("Data generation has been halted as the EULA has not been signed.")
}
logger.warn("It is unclear if the data from the data generator also adhere to the Minecraft EULA.")
logger.warn("Please consult your own legal team!")
logger.warn("All data is given independently without warranty, guarantee or liability of any kind.")
logger.warn("The data may or may not be the intellectual property of Mojang Studios.")
logger.warn("")
// Simplified by Sponge's VanillaGradle
dependsOn(project(":DataGenerator").tasks.getByName<JavaExec>("run") {
args = arrayListOf(rootDir.resolve("src/main/resources").absolutePath)
})
}
tasks.processResources.get().dependsOn("generateData")
nexusPublishing {
this.packageGroup.set("net.minestom")
repositories.sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
if (System.getenv("SONATYPE_USERNAME") != null) {
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}
}
publishing.publications.create<MavenPublication>("maven") {
groupId = "net.minestom"
artifactId = "data"
version = project.version.toString()
from(project.components["java"])
pom {
name.set("data")
description.set("Minecraft game data values")
url.set("https://github.com/minestom/MinestomDataGenerator")
licenses {
license {
name.set("Apache 2.0")
url.set("https://github.com/minestom/MinestomDataGenerator/blob/main/LICENSE")
}
}
developers {
developer {
id.set("mworzala")
name.set("Matt Worzala")
email.set("matt@hollowcube.dev")
}
developer {
id.set("TheMode")
}
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/minestom/MinestomDataGenerator/issues")
}
scm {
connection.set("scm:git:git://github.com/minestom/MinestomDataGenerator.git")
developerConnection.set("scm:git:git@github.com:minestom/MinestomDataGenerator.git")
url.set("https://github.com/minestom/MinestomDataGenerator")
tag.set("HEAD")
}
ciManagement {
system.set("Github Actions")
url.set("https://github.com/minestom/MinestomDataGenerator/actions")
}
}
}
signing {
isRequired = System.getenv("CI") != null
val privateKey = System.getenv("GPG_PRIVATE_KEY")
val keyPassphrase = System.getenv()["GPG_PASSPHRASE"]
useInMemoryPgpKeys(privateKey, keyPassphrase)
sign(publishing.publications)
}