Skip to content

Commit

Permalink
More docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Jul 6, 2024
1 parent f82ce53 commit 11ccf35
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 13 deletions.
28 changes: 23 additions & 5 deletions buildSrc/src/main/java/fmlbuild/InstallProductionServerTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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();

Expand Down
19 changes: 18 additions & 1 deletion buildSrc/src/main/java/fmlbuild/NeoForgeClientInstallation.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
11 changes: 9 additions & 2 deletions buildSrc/src/main/java/fmlbuild/NeoForgeInstallation.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -20,9 +18,18 @@ public String getName() {
return name;
}

/**
* The NeoForge version to install.
*/
public abstract Property<String> getVersion();

/**
* The Minecraft version matching the NeoForge version.
*/
public abstract Property<String> getMinecraftVersion();

/**
* Where the installation should be made.
*/
public abstract DirectoryProperty getDirectory();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
25 changes: 24 additions & 1 deletion buildSrc/src/main/java/fmlbuild/RunConfigurationSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,20 +26,44 @@ public String getName() {
return name;
}

/**
* The Gradle group to put the task into.
*/
public abstract Property<String> getTaskGroup();

/**
* Name for the run configuration in the IDE.
*/
public abstract Property<String> getIdeName();

/**
* The main class to launch.
*/
public abstract Property<String> getMainClass();

/**
* The working directory to launch in.
*/
public abstract DirectoryProperty getWorkingDirectory();

/**
* The program arguments to launch with.
*/
public abstract ListProperty<String> getProgramArgs();

/**
* The JVM arguments to launch with.
*/
public abstract ListProperty<String> getJvmArgs();

/**
* Additional system properties to add to the JVM arguments.
*/
public abstract MapProperty<String, String> getSystemProperties();

/**
* Additional dependencies to add to the class- and module-path.
*/
@Nested
public abstract RunConfigurationDependencies getDependencies();

Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/java/fmlbuild/RunUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ static List<String> 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<String>();
while (tok.nextToken() != -1) {
Expand Down

0 comments on commit 11ccf35

Please sign in to comment.