Add automatic version replacement in Forgelin.kt (#20)

* Add automatic version replacement in Forgelin.kt

* Remove unnecessary newlines caused by IDEA
This commit is contained in:
Marvin Rösch 2017-07-20 03:11:55 +02:00 committed by Shadowfacts
parent 8a5751bc19
commit 23dfb368e1
2 changed files with 21 additions and 3 deletions

View File

@ -31,8 +31,7 @@ minecraft {
mappings = mcp_mappings
replaceIn "Reference.kt"
replaceIn "Reference.kt"
replaceIn "Forgelin.kt"
replace "@VERSION@", mod_version
useDepAts = true
@ -90,6 +89,25 @@ shadowJar {
tasks.build.dependsOn shadowJar
import net.minecraftforge.gradle.user.TaskSourceCopy
// Enables source replacements for Kotlin code
for (set in sourceSets) {
def taskName = "source${set.name.capitalize()}Kotlin"
def dir = new File(project.getBuildDir(), "sources/${set.name}/kotlin")
task(taskName, type: TaskSourceCopy) {
source = set.getKotlin()
output = dir
}
def compileTask = tasks[set.getCompileTaskName("kotlin")]
compileTask.source = dir
compileTask.dependsOn taskName
def dirPath = dir.toPath()
compileKotlin.include {
return it.file.toPath().startsWith(dirPath)
}
}
artifacts {
archives shadowJar
}

View File

@ -10,6 +10,6 @@ object Forgelin {
const val MOD_ID = "forgelin"
const val NAME = "Forgelin"
const val VERSION = "1.4.2"
const val VERSION = "@VERSION@"
}