diff --git a/src/main/java/net/fabricmc/loom/providers/MinecraftProvider.java b/src/main/java/net/fabricmc/loom/providers/MinecraftProvider.java index 4deed46..22baa2a 100644 --- a/src/main/java/net/fabricmc/loom/providers/MinecraftProvider.java +++ b/src/main/java/net/fabricmc/loom/providers/MinecraftProvider.java @@ -68,6 +68,7 @@ public class MinecraftProvider extends DependencyProvider { @Override public void provide(DependencyInfo dependency, Consumer postPopulationScheduler) throws Exception { minecraftVersion = dependency.getDependency().getVersion(); + boolean offline = getProject().getGradle().getStartParameter().isOffline(); initFiles(); diff --git a/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java b/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java index 81cb42a..21fa886 100644 --- a/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java +++ b/src/main/java/net/fabricmc/loom/util/LoomDependencyManager.java @@ -33,6 +33,8 @@ import java.util.Map; import com.google.gson.JsonObject; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; +import org.gradle.api.artifacts.Dependency; +import org.gradle.api.artifacts.DependencySet; import org.gradle.api.artifacts.ExternalModuleDependency; import org.gradle.api.artifacts.repositories.MavenArtifactRepository; @@ -103,7 +105,20 @@ public class LoomDependencyManager { for (ProviderList list : targetProviders) { Configuration configuration = project.getConfigurations().getByName(list.key); - configuration.getDependencies().forEach(dependency -> { + DependencySet dependencies = configuration.getDependencies(); + + if (dependencies.isEmpty()) { + throw new IllegalArgumentException(String.format("No '%s' dependency was specified!", list.key)); + } + + if (dependencies.size() > 1) { + throw new IllegalArgumentException(String.format("Only one '%s' dependency should be specified, but %d were!", + list.key, + dependencies.size()) + ); + } + + for (Dependency dependency : dependencies) { for (DependencyProvider provider : list.providers) { DependencyProvider.DependencyInfo info = DependencyInfo.create(project, dependency, configuration); @@ -113,7 +128,7 @@ public class LoomDependencyManager { throw new RuntimeException("Failed to provide " + dependency.getGroup() + ":" + dependency.getName() + ":" + dependency.getVersion() + " : " + e.getMessage(), e); } } - }); + } } SourceRemapper sourceRemapper = new SourceRemapper(project, true);