From 9416fc1b0cc1776df2151b5d35a5c38507d5647e Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Wed, 10 Jul 2024 22:03:19 +0300 Subject: [PATCH] Switch to "include" filter on Forge's repo (#226) Fixes #221. The set of groups is sufficient to build Forge mods on 1.14-1.21 and should work for all other versions too. --- .../fabricmc/loom/LoomRepositoryPlugin.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java b/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java index d1632e3e6..480d3d8b4 100644 --- a/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java +++ b/src/main/java/net/fabricmc/loom/LoomRepositoryPlugin.java @@ -24,6 +24,8 @@ package net.fabricmc.loom; +import java.util.List; + import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.artifacts.ArtifactRepositoryContainer; @@ -40,6 +42,14 @@ import net.fabricmc.loom.util.MirrorUtil; public class LoomRepositoryPlugin implements Plugin { + private static final List FORGE_GROUPS = List.of( + "net.minecraftforge", + "cpw.mods", + "de.oceanlabs", + "net.jodah", + "org.mcmodlauncher" + ); + @Override public void apply(@NotNull PluginAware target) { if (target instanceof Settings settings) { @@ -95,9 +105,11 @@ private void declareRepositories(RepositoryHandler repositories, LoomFiles files repo.setUrl("https://maven.minecraftforge.net/"); repo.content(descriptor -> { - descriptor.excludeGroupByRegex("org\\.eclipse\\.?.*"); - // Some of these downloads hang and this is already available from central to begin with. - descriptor.excludeGroup("org.ow2.asm"); + // Only include these groups to avoid slowing down/hanging the build, + // or downloading incorrect artifacts. + for (String group : FORGE_GROUPS) { + descriptor.includeGroupAndSubgroups(group); + } }); repo.metadataSources(sources -> { sources.mavenPom();