Update Gradle, Fix mappings not being extracted when using local mappings.
This commit is contained in:
parent
cc56011035
commit
aa483181c0
7 changed files with 16 additions and 40 deletions
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Thu Sep 22 09:58:14 BST 2016
|
||||
#Wed May 10 22:17:52 BST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip
|
||||
|
|
|
@ -29,7 +29,6 @@ import com.google.gson.Gson;
|
|||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.fabricmc.loom.task.DownloadTask;
|
||||
import net.fabricmc.loom.task.GenIdeaProjectTask;
|
||||
import net.fabricmc.loom.util.Constants;
|
||||
import net.fabricmc.loom.util.ModRemapper;
|
||||
import net.fabricmc.loom.util.Version;
|
||||
|
@ -44,10 +43,7 @@ import org.gradle.api.tasks.compile.JavaCompile;
|
|||
import org.gradle.api.tasks.javadoc.Javadoc;
|
||||
import org.gradle.plugins.ide.eclipse.model.EclipseModel;
|
||||
import org.gradle.plugins.ide.idea.model.IdeaModel;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
|
@ -264,14 +260,8 @@ public class AbstractPlugin implements Plugin<Project> {
|
|||
});
|
||||
|
||||
project.afterEvaluate(project12 -> {
|
||||
project12.getTasks().getByName("idea").dependsOn(project12.getTasks().getByName("cleanIdea")).dependsOn(project12.getTasks().getByName("extractNatives"));
|
||||
project12.getTasks().getByName("idea").doLast(task -> {
|
||||
try {
|
||||
GenIdeaProjectTask.genIdeaRuns(project12);
|
||||
} catch (IOException | ParserConfigurationException | SAXException | TransformerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
project12.getTasks().getByName("idea").dependsOn(project12.getTasks().getByName("cleanIdea")).dependsOn(project12.getTasks().getByName("setupFabric")).dependsOn(project12.getTasks().getByName("extractNatives"));
|
||||
project12.getTasks().getByName("idea").finalizedBy(project12.getTasks().getByName("genIdeaWorkspace"));
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public class LoomGradlePlugin extends AbstractPlugin {
|
|||
makeTask("setupFabric", DefaultTask.class).dependsOn("processMods");
|
||||
|
||||
makeTask("extractNatives", ExtractNativesTask.class).dependsOn("download");
|
||||
makeTask("genIdeaWorkspace", GenIdeaProjectTask.class).dependsOn("idea");
|
||||
|
||||
makeTask("vscode", GenVSCodeProjectTask.class).dependsOn("extractNatives");
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ public class DownloadTask extends DefaultTask {
|
|||
}
|
||||
|
||||
// Force add LaunchWrapper
|
||||
dependencyHandler.add(Constants.CONFIG_MC_DEPENDENCIES, "net.minecraft:launchwrapper:1.11");
|
||||
dependencyHandler.add(Constants.CONFIG_MC_DEPENDENCIES, "net.minecraft:launchwrapper:1.12");
|
||||
|
||||
Version.AssetIndex assetIndex = version.assetIndex;
|
||||
|
||||
|
|
|
@ -29,7 +29,9 @@ import net.fabricmc.loom.LoomGradleExtension;
|
|||
import net.fabricmc.loom.util.Constants;
|
||||
import net.fabricmc.loom.util.IdeaRunConfig;
|
||||
import net.fabricmc.loom.util.Version;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -49,10 +51,13 @@ import java.io.File;
|
|||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
public class GenIdeaProjectTask {
|
||||
public class GenIdeaProjectTask extends DefaultTask {
|
||||
|
||||
public static void genIdeaRuns(Project project) throws IOException, ParserConfigurationException, SAXException, TransformerException {
|
||||
@TaskAction
|
||||
public void genIdeaRuns() throws IOException, ParserConfigurationException, SAXException, TransformerException {
|
||||
Project project = this.getProject();
|
||||
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
|
||||
project.getLogger().lifecycle(":Building idea workspace");
|
||||
|
||||
File file = new File(project.getName() + ".iml");
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
|
@ -101,27 +106,6 @@ public class GenIdeaProjectTask {
|
|||
|
||||
Version version = gson.fromJson(new FileReader(Constants.MINECRAFT_JSON.get(extension)), Version.class);
|
||||
|
||||
for (Version.Library library : version.libraries) {
|
||||
if (library.allowed() && library.getFile(extension) != null && library.getFile(extension).exists()) {
|
||||
Element node = doc.createElement("orderEntry");
|
||||
node.setAttribute("type", "module-library");
|
||||
Element libraryElement = doc.createElement("library");
|
||||
Element classes = doc.createElement("CLASSES");
|
||||
Element javadoc = doc.createElement("JAVADOC");
|
||||
Element sources = doc.createElement("SOURCES");
|
||||
Element root = doc.createElement("root");
|
||||
root.setAttribute("url", "jar://" + library.getFile(extension).getAbsolutePath() + "!/");
|
||||
classes.appendChild(root);
|
||||
libraryElement.appendChild(classes);
|
||||
libraryElement.appendChild(javadoc);
|
||||
libraryElement.appendChild(sources);
|
||||
node.appendChild(libraryElement);
|
||||
component.appendChild(node);
|
||||
} else if (!library.allowed()) {
|
||||
project.getLogger().info(":" + library.getFile(extension).getName() + " is not allowed on this os");
|
||||
}
|
||||
}
|
||||
|
||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||
Transformer transformer = transformerFactory.newTransformer();
|
||||
DOMSource source = new DOMSource(doc);
|
||||
|
|
|
@ -58,8 +58,9 @@ public class MapJarsTask extends DefaultTask {
|
|||
FileUtils.copyFile(Constants.MINECRAFT_MERGED_JAR.get(extension), Constants.MINECRAFT_MAPPED_JAR.get(extension));
|
||||
return;
|
||||
}
|
||||
this.getLogger().lifecycle(":unpacking mappings");
|
||||
if (!Constants.MAPPINGS_DIR.get(extension).exists()) {
|
||||
if (!Constants.MAPPINGS_DIR.get(extension).exists() || extension.localMappings) {
|
||||
this.getLogger().lifecycle(":unpacking mappings");
|
||||
FileUtils.deleteDirectory(Constants.MAPPINGS_DIR.get(extension));
|
||||
ZipUtil.unpack(Constants.MAPPINGS_ZIP.get(extension), Constants.MAPPINGS_DIR.get(extension));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue