diff --git a/build.gradle b/build.gradle index a5e6f6882..7f67e674b 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,7 @@ apply from: 'gradle.properties' group = GROUP archivesBaseName = ARCHIVE_NAME +version = MAJORVERSION + "." + MINORVERSION + "." + REVISION targetCompatibility = '1.6' sourceCompatibility = '1.6' @@ -51,6 +52,12 @@ minecraft { // TODO(Baughn): After moving to 1.10, this should be replaced with the shadow plugin, // e.g. as used in https://github.com/Emberwalker/Laundarray/blob/master/build.gradle srgExtra "PK: org/apache/commons/math3 mods/eln/libs/org/apache/commons/math3" + + replaceIn "Version.java" + replace "@VERSION@", project.version + replace "@MAJORVERSION@", MAJORVERSION + replace "@MINORVERSION@", MINORVERSION + replace "@REVISION@", REVISION } configurations { @@ -177,20 +184,6 @@ def getMinecratfDir() { return outDir } -task readVersion(type: JavaExec, dependsOn: classes) { - classpath configurations.runtime, sourceSets.main.output - main = "mods.eln.misc.Version" - standardOutput = new ByteArrayOutputStream() - doLast { - project.setVersion(standardOutput.toString()) - jar.manifest { - attributes 'Implementation-Version': project.version - } - } -} - -jar.dependsOn('readVersion') - // Custom task to build and copy the mod Jar to the default local Minecraft folder task buildAndCopyJar(dependsOn: 'build', type: Copy) { group = 'ELN' diff --git a/gradle.properties b/gradle.properties index 5cfad84dc..312fde335 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,7 @@ +MAJORVERSION = 1 +MINORVERSION = 12 +REVISION = 0 + GROUP = 'net.electricalage.eln' ARCHIVE_NAME = 'ElectricalAge' MAPURL = 'https://github.com/Electrical-Age/ElectricalAge/releases/download/BETA-1.11r51/ElectricalAge_tutorial_map-BETA-1.11r51.zip' diff --git a/src/main/java/mods/eln/Eln.java b/src/main/java/mods/eln/Eln.java index 511766954..3d7a7e476 100644 --- a/src/main/java/mods/eln/Eln.java +++ b/src/main/java/mods/eln/Eln.java @@ -174,9 +174,7 @@ import static mods.eln.i18n.I18N.*; -@Mod(modid = Eln.MODID, name = Eln.NAME, version = Version.VERSION_STRING) -// @Mod(modid = "Eln", name = "Electrical Age", version = "BETA-1.2.0b") -// @NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = { "miaouMod" }, packetHandler = PacketHandler.class) +@Mod(modid = Eln.MODID, name = Eln.NAME, version = "@VERSION@") public class Eln { // Mod information (override from 'mcmod.info' file) public final static String MODID = "Eln"; diff --git a/src/main/java/mods/eln/misc/Version.java b/src/main/java/mods/eln/misc/Version.java index 0b3d0dd07..af6268f1b 100644 --- a/src/main/java/mods/eln/misc/Version.java +++ b/src/main/java/mods/eln/misc/Version.java @@ -11,13 +11,13 @@ public final class Version { /** Major version code. */ - public final static int MAJOR = 1; + public final static int MAJOR = Integer.parseInt("@MAJORVERSION@"); /** Minor version code. */ - public final static int MINOR = 12; + public final static int MINOR = Integer.parseInt("@MINORVERSION@"); /** Revision version code. */ - public final static int REVISION = 0; + public final static int REVISION = Integer.parseInt("@REVISION@"); /** * Unique version code. Must be a String for annotations. Used to check if a