Include project group in ForgeVersion and determine path to patched jar.

While testing we install to net.minecraftforge.test. So don't hardcode it.
This commit is contained in:
LexManos 2018-12-04 11:55:50 -08:00
parent a3c8e04ee6
commit 76d912c0ba
4 changed files with 29 additions and 10 deletions

View File

@ -86,7 +86,8 @@ project(':forge') {
apply plugin: 'net.minecrell.licenser'
apply plugin: 'de.undercouch.download'
compileJava.sourceCompatibility = compileJava.targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava.sourceCompatibility = compileJava.targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
group = 'net.minecraftforge.test' //TODO: remove test when we finish patches and want users to find it
sourceSets {
main {
@ -129,7 +130,8 @@ project(':forge') {
'mc.version': MC_VERSION,
'mcp.version': MCP_VERSION,
'forge.version': "${project.version.substring(MC_VERSION.length() + 1)}".toString(),
'forge.spec': SPEC_VERSION
'forge.spec': SPEC_VERSION,
'forge.group': project.group
]
}
serverRun {
@ -141,7 +143,8 @@ project(':forge') {
'mc.version': MC_VERSION,
'mcp.version': MCP_VERSION,
'forge.version': "${project.version.substring(MC_VERSION.length() + 1)}".toString(),
'forge.spec': SPEC_VERSION
'forge.spec': SPEC_VERSION,
'forge.group': project.group
]
}
}
@ -162,7 +165,6 @@ project(':forge') {
return "${MC_VERSION}-${tag}.${offset}${t -> if (branch != null) t << '-' + branch}".toString() //Bake the response instead of making it dynamic
}
group = 'net.minecraftforge.test' //TODO: remove when we jenkins is working
version = getVersion()
applyPatches {
canonicalizeAccess true
@ -215,7 +217,8 @@ project(':forge') {
"mc.version": "${MC_VERSION}",
"mcp.version": "${MCP_VERSION}",
"forge.version": "${project.version.substring(MC_VERSION.length() + 1)}",
"forge.spec":"${SPEC_VERSION}"
"forge.spec":"${SPEC_VERSION}",
"forge.group": project.group
]
environment += [
target:'fmldevclient',
@ -242,7 +245,8 @@ project(':forge') {
"mc.version": "${MC_VERSION}",
"mcp.version": "${MCP_VERSION}",
"forge.version": "${project.version.substring(MC_VERSION.length() + 1)}",
"forge.spec":"${SPEC_VERSION}"
"forge.spec":"${SPEC_VERSION}",
"forge.group": project.group
]
environment target:'fmldevserver'
workingDir 'runserver'
@ -613,7 +617,7 @@ project(':forge') {
'Specification-Title': 'Forge',
'Specification-Vendor': 'Forge Development LLC',
'Specification-Version': SPEC_VERSION,
'Implementation-Title': 'Forge',
'Implementation-Title': project.group,
'Implementation-Version': project.version.substring(MC_VERSION.length() + 1),
'Implementation-Vendor': 'Forge Development LLC'
] as LinkedHashMap, 'net/minecraftforge/versions/forge/')

View File

@ -29,6 +29,7 @@ import net.minecraftforge.versions.mcp.MCPVersion;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
@ -49,7 +50,7 @@ public class FMLClientLaunchProvider extends FMLCommonLaunchHandler implements I
public Path[] identifyTransformationTargets()
{
Path libsPath = findLibsPath();
Path patchedBinariesPath = libsPath.resolve(Paths.get("net","minecraftforge","forge",MCPVersion.getMCVersion()+"-"+ForgeVersion.getVersion(),"forge-"+MCPVersion.getMCVersion()+"-"+ForgeVersion.getVersion()+"-client.jar"));
Path patchedBinariesPath = libsPath.resolve(Paths.get(ForgeVersion.getGroup().replace('.', File.separatorChar), "forge", MCPVersion.getMCVersion() + "-" + ForgeVersion.getVersion(), "forge-" + MCPVersion.getMCVersion() + "-" + ForgeVersion.getVersion() + "-client.jar"));
Path srgMcPath = libsPath.resolve(Paths.get("net","minecraft", "client", MCPVersion.getMCPandMCVersion(), "client-"+MCPVersion.getMCPandMCVersion()+"-srg.jar"));
LOGGER.info("SRG MC at {} is {}", srgMcPath.toString(), Files.exists(srgMcPath) ? "present" : "missing");
LOGGER.info("Forge patches at {} is {}", patchedBinariesPath.toString(), Files.exists(patchedBinariesPath) ? "present" : "missing");

View File

@ -28,6 +28,7 @@ import net.minecraftforge.versions.mcp.MCPVersion;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@ -47,7 +48,7 @@ public class FMLServerLaunchProvider extends FMLCommonLaunchHandler implements I
public Path[] identifyTransformationTargets()
{
Path libsPath = findLibsPath();
Path patchedBinariesPath = libsPath.resolve(Paths.get("net","minecraftforge","forge",MCPVersion.getMCVersion()+"-"+ForgeVersion.getVersion(),"forge-"+MCPVersion.getMCVersion()+"-"+ForgeVersion.getVersion()+"-server.jar"));
Path patchedBinariesPath = libsPath.resolve(Paths.get(ForgeVersion.getGroup().replace('.', File.separatorChar), "forge", MCPVersion.getMCVersion() + "-" + ForgeVersion.getVersion(), "forge-" + MCPVersion.getMCVersion() + "-" + ForgeVersion.getVersion() + "-server.jar"));
Path srgMcPath = libsPath.resolve(Paths.get("net","minecraft", "server", MCPVersion.getMCPandMCVersion(), "server-"+MCPVersion.getMCPandMCVersion()+"-srg.jar"));
LOGGER.info("SRG MC at {} is {}", srgMcPath.toString(), Files.exists(srgMcPath) ? "present" : "missing");
LOGGER.info("Forge patches at {} is {}", patchedBinariesPath.toString(), Files.exists(patchedBinariesPath) ? "present" : "missing");

View File

@ -38,8 +38,8 @@ public class ForgeVersion
public static final String mcpVersion = "9.42";
private static final String forgeVersion;
private static final String forgeSpec;
private static final String forgeGroup;
static {
String vers = ForgeVersion.class.getPackage().getImplementationVersion();
@ -52,10 +52,19 @@ public class ForgeVersion
spec = System.getProperty("forge.spec");
}
if (spec == null) throw new RuntimeException("Missing forge spec, cannot continue");
String group = ForgeVersion.class.getPackage().getImplementationTitle();
if (group == null) {
group = System.getProperty("forge.group");
}
if (group == null) {
group = "net.minecraftforge"; // If all else fails, Our normal group
}
forgeVersion = vers;
forgeSpec = spec;
forgeGroup = group;
LOGGER.info(CORE, "Found Forge version {}", forgeVersion);
LOGGER.info(CORE, "Found Forge spec {}", forgeSpec);
LOGGER.info(CORE, "Found Forge group {}", forgeGroup);
}
public static String getVersion()
@ -77,5 +86,9 @@ public class ForgeVersion
public static String getSpec() {
return forgeSpec;
}
public static String getGroup() {
return forgeGroup;
}
}