mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-19 07:11:14 +00:00
Automatically update the Terra version on build.
Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
This commit is contained in:
+37
-22
@@ -34,8 +34,9 @@ val versionObj = Version("1", "3", "1", true)
|
|||||||
version = versionObj
|
version = versionObj
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// compileOnly("org.polydev.gaea:gaea:1.14.2-github-actions+9d59b49")
|
val geaVersion = "1.14.2"
|
||||||
compileOnly(name = "Gaea-1.14.2", group = "")
|
compileOnly(name = "Gaea-${geaVersion}", group = "")
|
||||||
|
testImplementation(name = "Gaea-${geaVersion}", group = "")
|
||||||
|
|
||||||
compileOnly("org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT")
|
compileOnly("org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT")
|
||||||
compileOnly("org.jetbrains:annotations:20.1.0")
|
compileOnly("org.jetbrains:annotations:20.1.0")
|
||||||
@@ -50,12 +51,26 @@ dependencies {
|
|||||||
// JUnit.
|
// JUnit.
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")
|
||||||
|
|
||||||
testImplementation(name = "Gaea-1.14.0", group = "")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val compileJava: JavaCompile by tasks
|
val compileJava: JavaCompile by tasks
|
||||||
|
val mainSourceSet: SourceSet = sourceSets["main"]
|
||||||
|
|
||||||
|
val tokenizeJavaSources = task<Copy>(name = "tokenizeJavaSources") {
|
||||||
|
from(mainSourceSet.allSource) {
|
||||||
|
include("**/plugin.yml")
|
||||||
|
val tokens = mapOf("VERSION" to versionObj.toString())
|
||||||
|
|
||||||
|
filter(org.apache.tools.ant.filters.ReplaceTokens::class, "tokens" to tokens)
|
||||||
|
}
|
||||||
|
into("build/tokenizedSources")
|
||||||
|
includeEmptyDirs = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
compileJava.apply {
|
compileJava.apply {
|
||||||
|
dependsOn(tokenizeJavaSources)
|
||||||
|
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
doFirst {
|
doFirst {
|
||||||
options.compilerArgs = mutableListOf("-Xlint:all")
|
options.compilerArgs = mutableListOf("-Xlint:all")
|
||||||
@@ -71,6 +86,24 @@ tasks.test {
|
|||||||
maxParallelForks = 12
|
maxParallelForks = 12
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
|
from(tokenizeJavaSources.destinationDir)
|
||||||
|
|
||||||
|
archiveClassifier.set("")
|
||||||
|
archiveBaseName.set("Terra")
|
||||||
|
setVersion(project.version)
|
||||||
|
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
||||||
|
relocate("org.bstats.bukkit", "com.dfsek.terra.lib.bstats")
|
||||||
|
relocate("parsii", "com.dfsek.terra.lib.parsii")
|
||||||
|
relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.build {
|
||||||
|
dependsOn(tasks.shadowJar)
|
||||||
|
// dependsOn(testWithPaper)
|
||||||
|
// testWithPaper.mustRunAfter(tasks.shadowJar)
|
||||||
|
}
|
||||||
|
|
||||||
val testDir = "target/server/"
|
val testDir = "target/server/"
|
||||||
|
|
||||||
val setupServer = tasks.create("setupServer") {
|
val setupServer = tasks.create("setupServer") {
|
||||||
@@ -149,24 +182,6 @@ val testWithPaper = task<JavaExec>(name = "testWithPaper") {
|
|||||||
classpath = files("${testDir}/paper.jar")
|
classpath = files("${testDir}/paper.jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<ShadowJar>("shadowJar") {
|
|
||||||
archiveClassifier.set("")
|
|
||||||
archiveBaseName.set("Terra")
|
|
||||||
setVersion(project.version)
|
|
||||||
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
|
||||||
relocate("org.bstats.bukkit", "com.dfsek.terra.lib.bstats")
|
|
||||||
relocate("parsii", "com.dfsek.terra.lib.parsii")
|
|
||||||
relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib")
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.build {
|
|
||||||
dependsOn(tasks.test)
|
|
||||||
dependsOn(tasks.shadowJar)
|
|
||||||
// dependsOn(testWithPaper)
|
|
||||||
tasks.shadowJar.get().mustRunAfter(tasks.test)
|
|
||||||
// testWithPaper.mustRunAfter(tasks.shadowJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version class that does version stuff.
|
* Version class that does version stuff.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: "Terra"
|
name: "Terra"
|
||||||
depend: [ "Gaea" ]
|
depend: [ "Gaea" ]
|
||||||
main: "com.dfsek.terra.Terra"
|
main: "com.dfsek.terra.Terra"
|
||||||
version: "1.2.1-BETA"
|
version: "@VERSION@"
|
||||||
load: "STARTUP"
|
load: "STARTUP"
|
||||||
api-version: "1.16"
|
api-version: "1.16"
|
||||||
description: "An insanely powerful free & open-source data-driven world generator."
|
description: "An insanely powerful free & open-source data-driven world generator."
|
||||||
|
|||||||
Reference in New Issue
Block a user