Change project version to partially depend on the MC version

This commit is contained in:
Jonas Herzig
2018-02-22 11:14:33 +01:00
parent ad6345de88
commit 943fa45bbc

View File

@@ -23,16 +23,20 @@ apply plugin: 'org.spongepowered.mixin'
sourceCompatibility = 1.8 sourceCompatibility = 1.8
targetCompatibility = 1.8 targetCompatibility = 1.8
version = gitDescribe() afterEvaluate {
def gitVer = gitDescribe()
if (gitVer.startsWith('1.12.2-')) gitVer = gitVer.substring('1.12.2-'.length()) // until the first proper version
version = project.minecraft.version + '-' + gitVer
}
group= "com.replaymod" group= "com.replaymod"
archivesBaseName = "replaymod" archivesBaseName = "replaymod"
minecraft { minecraft {
coreMod = 'com.replaymod.core.LoadingPlugin' coreMod = 'com.replaymod.core.LoadingPlugin'
runDir = "../../eclipse" runDir = "../../eclipse"
replace '@MOD_VERSION@', project.version
} }
afterEvaluate { afterEvaluate {
minecraft.replace '@MOD_VERSION@', project.version
// Includes intentional whitespace to stop Forge from declaring the mod to be compatible with // Includes intentional whitespace to stop Forge from declaring the mod to be compatible with
// a newer srg-compatible MC version (that may be using a different protocol version) // a newer srg-compatible MC version (that may be using a different protocol version)
minecraft.replace '@MC_VERSION@', "[ ${project.minecraft.version} ]" minecraft.replace '@MC_VERSION@', "[ ${project.minecraft.version} ]"
@@ -197,8 +201,8 @@ def gitDescribe() {
processResources processResources
{ {
// this will ensure that this task is redone when the versions change. // this will ensure that this task is redone when the versions change.
inputs.property "version", project.version inputs.property 'version', { project.version }
inputs.property "mcversion", project.minecraft.version inputs.property 'mcversion', { project.minecraft.version }
// replace stuff in mcmod.info, nothing else // replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {