Implemented alternative ProcessResources (#36)

This commit is contained in:
Glare
2020-12-08 10:26:16 -06:00
committed by GitHub
parent ad58a1efeb
commit 59a24ef37f
+9 -15
View File
@@ -62,22 +62,16 @@ dependencies {
val compileJava: JavaCompile by tasks val compileJava: JavaCompile by tasks
val mainSourceSet: SourceSet = sourceSets["main"] val mainSourceSet: SourceSet = sourceSets["main"]
val tokenizeJavaSources = task<Copy>(name = "tokenizeJavaSources") { tasks.withType<ProcessResources> {
from(mainSourceSet.allSource) { include("*.yml")
include("**/plugin.yml") filter<org.apache.tools.ant.filters.ReplaceTokens>(
println("version: $versionObj") "tokens" to mapOf(
val tokens = mapOf("VERSION" to versionObj.toString()) "VERSION" to project.version.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")
@@ -94,7 +88,8 @@ tasks.test {
} }
tasks.named<ShadowJar>("shadowJar") { tasks.named<ShadowJar>("shadowJar") {
from(tokenizeJavaSources.destinationDir) // Tell shadow to download the packs
dependsOn(downloadDefaultPacks)
archiveClassifier.set("") archiveClassifier.set("")
archiveBaseName.set("Terra") archiveBaseName.set("Terra")
@@ -164,7 +159,6 @@ val downloadDefaultPacks = tasks.create("downloadDefaultPacks") {
downloadPack(netherPackUrl) downloadPack(netherPackUrl)
} }
} }
tasks.processResources.get().dependsOn(downloadDefaultPacks)
val testWithPaper = task<JavaExec>(name = "testWithPaper") { val testWithPaper = task<JavaExec>(name = "testWithPaper") {
standardInput = System.`in` standardInput = System.`in`