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

Add support for shadow under forked plugin id #146

Merged
merged 3 commits into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Stream;
Expand All @@ -71,6 +74,10 @@
public final class VanillaGradle implements Plugin<Object> {

private static final String SHADOW_JAR_TASK_CLASS_NAME = "com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar";
private static final List<String> SHADOW_PLUGIN_IDS = Collections.unmodifiableList(Arrays.asList(
"com.github.johnrengelman.shadow",
"io.github.goooler.shadow"
));
private static final AtomicBoolean VERSION_ANNOUNCED = new AtomicBoolean();

@Override
Expand Down Expand Up @@ -107,10 +114,12 @@ private void applyToProject(final Project project) {
});
});

project.getPlugins().withId("com.github.johnrengelman.shadow", plugin -> {
final Provider<Set<String>> provider = project.provider(new ResolveMinecraftLibNames(minecraftConfig));
VanillaGradle.applyShadowConfiguration(project.getTasks(), provider, plugin);
});
for (final String shadowPluginId : SHADOW_PLUGIN_IDS) {
project.getPlugins().withId(shadowPluginId, plugin -> {
final Provider<Set<String>> provider = project.provider(new ResolveMinecraftLibNames(minecraftConfig));
VanillaGradle.applyShadowConfiguration(project.getTasks(), provider, plugin);
});
}

this.createDumpClass(project, minecraftConfig);
this.createDisplayMinecraftVersions(project.getPlugins().getPlugin(MinecraftRepositoryPlugin.class).service(), project.getTasks());
Expand Down
Loading