From 29631ad1bb916bea2f1f94a052b32f046e8124d0 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Fri, 31 Mar 2017 12:27:55 +0100 Subject: [PATCH] Fix crash when resolving libs of new snapshot. --- build.gradle | 2 +- src/main/java/net/fabricmc/loom/AbstractPlugin.java | 2 +- src/main/java/net/fabricmc/loom/task/DownloadTask.java | 2 +- src/main/java/net/fabricmc/loom/util/Version.java | 10 +++++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index f7bc861..743ee8a 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/license.g group = 'net.fabricmc' archivesBaseName = project.name.toLowerCase() -version = '0.0.6-SNAPSHOT' +version = '0.0.7-SNAPSHOT' repositories { mavenCentral() diff --git a/src/main/java/net/fabricmc/loom/AbstractPlugin.java b/src/main/java/net/fabricmc/loom/AbstractPlugin.java index bb67baa..0c4e8d7 100644 --- a/src/main/java/net/fabricmc/loom/AbstractPlugin.java +++ b/src/main/java/net/fabricmc/loom/AbstractPlugin.java @@ -233,7 +233,7 @@ public class AbstractPlugin implements Plugin { for (Version.Library library : version.libraries) { if (library.allowed() && library.getFile(extension) != null) { String configName = Constants.CONFIG_MC_DEPENDENCIES; - if (library.name.contains("java3d") || library.name.contains("paulscode") || library.name.contains("lwjgl") || library.name.contains("twitch") || library.name.contains("jinput")) { + if (library.name.contains("java3d") || library.name.contains("paulscode") || library.name.contains("lwjgl") || library.name.contains("twitch") || library.name.contains("jinput") || library.name.contains("text2speech") || library.name.contains("objc")) { configName = Constants.CONFIG_MC_DEPENDENCIES_CLIENT; } project1.getDependencies().add(configName, library.getArtifactName()); diff --git a/src/main/java/net/fabricmc/loom/task/DownloadTask.java b/src/main/java/net/fabricmc/loom/task/DownloadTask.java index f37191a..6418e83 100644 --- a/src/main/java/net/fabricmc/loom/task/DownloadTask.java +++ b/src/main/java/net/fabricmc/loom/task/DownloadTask.java @@ -118,7 +118,7 @@ public class DownloadTask extends DefaultTask { if (library.allowed() && library.getFile(extension) != null) { // By default, they are all available on all sides String configName = Constants.CONFIG_MC_DEPENDENCIES; - if (library.name.contains("java3d") || library.name.contains("paulscode") || library.name.contains("lwjgl") || library.name.contains("twitch") || library.name.contains("jinput")) { + if (library.name.contains("java3d") || library.name.contains("paulscode") || library.name.contains("lwjgl") || library.name.contains("twitch") || library.name.contains("jinput") || library.name.contains("text2speech") || library.name.contains("objc")) { configName = Constants.CONFIG_MC_DEPENDENCIES_CLIENT; } dependencyHandler.add(configName, library.getArtifactName()); diff --git a/src/main/java/net/fabricmc/loom/util/Version.java b/src/main/java/net/fabricmc/loom/util/Version.java index 1fcccc4..474b51e 100644 --- a/src/main/java/net/fabricmc/loom/util/Version.java +++ b/src/main/java/net/fabricmc/loom/util/Version.java @@ -24,6 +24,7 @@ package net.fabricmc.loom.util; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.fabricmc.loom.LoomGradleExtension; @@ -108,7 +109,14 @@ public class Version { if (artifact == null) { artifact = new Artifact(name); } - return artifact.getArtifact(natives == null ? artifact.getClassifier() : natives.get(OperatingSystem.getOS()).getAsString()); + if(natives != null){ + JsonElement jsonElement = natives.get(OperatingSystem.getOS()); + if(jsonElement != null){ + return artifact.getArtifact(jsonElement.getAsString()); + } + } + + return artifact.getArtifact(artifact.classifier); } private class Artifact {