Skip to content

Commit

Permalink
Enable jarjar in platform plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Technici4n committed Nov 28, 2023
1 parent 73a88b4 commit c193c13
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
import net.minecraftforge.srgutils.IMappingFile;
import net.neoforged.gradle.common.dependency.ExtraJarDependencyManager;
import net.neoforged.gradle.common.extensions.IdeManagementExtension;
import net.neoforged.gradle.common.extensions.JarJarExtension;
import net.neoforged.gradle.common.runtime.extensions.CommonRuntimeExtension;
import net.neoforged.gradle.common.runtime.tasks.AccessTransformerFileGenerator;
import net.neoforged.gradle.common.runtime.tasks.DownloadAssets;
import net.neoforged.gradle.common.tasks.JarJar;
import net.neoforged.gradle.common.tasks.WriteIMappingsFile;
import net.neoforged.gradle.common.tasks.PotentiallySignJar;
import net.neoforged.gradle.common.util.CacheableIMappingFile;
Expand Down Expand Up @@ -175,6 +177,7 @@ public void runtime(final String neoFormVersion, Directory patches, Directory re
final Configuration gameLayerLibraryConfiguration = project.getConfigurations().create("gameLayerLibrary").setTransitive(false);
final Configuration pluginLayerLibraryConfiguration = project.getConfigurations().create("pluginLayerLibrary").setTransitive(false);
final Configuration userdevCompileOnlyConfiguration = project.getConfigurations().create("userdevCompileOnly").setTransitive(false);
final Configuration jarJarConfiguration = project.getConfigurations().create("jarJar");

clientExtraConfiguration.getDependencies().add(project.getDependencies().create(ExtraJarDependencyManager.generateClientCoordinateFor(runtimeDefinition.getSpecification().getMinecraftVersion())));

Expand All @@ -188,6 +191,8 @@ public void runtime(final String neoFormVersion, Directory patches, Directory re

project.getExtensions().configure(RunsConstants.Extensions.RUN_TYPES, (Action<NamedDomainObjectContainer<RunType>>) types -> types.configureEach(type -> configureRunType(project, type, moduleOnlyConfiguration, gameLayerLibraryConfiguration, pluginLayerLibraryConfiguration, runtimeDefinition)));
project.getExtensions().configure(RunsConstants.Extensions.RUNS, (Action<NamedDomainObjectContainer<Run>>) runs -> runs.configureEach(run -> configureRun(run, runtimeDefinition)));

project.getExtensions().create(net.neoforged.gradle.dsl.common.extensions.JarJar.class, JarJarExtension.EXTENSION_NAME, JarJarExtension.class, project);

final LauncherProfile launcherProfile = project.getExtensions().create(LauncherProfile.class, "launcherProfile", LauncherProfile.class);
final InstallerProfile installerProfile = project.getExtensions().create("installerProfile", InstallerProfile.class);
Expand Down Expand Up @@ -321,7 +326,7 @@ public void runtime(final String neoFormVersion, Directory patches, Directory re
CommonRuntimeExtension.configureCommonRuntimeTaskParameters(task, runtimeDefinition, workingDirectory);
});

final TaskProvider<Jar> universalJar = project.getTasks().register("universalJar", Jar.class, task -> {
final TaskProvider<JarJar> universalJar = project.getTasks().register("universalJar", JarJar.class, task -> {
task.getArchiveClassifier().set("universal-unsigned");
task.getArchiveAppendix().set("universal-unsigned");
task.getArchiveVersion().set(project.getVersion().toString());
Expand All @@ -337,6 +342,8 @@ public void runtime(final String neoFormVersion, Directory patches, Directory re
manifest.attributes(ImmutableMap.of("Specification-Title", "NeoForge", "Specification-Vendor", "NeoForge", "Specification-Version", project.getVersion().toString().substring(0, project.getVersion().toString().lastIndexOf(".")), "Implementation-Title", project.getGroup(), "Implementation-Version", project.getVersion(), "Implementation-Vendor", "NeoForged"), "net/neoforged/neoforge/internal/versions/neoforge/");
manifest.attributes(ImmutableMap.of("Specification-Title", "Minecraft", "Specification-Vendor", "Mojang", "Specification-Version", runtimeDefinition.getSpecification().getMinecraftVersion(), "Implementation-Title", "MCP", "Implementation-Version", runtimeDefinition.getSpecification().getVersion(), "Implementation-Vendor", "NeoForged"), "net/neoforged/neoforge/versions/neoform/");
});

task.configuration(jarJarConfiguration);
});

final TaskProvider<PotentiallySignJar> signUniversalJar = project.getTasks().register("signUniversalJar", PotentiallySignJar.class, task -> {
Expand Down

0 comments on commit c193c13

Please sign in to comment.