mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
Merge pull request #12 from solonovamax/auto-version
Automatically update the Terra version on build.
This commit is contained in:
commit
979fce5856
@ -35,8 +35,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")
|
||||||
@ -51,12 +52,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.2", 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")
|
||||||
@ -72,6 +87,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") {
|
||||||
@ -150,24 +183,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.3.0-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."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user