Add automatic version replacement in Forgelin.kt

This commit is contained in:
Marvin Rösch 2017-07-20 01:52:07 +02:00
parent 8a5751bc19
commit 6f3d0ded8d
No known key found for this signature in database
GPG Key ID: 25FA8AEEE65B8E5F
2 changed files with 23 additions and 5 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
}
@ -108,4 +126,4 @@ uploadArchives {
authentication(userName: project.hasProperty("mavenUser") ? project.mavenUser : System.getenv("mavenUser"), password: project.hasProperty("mavenPassword") ? project.mavenPassword : System.getenv("mavenPassword"))
}
}
}
}

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@"
}
}