Class GradleLaunchConfig.Builder

java.lang.Object
net.neoforged.elc.configs.GradleLaunchConfig.Builder
Enclosing class:
GradleLaunchConfig

public static final class GradleLaunchConfig.Builder extends Object
Builder for GradleLaunchConfig.
  • Constructor Details

    • Builder

      public Builder(String project)
      Creates a new builder for a specific Eclipse project.
      Parameters:
      project - The name of the Eclipse project the launch config is for.
  • Method Details

    • project

      public GradleLaunchConfig.Builder project(String project)
      Changes the target Eclipse project.

      For GradleLaunchConfig, the project is only used to infer the default workingDirectory.

      Parameters:
      project - The name of the Eclipse project the launch config is for.
      Returns:
      this
    • tasks

      public GradleLaunchConfig.Builder tasks(String... tasks)
      Adds one or more gradle tasks to the end of the execution queue.
      Parameters:
      tasks - The new tasks, in execution order.
      Returns:
      this
    • workingDirectory

      public GradleLaunchConfig.Builder workingDirectory(String workingDirectory)
      Sets the working directory.

      Can use eclipse variables for path resolution.

      Parameters:
      workingDirectory - The working directory.
      Returns:
      this
    • gradleDist

      public GradleLaunchConfig.Builder gradleDist(String gradleDist)
      Sets the Gradle Distribution to use. Specify the gradle wrapper via "GRADLE_DISTRIBUTION(WRAPPER)".
      Parameters:
      gradleDist - The new gradle distribution.
      Returns:
      this
    • offlineMode

      public GradleLaunchConfig.Builder offlineMode(boolean offlineMode)
      Sets the offline mode flag. If enabled, --offline will be passed to gradle at execution time.
      Parameters:
      offlineMode - If offline mode is enabled.
      Returns:
      this
    • showConsole

      public GradleLaunchConfig.Builder showConsole(boolean showConsole)
      Sets the console view flag. If enabled, the Eclipse console will be shown when running the config.
      Parameters:
      showConsole - If show console view is enabled.
      Returns:
      this
    • showExecutions

      public GradleLaunchConfig.Builder showExecutions(boolean showExecutions)
      Sets the executions view flag. If enabled, the Eclipse "Gradle Executions" pane will be shown when running the config.
      Parameters:
      showExecutions - If show execution view is enabled.
      Returns:
      this
    • gradleUserHome

      public GradleLaunchConfig.Builder gradleUserHome(@Nullable @Nullable String gradleUserHome)
      Parameters:
      gradleUserHome - The new gradle user home.
      Returns:
      this
    • javaHome

      public GradleLaunchConfig.Builder javaHome(@Nullable @Nullable String javaHome)
      Sets the java home used by Gradle.
      Parameters:
      javaHome - The new Java home.
      Returns:
      this
    • args

      public GradleLaunchConfig.Builder args(String... args)
      Adds one or more program argument to the launch config.

      Supplying an incorrect or invalid argument will cause the launch config to emit nothing and silently fail.

      Supplying --no-daemon is not supported and causes the launch to fail similarly.

      eclipse variables will be resolved in arguments.

      Parameters:
      args - The argument(s) to add.
      Returns:
      this
    • property

      public GradleLaunchConfig.Builder property(String key, Object value)
      Adds a Project Property to the launch args.

      This is syntax sugar around args(String...).

      eclipse variables will be resolved in arguments.

      Parameters:
      key - The property key.
      value - The property value. It will be stringized via Object.toString()
      Returns:
      this
    • jvmArgs

      public GradleLaunchConfig.Builder jvmArgs(String... args)
      Adds one or more JVM argument to the launch config.

      eclipse variables will be resolved in arguments.

      Parameters:
      args - The argument(s) to add.
      Returns:
      this
    • overrideWorkspaceSettings

      public GradleLaunchConfig.Builder overrideWorkspaceSettings(boolean override)
      Sets the "Override Workspace Settings" flag. If disabled, only tasks and workingDirectory will be used during execution.

      Since this field defaults to false, it will be automatically enabled if any of the dependent settings are modified, and must be manually disabled at the end of the builder.

      Parameters:
      override - If workspace settings will be overridden.
      Returns:
      this
      See Also:
    • build

      public GradleLaunchConfig build()
      Builds a GradleLaunchConfig.

      All containers (lists, maps) are copied, so further modification to this builder will not modify the built object.

      Returns:
      A newly-constructed GradleLaunchConfig.