Skip to content

Commit

Permalink
chore: add back task to do version string replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed May 8, 2023
1 parent 074888e commit 1260a80
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ minecraft
}



dependencies {
minecraft "net.minecraftforge:forge:${project.mc_version}-${project.forge_version}"
}
Expand Down Expand Up @@ -78,6 +79,20 @@ processResources
}
}

import org.apache.tools.ant.filters.ReplaceTokens
def copyDir = "$compileJava.temporaryDir/replaced"

task tokenReplace(type:Copy){
var test = sourceSets.main.java.sourceDirectories;
from(sourceSets.main.java.sourceDirectories)
into copyDir
filter(ReplaceTokens, tokens: [VERSION: project.version])
}

compileJava.setSource(copyDir)

compileJava.dependsOn(tokenReplace)

/* Dev build */
task deobfJar(type: Jar) {
from sourceSets.main.output
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/mchorse/mclib/McLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@
* All it does is provides common code for McHorse's mods.
*/
@Mod.EventBusSubscriber
@Mod(modid = McLib.MOD_ID, name = "McLib", updateJSON = "https://raw.githubusercontent.com/mchorse/mclib/1.12/version.json")
@Mod(modid = McLib.MOD_ID, name = "McLib", version = McLib.VERSION, updateJSON = "https://raw.githubusercontent.com/mchorse/mclib/1.12/version.json")
public class McLib
{
public static final String MOD_ID = "mclib";
public static final String VERSION = "@VERSION@";

/* Proxies */
public static final String CLIENT_PROXY = "mchorse.mclib.ClientProxy";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mchorse/mclib/core/McLibCMInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public Object getMod()
@Override
public String getVersion()
{
return "%VERSION%";
return "@VERSION@";
}
}

0 comments on commit 1260a80

Please sign in to comment.