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

Fix createLaunchScript tasks compiling dependent projects in some cases #145

Merged
merged 3 commits into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -11,11 +11,12 @@
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.provider.MapProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Classpath;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.TaskAction;
import org.gradle.jvm.toolchain.JavaToolchainService;

Expand Down Expand Up @@ -61,8 +62,8 @@ abstract class CreateLaunchScriptTask extends DefaultTask {
/**
* Set to the desired Java runtime classpath.
*/
@Classpath
@InputFiles
@PathSensitive(PathSensitivity.ABSOLUTE)
Technici4n marked this conversation as resolved.
Show resolved Hide resolved
abstract ConfigurableFileCollection getRuntimeClasspath();

@Input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,10 @@ public void apply(Project project) {
task.setDescription("Creates a bash/shell-script to launch the " + run.getName() + " Minecraft run from outside Gradle or your IDE.");

task.getWorkingDirectory().set(run.getGameDirectory().map(d -> d.getAsFile().getAbsolutePath()));
task.getRuntimeClasspath().setFrom(runtimeClasspathConfig);
// Use a provider indirection to NOT capture a task dependency on the runtimeClasspath.
// Resolving the classpath could require compiling some code depending on the runtimeClasspath setup.
// We don't want to do that on IDE sync!
task.getRuntimeClasspath().setFrom(project.provider(() -> runtimeClasspathConfig.get().getFiles()));
task.getLaunchScript().set(RunUtils.getLaunchScript(modDevBuildDir, run));
task.getClasspathArgsFile().set(RunUtils.getArgFile(modDevBuildDir, run, RunUtils.RunArgFile.CLASSPATH));
task.getVmArgsFile().set(prepareRunTask.get().getVmArgsFile().map(d -> d.getAsFile().getAbsolutePath()));
Expand Down
Loading