Skip to content

Commit eac6d48

Browse files
committed
Use ForgeGradle-standard way to set versions.
This 'works around' a 'bug' in runclient. At any rate, runclient now works, and there's less code. Yay.
1 parent 58652d7 commit eac6d48

4 files changed

Lines changed: 15 additions & 20 deletions

File tree

build.gradle

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ apply from: 'gradle.properties'
3131

3232
group = GROUP
3333
archivesBaseName = ARCHIVE_NAME
34+
version = MAJORVERSION + "." + MINORVERSION + "." + REVISION
3435

3536
targetCompatibility = '1.6'
3637
sourceCompatibility = '1.6'
@@ -51,6 +52,12 @@ minecraft {
5152
// TODO(Baughn): After moving to 1.10, this should be replaced with the shadow plugin,
5253
// e.g. as used in https://github.com/Emberwalker/Laundarray/blob/master/build.gradle
5354
srgExtra "PK: org/apache/commons/math3 mods/eln/libs/org/apache/commons/math3"
55+
56+
replaceIn "Version.java"
57+
replace "@VERSION@", project.version
58+
replace "@MAJORVERSION@", MAJORVERSION
59+
replace "@MINORVERSION@", MINORVERSION
60+
replace "@REVISION@", REVISION
5461
}
5562

5663
configurations {
@@ -177,20 +184,6 @@ def getMinecratfDir() {
177184
return outDir
178185
}
179186

180-
task readVersion(type: JavaExec, dependsOn: classes) {
181-
classpath configurations.runtime, sourceSets.main.output
182-
main = "mods.eln.misc.Version"
183-
standardOutput = new ByteArrayOutputStream()
184-
doLast {
185-
project.setVersion(standardOutput.toString())
186-
jar.manifest {
187-
attributes 'Implementation-Version': project.version
188-
}
189-
}
190-
}
191-
192-
jar.dependsOn('readVersion')
193-
194187
// Custom task to build and copy the mod Jar to the default local Minecraft folder
195188
task buildAndCopyJar(dependsOn: 'build', type: Copy) {
196189
group = 'ELN'

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
MAJORVERSION = 1
2+
MINORVERSION = 12
3+
REVISION = 0
4+
15
GROUP = 'net.electricalage.eln'
26
ARCHIVE_NAME = 'ElectricalAge'
37
MAPURL = 'https://github.com/Electrical-Age/ElectricalAge/releases/download/BETA-1.11r51/ElectricalAge_tutorial_map-BETA-1.11r51.zip'

src/main/java/mods/eln/Eln.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@
174174

175175
import static mods.eln.i18n.I18N.*;
176176

177-
@Mod(modid = Eln.MODID, name = Eln.NAME, version = Version.VERSION_STRING)
178-
// @Mod(modid = "Eln", name = "Electrical Age", version = "BETA-1.2.0b")
179-
// @NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = { "miaouMod" }, packetHandler = PacketHandler.class)
177+
@Mod(modid = Eln.MODID, name = Eln.NAME, version = "@VERSION@")
180178
public class Eln {
181179
// Mod information (override from 'mcmod.info' file)
182180
public final static String MODID = "Eln";

src/main/java/mods/eln/misc/Version.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
public final class Version {
1212

1313
/** Major version code. */
14-
public final static int MAJOR = 1;
14+
public final static int MAJOR = Integer.parseInt("@MAJORVERSION@");
1515

1616
/** Minor version code. */
17-
public final static int MINOR = 12;
17+
public final static int MINOR = Integer.parseInt("@MINORVERSION@");
1818

1919
/** Revision version code. */
20-
public final static int REVISION = 0;
20+
public final static int REVISION = Integer.parseInt("@REVISION@");
2121

2222
/**
2323
* Unique version code. Must be a String for annotations. Used to check if a

0 commit comments

Comments
 (0)