Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve access transformers #5

Open
wants to merge 14 commits into
base: FG_2.3
Choose a base branch
from
Open
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ apply plugin: 'maven'
apply plugin: "com.gradle.plugin-publish"
//apply plugin: 'license'

group = 'net.minecraftforge.gradle'
version = '2.3-SNAPSHOT'
//version = '2.2.1'
group = 'org.dimdev'
version = '2.4-SNAPSHOT'

archivesBaseName = 'ForgeGradle'
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
Expand All @@ -28,7 +28,7 @@ repositories {
mavenLocal()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
url = "https://files.minecraftforge.net/maven"
}
maven {
// because Srg2Source needs an eclipse dependency.
Expand Down Expand Up @@ -74,7 +74,7 @@ dependencies {
compile 'com.nothome:javaxdelta:2.0.1' // GDIFF implementation for BinPatches
compile 'com.google.code.gson:gson:2.2.4' // Used instead of Argo for buuilding changelog.
compile 'com.github.tony19:named-regexp:0.2.3' // 1.7 Named regexp features
compile 'net.minecraftforge:forgeflower:1.5.380.22' // Fernflower Forge edition
compile 'net.minecraftforge:forgeflower:1.5.380.26' // Fernflower Forge edition

shade 'net.md-5:SpecialSource:1.8.3' // deobf and reobf

Expand Down Expand Up @@ -172,7 +172,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {

artifacts {
archives jar
archives javadocJar
//archives javadocJar
}

test {
Expand Down Expand Up @@ -218,7 +218,7 @@ uploadArchives {

if (project.hasProperty('forgeMavenPass'))
{
repository(url: "http://files.minecraftforge.net/maven/manage/upload") {
repository(url: "https://files.minecraftforge.net/maven/manage/upload") {
authentication(userName: "forge", password: project.getProperty('forgeMavenPass'))
}
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion src/main/java/edu/sc/seis/launch4j/Launch4jPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class Launch4jPlugin implements Plugin<Project>
static final String TASK_RUN_NAME = "createExe";
static final String TASK_LAUNCH4J_NAME = "launch4j";

static final String URL_LAUNCH4J = "http://files.minecraftforge.net/launch4j/launch4j-3.8.0-" + Constants.OPERATING_SYSTEM + ".zip";
static final String URL_LAUNCH4J = "https://files.minecraftforge.net/launch4j/launch4j-3.8.0-" + Constants.OPERATING_SYSTEM + ".zip";

static final String ZIP_LAUNCH4J = "build/launch4j.zip";
static final String DIR_LAUNCH4J = "build/launch4j";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -30,6 +30,7 @@
import java.net.URL;
import java.util.Arrays;
import java.util.Map;
import java.util.Map.Entry;

public abstract class BaseExtension
{
Expand Down Expand Up @@ -248,7 +249,61 @@ public void setMappings(String mappings)
}

protected void checkMappings() {
// mappings or mc version are null
if (mappingsChannel == null || Strings.isNullOrEmpty(version))
return;

// set now.
replacer.putReplacement(Constants.REPLACE_MCP_MCVERSION, version);

// gotta do this after setting the MC version
if (mappingsCustom != null)
return;

// check if it exists
Map<String, int[]> versionMap = mcpJson.get(version);
String channel = getMappingsChannelNoSubtype();
if (versionMap != null)
{
int[] channelList = versionMap.get(channel);
if (channelList == null)
throw new GradleConfigurationException("There is no such MCP mapping channel named " + channel);

// all is well with the world
if (searchArray(channelList, mappingsVersion))
return;
}

// if it gets here.. it wasnt found. Now we try to actually find it..
for (Entry<String, Map<String, int[]>> mcEntry : mcpJson.entrySet())
{
for (Entry<String, int[]> channelEntry : mcEntry.getValue().entrySet())
{
// found it!
if (searchArray(channelEntry.getValue(), mappingsVersion))
{
boolean rightMc = mcEntry.getKey().equals(version);
boolean rightChannel = channelEntry.getKey().equals(channel);

// right channel, but wrong mc
if (rightChannel && !rightMc)
{
project.getLogger().warn("Fuzzing selected mapping '" + getMappings() + "' to designed MC version " + mcEntry.getKey());
replacer.putReplacement(Constants.REPLACE_MCP_MCVERSION, mcEntry.getKey()); // set MC version
return;
}

// right MC , but wrong channel
else if (rightMc && !rightChannel)
{
throw new GradleConfigurationException("Selected mapping '" + getMappings() + "' doesnt exist! Perhaps you meant '" + channelEntry.getKey() + "_" + mappingsVersion + "'?");
}
}
}
}

// wasnt found
throw new GradleConfigurationException("The specified mapping '" + getMappings() + "' does not exist!");
}

@SuppressWarnings("unused")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -223,7 +223,7 @@ protected void afterEvaluate()
// ApplyFernFlowerTask ffTask = ((ApplyFernFlowerTask) project.getTasks().getByName("decompileJar"));
// ffTask.setClasspath(javaConv.getSourceSets().getByName("main").getCompileClasspath());

// http://files.minecraftforge.net/maven/de/oceanlabs/mcp/mcp_config/1.13.1/mcp_config-1.13.1.zip
// https://files.minecraftforge.net/maven/de/oceanlabs/mcp/mcp_config/1.13.1/mcp_config-1.13.1.zip
project.getDependencies().add(CONFIG_MAPPINGS, ImmutableMap.of(
"group", "de.oceanlabs.mcp",
"name", delayedString("mcp_" + REPLACE_MCP_CHANNEL).call(),
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/minecraftforge/gradle/common/Constants.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -116,11 +116,11 @@ public Boolean call(Object o)

// urls
public static final String URL_MC_MANIFEST = "https://launchermeta.mojang.com/mc/game/version_manifest.json";
public static final String URL_FF = "http://files.minecraftforge.net/fernflower-fix-1.0.zip";
public static final String URL_FF = "https://files.minecraftforge.net/fernflower-fix-1.0.zip";
public static final String URL_ASSETS = "http://resources.download.minecraft.net";
public static final String URL_LIBRARY = "https://libraries.minecraft.net/"; // Mojang's Cloudflare front end
//public static final String URL_LIBRARY = "https://minecraft-libraries.s3.amazonaws.com/"; // Mojang's AWS server, as Cloudflare is having issues, TODO: Switch back to above when their servers are fixed.
public static final String URL_FORGE_MAVEN = "http://files.minecraftforge.net/maven";
public static final String URL_FORGE_MAVEN = "https://files.minecraftforge.net/maven";
public static final List<String> URLS_MCP_JSON = Arrays.asList(
URL_FORGE_MAVEN + "/de/oceanlabs/mcp/versions.json",
"http://export.mcpbot.bspk.rs/versions.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -29,7 +29,7 @@ private PatcherConstants() {}

// installer stuff
static final String REPLACE_INSTALLER = "{INSTALLER}";
static final String INSTALLER_URL = "http://files.minecraftforge.net/maven/net/minecraftforge/installer/" + REPLACE_INSTALLER + "/installer-" + REPLACE_INSTALLER + "-shrunk.jar";
static final String INSTALLER_URL = "https://files.minecraftforge.net/maven/net/minecraftforge/installer/" + REPLACE_INSTALLER + "/installer-" + REPLACE_INSTALLER + "-shrunk.jar";

// new project defaults
static final String DEFAULT_PATCHES_DIR = "patches";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,22 @@ public void doTask() throws IOException {
AccessTransformationSet transformations = new AccessTransformationSet();
for (File file : getAts()) {
if (file.getName().endsWith(".jar")) {
JarFile jar = new JarFile(file);
ZipEntry entry = jar.getEntry("access_transformations.at");
if (entry != null) {
try (Scanner scanner = new Scanner(jar.getInputStream(entry))) {
while (scanner.hasNextLine()) {
transformations.addMinimumAccessLevel(scanner.nextLine());
try (JarFile jar = new JarFile(file)) {
ZipEntry entry = jar.getEntry("access_transformations.at");

if (entry != null) {
getLogger().info("Found transformer in " + file);

try (Scanner scanner = new Scanner(jar.getInputStream(entry))) {
while (scanner.hasNextLine()) {
transformations.addMinimumAccessLevel(scanner.nextLine());
}
}
}
}
}
} else {
getLogger().info("Found transformer in " + file);

try (Scanner scanner = new Scanner(file)) {
while (scanner.hasNextLine()) {
transformations.addMinimumAccessLevel(scanner.nextLine());
Expand Down Expand Up @@ -82,6 +88,9 @@ public void doTask() throws IOException {
out.closeEntry();
}
}

//Make sure there aren't any more transformations that failed to find their classes
transformations.ensureClear();
}

private static byte[] readStream(InputStream inputStream) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* A Gradle plugin for the creation of Minecraft mods and MinecraftForge plugins.
* Copyright (C) 2013-2018 Minecraft Forge
* Copyright (C) 2013-2019 Minecraft Forge
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
Loading