diff --git a/build.gradle.kts b/build.gradle.kts index 53d771aa9..d8716e0fb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -35,8 +35,9 @@ val versionObj = Version("1", "3", "1", true) version = versionObj dependencies { -// compileOnly("org.polydev.gaea:gaea:1.14.2-github-actions+9d59b49") - compileOnly(name = "Gaea-1.14.2", group = "") + val geaVersion = "1.14.2" + compileOnly(name = "Gaea-${geaVersion}", group = "") + testImplementation(name = "Gaea-${geaVersion}", group = "") compileOnly("org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT") compileOnly("org.jetbrains:annotations:20.1.0") @@ -51,12 +52,26 @@ dependencies { // JUnit. testImplementation("org.junit.jupiter:junit-jupiter-api: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 mainSourceSet: SourceSet = sourceSets["main"] + +val tokenizeJavaSources = task(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 { + dependsOn(tokenizeJavaSources) + options.encoding = "UTF-8" doFirst { options.compilerArgs = mutableListOf("-Xlint:all") @@ -72,6 +87,24 @@ tasks.test { maxParallelForks = 12 } +tasks.named("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 setupServer = tasks.create("setupServer") { @@ -150,24 +183,6 @@ val testWithPaper = task(name = "testWithPaper") { classpath = files("${testDir}/paper.jar") } -tasks.named("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. diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index dac160311..1ea9b8982 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: "Terra" depend: [ "Gaea" ] main: "com.dfsek.terra.Terra" -version: "1.3.0-BETA" +version: "@VERSION@" load: "STARTUP" api-version: "1.16" description: "An insanely powerful free & open-source data-driven world generator."