From 673483c64a0c4d29d4b368b3ac3303ecb7ec8def Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Sat, 6 Jul 2024 20:57:09 +0200 Subject: [PATCH] More docs --- .../fmlbuild/InstallProductionServerTask.java | 28 +++++++++++++++---- .../fmlbuild/NeoForgeClientInstallation.java | 19 ++++++++++++- .../java/fmlbuild/NeoForgeInstallation.java | 11 ++++++-- .../fmlbuild/NeoForgeInstallationsPlugin.java | 1 - .../fmlbuild/NeoForgeServerInstallation.java | 9 ++++++ .../RunConfigurationDependencies.java | 9 ++++++ .../fmlbuild/RunConfigurationSettings.java | 25 ++++++++++++++++- buildSrc/src/main/java/fmlbuild/RunUtils.java | 6 ++-- 8 files changed, 95 insertions(+), 13 deletions(-) diff --git a/buildSrc/src/main/java/fmlbuild/InstallProductionServerTask.java b/buildSrc/src/main/java/fmlbuild/InstallProductionServerTask.java index fc53b67fa..363db59f2 100644 --- a/buildSrc/src/main/java/fmlbuild/InstallProductionServerTask.java +++ b/buildSrc/src/main/java/fmlbuild/InstallProductionServerTask.java @@ -31,24 +31,42 @@ public abstract class InstallProductionServerTask extends DefaultTask { private final ExecOperations execOperations; + /** + * The NeoForge installer jar is expected to be the only file in this file collection. + */ @InputFiles public abstract ConfigurableFileCollection getInstaller(); + /** + * The NeoForge version that is being installed. This is required to then look up the server argument + * file after the installer has done its thing. + */ @Input public abstract Property getNeoForgeVersion(); + /** + * Where the server should be installed. + */ @OutputDirectory public abstract DirectoryProperty getInstallDir(); - @OutputDirectory - public abstract DirectoryProperty getLibrariesDir(); - + /** + * Write an argument-file for the JVM containing the required JVM args for startup. + * Any module or classpath arguments have been stripped. + */ @OutputFile - public abstract RegularFileProperty getNeoForgeProgramArgFile(); + public abstract RegularFileProperty getNeoForgeJvmArgFile(); + /** + * Write an argument-file for DevLauncher here that contains the program arguments to launch the server. + */ @OutputFile - public abstract RegularFileProperty getNeoForgeJvmArgFile(); + public abstract RegularFileProperty getNeoForgeProgramArgFile(); + /** + * Write an argument-file for DevLauncher here that contains the original main class name used + * to launch the server. + */ @OutputFile public abstract RegularFileProperty getNeoForgeMainClassArgFile(); diff --git a/buildSrc/src/main/java/fmlbuild/NeoForgeClientInstallation.java b/buildSrc/src/main/java/fmlbuild/NeoForgeClientInstallation.java index 102dfcf31..eb286f6c4 100644 --- a/buildSrc/src/main/java/fmlbuild/NeoForgeClientInstallation.java +++ b/buildSrc/src/main/java/fmlbuild/NeoForgeClientInstallation.java @@ -17,16 +17,33 @@ public NeoForgeClientInstallation(Project project, String name) { getNeoForgeProgramArgFile().convention(getDirectory().file("neoforge_args.txt")); } - // Write the JVM args to files + /** + * An argfile with the program arguments defined by the Vanilla launcher profile will be written here. + */ public abstract RegularFileProperty getVanillaJvmArgFile(); + /** + * An argfile with the main class defined in the Vanilla launcher profile will be written here. + */ public abstract RegularFileProperty getVanillaMainClassArgFile(); + /** + * An argfile with the program arguments defined by the Vanilla launcher profile will be written here. + */ public abstract RegularFileProperty getVanillaProgramArgFile(); + /** + * An argfile with the JVM args defined in the NeoForge launcher profile will be written here. + */ public abstract RegularFileProperty getNeoForgeJvmArgFile(); + /** + * An argfile with the main class defined in the NeoForge launcher profile will be written here. + */ public abstract RegularFileProperty getNeoForgeMainClassArgFile(); + /** + * An argfile with the program args defined in the NeoForge launcher profile will be written here. + */ public abstract RegularFileProperty getNeoForgeProgramArgFile(); } diff --git a/buildSrc/src/main/java/fmlbuild/NeoForgeInstallation.java b/buildSrc/src/main/java/fmlbuild/NeoForgeInstallation.java index 3e09277e7..57cc82932 100644 --- a/buildSrc/src/main/java/fmlbuild/NeoForgeInstallation.java +++ b/buildSrc/src/main/java/fmlbuild/NeoForgeInstallation.java @@ -3,8 +3,6 @@ import org.gradle.api.Named; import org.gradle.api.Project; import org.gradle.api.file.DirectoryProperty; -import org.gradle.api.file.RegularFileProperty; -import org.gradle.api.provider.ListProperty; import org.gradle.api.provider.Property; public abstract class NeoForgeInstallation implements Named { @@ -20,9 +18,18 @@ public String getName() { return name; } + /** + * The NeoForge version to install. + */ public abstract Property getVersion(); + /** + * The Minecraft version matching the NeoForge version. + */ public abstract Property getMinecraftVersion(); + /** + * Where the installation should be made. + */ public abstract DirectoryProperty getDirectory(); } diff --git a/buildSrc/src/main/java/fmlbuild/NeoForgeInstallationsPlugin.java b/buildSrc/src/main/java/fmlbuild/NeoForgeInstallationsPlugin.java index b797499c6..1c8f0e8ad 100644 --- a/buildSrc/src/main/java/fmlbuild/NeoForgeInstallationsPlugin.java +++ b/buildSrc/src/main/java/fmlbuild/NeoForgeInstallationsPlugin.java @@ -116,7 +116,6 @@ private void addServerInstallation(Project project, NeoForgeServerInstallation i task.setGroup("fml/installations"); task.getInstaller().from(installerConfig); task.getInstallDir().set(installation.getDirectory()); - task.getLibrariesDir().set(task.getInstallDir().dir("libraries")); task.getNeoForgeVersion().set(installation.getVersion()); // Write the JVM args to files diff --git a/buildSrc/src/main/java/fmlbuild/NeoForgeServerInstallation.java b/buildSrc/src/main/java/fmlbuild/NeoForgeServerInstallation.java index b52cc17a4..f12d3f572 100644 --- a/buildSrc/src/main/java/fmlbuild/NeoForgeServerInstallation.java +++ b/buildSrc/src/main/java/fmlbuild/NeoForgeServerInstallation.java @@ -16,9 +16,18 @@ public NeoForgeServerInstallation(Project project, String name) { getNeoForgeProgramArgFile().set(getDirectory().file("neoforge_args.txt")); } + /** + * An JVM argfile with the necessary JVM args to launch will be written here. + */ public abstract RegularFileProperty getNeoForgeJvmArgFile(); + /** + * An JVM argfile with the main class needed to launch will be written here. + */ public abstract RegularFileProperty getNeoForgeMainClassArgFile(); + /** + * An argfile with the necessary program arguments will be written here. + */ public abstract RegularFileProperty getNeoForgeProgramArgFile(); } diff --git a/buildSrc/src/main/java/fmlbuild/RunConfigurationDependencies.java b/buildSrc/src/main/java/fmlbuild/RunConfigurationDependencies.java index 9ac7f35a9..443678d77 100644 --- a/buildSrc/src/main/java/fmlbuild/RunConfigurationDependencies.java +++ b/buildSrc/src/main/java/fmlbuild/RunConfigurationDependencies.java @@ -3,8 +3,17 @@ import org.gradle.api.artifacts.dsl.Dependencies; import org.gradle.api.artifacts.dsl.DependencyCollector; +/** + * Additional dependencies of the run configuration. + */ public interface RunConfigurationDependencies extends Dependencies { + /** + * Additional dependencies to put on the classpath. + */ DependencyCollector getClasspath(); + /** + * Additional dependencies to put on the module path. + */ DependencyCollector getModulepath(); } diff --git a/buildSrc/src/main/java/fmlbuild/RunConfigurationSettings.java b/buildSrc/src/main/java/fmlbuild/RunConfigurationSettings.java index 101674367..dd85f6f79 100644 --- a/buildSrc/src/main/java/fmlbuild/RunConfigurationSettings.java +++ b/buildSrc/src/main/java/fmlbuild/RunConfigurationSettings.java @@ -3,7 +3,6 @@ import org.gradle.api.Action; import org.gradle.api.Named; import org.gradle.api.Project; -import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.DirectoryProperty; import org.gradle.api.provider.ListProperty; import org.gradle.api.provider.MapProperty; @@ -27,20 +26,44 @@ public String getName() { return name; } + /** + * The Gradle group to put the task into. + */ public abstract Property getTaskGroup(); + /** + * Name for the run configuration in the IDE. + */ public abstract Property getIdeName(); + /** + * The main class to launch. + */ public abstract Property getMainClass(); + /** + * The working directory to launch in. + */ public abstract DirectoryProperty getWorkingDirectory(); + /** + * The program arguments to launch with. + */ public abstract ListProperty getProgramArgs(); + /** + * The JVM arguments to launch with. + */ public abstract ListProperty getJvmArgs(); + /** + * Additional system properties to add to the JVM arguments. + */ public abstract MapProperty getSystemProperties(); + /** + * Additional dependencies to add to the class- and module-path. + */ @Nested public abstract RunConfigurationDependencies getDependencies(); diff --git a/buildSrc/src/main/java/fmlbuild/RunUtils.java b/buildSrc/src/main/java/fmlbuild/RunUtils.java index 49ae64afb..da063d28f 100644 --- a/buildSrc/src/main/java/fmlbuild/RunUtils.java +++ b/buildSrc/src/main/java/fmlbuild/RunUtils.java @@ -15,9 +15,9 @@ static List splitJvmArgs(String jvmArgs) throws IOException { tok.resetSyntax(); tok.wordChars(32, 255); tok.whitespaceChars(0, 32); - tok.quoteChar(34); - tok.quoteChar(39); - tok.commentChar(35); + tok.quoteChar('"'); + tok.quoteChar('\''); + tok.commentChar('#'); var args = new ArrayList(); while (tok.nextToken() != -1) {