Skip to content
Closed
Show file tree
Hide file tree
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 @@ -122,8 +122,15 @@ public TaskProvider<RemapJar> reobfuscate(TaskProvider<? extends AbstractArchive
// Move plain jars into a subdirectory to be able to maintain the same classifier for the reobfuscated version
task.getDestinationDirectory().set(task.getProject().getLayout().getBuildDirectory().dir("devlibs"));
});
return reobf;
}

// Replace the publication of the jar task with the reobfuscated jar
/**
* Replace the publication of the jar task with the reobfuscated jar
*
* @param reobf the remapJar task to replace
*/
public void publishReobfuscated(TaskProvider<RemapJar> reobf) {
var configurations = project.getConfigurations();
var java = (AdhocComponentWithVariants) project.getComponents().getByName("java");
for (var configurationName : List.of(JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME, JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME)) {
Expand All @@ -146,8 +153,6 @@ public TaskProvider<RemapJar> reobfuscate(TaskProvider<? extends AbstractArchive
java.withVariantsFromConfiguration(config, ConfigurationVariantDetails::skip);
java.addVariantsFromConfiguration(reobfConfig, spec -> {});
}

return reobf;
}

private static <T> void copyAttribute(Project project, Attribute<T> attribute, Configuration fromConfig, Configuration toConfig) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public void enable(Project project, LegacyForgeModdingSettings settings, LegacyF
var reobfJar = obf.reobfuscate(
project.getTasks().named(JavaPlugin.JAR_TASK_NAME, Jar.class),
project.getExtensions().getByType(SourceSetContainer.class).getByName(SourceSet.MAIN_SOURCE_SET_NAME));
obf.publishReobfuscated(reobfJar);

project.getTasks().named("assemble", assemble -> assemble.dependsOn(reobfJar));

Expand Down