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:
parent
8a5751bc19
commit
23dfb368e1
22
build.gradle
22
build.gradle
|
@ -31,8 +31,7 @@ minecraft {
|
||||||
|
|
||||||
mappings = mcp_mappings
|
mappings = mcp_mappings
|
||||||
|
|
||||||
replaceIn "Reference.kt"
|
replaceIn "Forgelin.kt"
|
||||||
replaceIn "Reference.kt"
|
|
||||||
replace "@VERSION@", mod_version
|
replace "@VERSION@", mod_version
|
||||||
|
|
||||||
useDepAts = true
|
useDepAts = true
|
||||||
|
@ -90,6 +89,25 @@ shadowJar {
|
||||||
|
|
||||||
tasks.build.dependsOn 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 {
|
artifacts {
|
||||||
archives shadowJar
|
archives shadowJar
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,6 @@ object Forgelin {
|
||||||
|
|
||||||
const val MOD_ID = "forgelin"
|
const val MOD_ID = "forgelin"
|
||||||
const val NAME = "Forgelin"
|
const val NAME = "Forgelin"
|
||||||
const val VERSION = "1.4.2"
|
const val VERSION = "@VERSION@"
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue