Class ToolExecBase<P extends EnhancedProblems>

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.JavaExec
net.minecraftforge.gradleutils.shared.ToolExecBase<P>
Type Parameters:
P - The type of enhanced problems, used for common problems reporting with illegal task arguments
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.process.BaseExecSpec, org.gradle.process.JavaExecSpec, org.gradle.process.JavaForkOptions, org.gradle.process.ProcessForkOptions, org.gradle.util.Configurable<org.gradle.api.Task>

public abstract class ToolExecBase<P extends EnhancedProblems> extends org.gradle.api.tasks.JavaExec
This tool execution task is a template on top of JavaExec to make executing tools much easier and more consistent between plugins.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.gradle.api.file.DirectoryProperty
    The default tool directory (usage is not required).

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ToolExecBase(Class<P> problemsType, Tool tool)
    Creates a new task instance using the given types and tool information.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    This method should be overridden by subclasses to add arguments to this task via JavaExec.args(java.lang.Object...).
    protected final void
    argOnlyIf(String arg, org.gradle.api.provider.Provider<Boolean> onlyIf)
    Adds the given argument if and only if the given boolean property is present and true.
    protected final void
    argOnlyIf(String arg, org.gradle.api.specs.Spec<? super ToolExecBase<?>> onlyIf)
    Adds the given argument if and only if the given spec, using this task, is satisfied.
    protected final void
    args(String arg, Iterable<? extends File> files)
    Adds each file to the arguments preceded by the given argument.
    protected final void
    args(String arg, org.gradle.api.file.FileSystemLocationProperty<? extends org.gradle.api.file.FileSystemLocation> fileProvider)
    Adds the given argument followed by the given file location to the arguments.
    protected final void
    args(String arg, org.gradle.api.provider.Provider<?> provider)
    Adds the given argument followed by the given object (may be a file location) to the arguments.
    void
     
    protected final P
    The enhanced problems instance to use for this task.
    protected abstract org.gradle.api.file.ProjectLayout
     

    Methods inherited from class org.gradle.api.tasks.JavaExec

    args, args, bootstrapClasspath, classpath, copyTo, copyTo, debugOptions, environment, environment, executable, getAllJvmArgs, getArgs, getArgumentProviders, getBootstrapClasspath, getClasspath, getCommandLine, getDebug, getDebugOptions, getDefaultCharacterEncoding, getEnableAssertions, getEnvironment, getErrorOutput, getExecActionFactory, getExecutable, getExecutionResult, getJavaLauncher, getJavaToolchainService, getJavaVersion, getJvmArgs, getJvmArgumentProviders, getJvmArguments, getMainClass, getMainModule, getMaxHeapSize, getMinHeapSize, getModularity, getObjectFactory, getPropertyFactory, getProviderFactory, getStandardInput, getStandardOutput, getSystemProperties, getWorkingDir, isIgnoreExitValue, jvmArgs, jvmArgs, setAllJvmArgs, setAllJvmArgs, setArgs, setArgs, setArgsString, setBootstrapClasspath, setClasspath, setDebug, setDefaultCharacterEncoding, setEnableAssertions, setEnvironment, setErrorOutput, setExecutable, setExecutable, setIgnoreExitValue, setJvmArgs, setJvmArgs, setMaxHeapSize, setMinHeapSize, setStandardInput, setStandardOutput, setSystemProperties, setWorkingDir, setWorkingDir, systemProperties, systemProperty, workingDir

    Methods inherited from class org.gradle.api.internal.ConventionTask

    conventionMapping, conventionMapping, getConventionMapping

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Field Details

    • defaultToolDir

      protected final org.gradle.api.file.DirectoryProperty defaultToolDir
      The default tool directory (usage is not required).
  • Constructor Details

    • ToolExecBase

      protected ToolExecBase(Class<P> problemsType, Tool tool)
      Creates a new task instance using the given types and tool information.
      Parameters:
      problemsType - The type of problems to use for this task (accessible via getProblems())
      tool - The tool to use for this task
      Implementation Requirements:
      The implementing subclass must make their constructor public, annotated with Inject, and have only a single parameter for Tool, passing in static plugin and problems types to this base constructor. The types must also be manually specified in the class declaration when overriding this class. The best practice is to make a single ToolExec class for the implementing plugin to use, which other tasks can extend off of.
  • Method Details

    • getProjectLayout

      @Inject protected abstract org.gradle.api.file.ProjectLayout getProjectLayout()
      See Also:
    • getProblems

      @Internal protected final P getProblems()
      The enhanced problems instance to use for this task.
      Returns:
      The enhanced problems
    • addArguments

      @MustBeInvokedByOverriders protected void addArguments()
      This method should be overridden by subclasses to add arguments to this task via JavaExec.args(java.lang.Object...). To preserve arguments added by superclasses, this method must be invoked by overriders.
    • exec

      public void exec()
      Overrides:
      exec in class org.gradle.api.tasks.JavaExec
    • args

      protected final void args(String arg, Iterable<? extends File> files)
      Adds each file to the arguments preceded by the given argument. Designed to work well with JOpt Simple.
      Parameters:
      arg - The flag to use for each file
      files - The files to add
    • args

      protected final void args(String arg, org.gradle.api.file.FileSystemLocationProperty<? extends org.gradle.api.file.FileSystemLocation> fileProvider)
      Adds the given argument followed by the given file location to the arguments.
      Parameters:
      arg - The flag to use
      fileProvider - The file to add
    • args

      protected final void args(String arg, org.gradle.api.provider.Provider<?> provider)
      Adds the given argument followed by the given object (may be a file location) to the arguments.
      Parameters:
      arg - The flag to use
      provider - The object (or file) to add
    • argOnlyIf

      protected final void argOnlyIf(String arg, org.gradle.api.provider.Provider<Boolean> onlyIf)
      Adds the given argument if and only if the given boolean property is present and true.
      Parameters:
      arg - The argument to add
      onlyIf - The provider to test
    • argOnlyIf

      protected final void argOnlyIf(String arg, org.gradle.api.specs.Spec<? super ToolExecBase<?>> onlyIf)
      Adds the given argument if and only if the given spec, using this task, is satisfied.
      Parameters:
      arg - The argument to add
      onlyIf - The spec to test