Skip to content

Commit

Permalink
Parchment in base
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Jul 4, 2024
1 parent 1dd4837 commit a5120f9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,31 @@ public void neoform(final String neoFormVersion) {

NeoFormRuntimeUtils.configureDefaultRuntimeSpecBuilder(project, builder);
});

final var parchmentArtifact = getParchment().map(parch -> {
var split = parch.split("-");
return DEFAULT_PARCHMENT_GROUP
+ ":" + DEFAULT_PARCHMENT_ARTIFACT_PREFIX + split[0]
+ ":" + split[1]
+ "@zip";
});

TaskProvider<? extends WithOutput> sourcesTask = runtimeDefinition.getSourceJarTask();
if (parchmentArtifact.isPresent()) {
sourcesTask = RuntimeDevRuntimeExtension.applyParchment(
getProject(),
"applyParchment",
getProject().provider(() -> ToolUtilities.resolveTool(getProject(), parchmentArtifact.get())),
getProject().provider(() -> "p_"),
sourcesTask.flatMap(WithOutput::getOutput).map(RegularFile::getAsFile),
true,
runtimeDefinition.getSpecification(),
project.getLayout().getBuildDirectory().dir(String.format("neoForm/%s", neoFormVersion)).get().getAsFile(),
null
);
}

configureSetupTasks(runtimeDefinition.getSourceJarTask().flatMap(WithOutput::getOutput), mainSource, runtimeDefinition.getMinecraftDependenciesConfiguration());
configureSetupTasks(sourcesTask.flatMap(WithOutput::getOutput), mainSource, runtimeDefinition.getMinecraftDependenciesConfiguration());
}

public void runtime(final String neoFormVersion) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package net.neoforged.gradle.platform.runtime.runtime.extension;

import io.codechicken.diffpatch.util.PatchMode;
import net.neoforged.gradle.common.runtime.definition.CommonRuntimeDefinition;
import net.neoforged.gradle.common.runtime.extensions.CommonRuntimeExtension;
import net.neoforged.gradle.common.runtime.specification.CommonRuntimeSpecification;
import net.neoforged.gradle.common.runtime.tasks.DefaultExecute;
import net.neoforged.gradle.common.util.ToolUtilities;
import net.neoforged.gradle.dsl.common.extensions.subsystems.Subsystems;
Expand Down Expand Up @@ -88,7 +90,7 @@ public static TaskProvider<DefaultExecute> applyParchment(Project project,
Provider<String> conflictPrefix,
Provider<File> input,
boolean inputFile,
RuntimeDevRuntimeSpecification spec,
CommonRuntimeSpecification spec,
File workingDirectory,
@Nullable TaskProvider<? extends WithOutput> extraClasspath) {
return project.getTasks().register(CommonRuntimeUtils.buildTaskName(spec, name), DefaultExecute.class, task -> {
Expand Down

0 comments on commit a5120f9

Please sign in to comment.