Skip to content
Merged
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,10 @@ neoFormRuntime {
// Print more information when NFRT cannot use a cached result
// Gradle Property: neoForge.neoFormRuntime.analyzeCacheMisses
analyzeCacheMisses = true

// Overrides the launcher manifest URL used by NFRT to look up Minecraft versions
// Gradle Property: neoForge.neoFormRuntime.launcherManifestUrl
launcherManifestUrl = "https://.../version_manifest_v2.json"
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public NeoFormRuntimeExtension(Project project) {
getEnableCache().convention(PropertyUtils.getBooleanProperty(project, "neoForge.neoFormRuntime.enableCache").orElse(true));
getVerbose().convention(PropertyUtils.getBooleanProperty(project, "neoForge.neoFormRuntime.verbose").orElse(false));
getAnalyzeCacheMisses().convention(PropertyUtils.getBooleanProperty(project, "neoForge.neoFormRuntime.analyzeCacheMisses").orElse(false));
getLauncherManifestUrl().convention(PropertyUtils.getStringProperty(project, "neoForge.neoFormRuntime.launcherManifestUrl"));
}

/**
Expand Down Expand Up @@ -66,4 +67,12 @@ public NeoFormRuntimeExtension(Project project) {
* <b>Gradle property:</b> {@code neoForge.neoFormRuntime.analyzeCacheMisses}.
*/
public abstract Property<Boolean> getAnalyzeCacheMisses();

/**
* URL for the Minecraft Launcher manifest used to resolve Minecraft version information.
* <p>
* <b>Default:</b> {@code https://piston-meta.mojang.com/mc/game/version_manifest_v2.json}<br>
* <b>Gradle property:</b> {@code neoForge.neoFormRuntime.launcherManifestUrl}.
*/
public abstract Property<String> getLauncherManifestUrl();
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public void apply(Project project) {
project.getTasks().withType(NeoFormRuntimeTask.class).configureEach(task -> {
task.getNeoFormRuntime().convention(toolConfiguration);
task.getVerbose().convention(extension.getVerbose());
task.getLauncherManifestUrl().convention(extension.getLauncherManifestUrl());
// Every invocation of NFRT should inherit the tools it's using itself via Gradle
task.addArtifactsToManifest(externalToolsConfiguration);
});
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/net/neoforged/nfrtgradle/NeoFormRuntimeTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Optional;
import org.gradle.jvm.toolchain.JavaLanguageVersion;
import org.gradle.jvm.toolchain.JavaToolchainService;
import org.gradle.process.ExecOperations;
Expand Down Expand Up @@ -53,6 +54,14 @@ public abstract class NeoFormRuntimeTask extends DefaultTask {
@InputFiles
public abstract ConfigurableFileCollection getNeoFormRuntime();

/**
* URL for the Minecraft Launcher manifest used to resolve Minecraft version information.
* When none is given, it defaults to {@code https://piston-meta.mojang.com/mc/game/version_manifest_v2.json}.
*/
@Input
@Optional
public abstract Property<String> getLauncherManifestUrl();

/**
* Enable verbose output for the NFRT engine. Defaults to false.
*/
Expand Down Expand Up @@ -125,6 +134,11 @@ public final void run(List<String> args) {
realArgs.add(2, "--work-dir");
realArgs.add(3, getWorkDirectory().get().getAsFile().getAbsolutePath());

if (getLauncherManifestUrl().isPresent()) {
realArgs.add("--launcher-meta-uri");
realArgs.add(getLauncherManifestUrl().get());
}

if (getVerbose().get()) {
realArgs.add("--verbose");
}
Expand Down
Loading