Groovy Documentation

org.gradle
[Java] Class StartParameter

java.lang.Object
  org.gradle.logging.LoggingConfiguration
      org.gradle.StartParameter
All Implemented Interfaces:
java.io.Serializable

public class StartParameter
extends org.gradle.logging.LoggingConfiguration

StartParameter defines the configuration used by a GradleLauncher instance to execute a build. The properties of StartParameter generally correspond to the command-line options of Gradle. You pass a StartParameter instance to GradleLauncher.newInstance when you create a new Gradle instance.

You can obtain an instance of a StartParameter by either creating a new one, or duplicating an existing one using newInstance or newBuild.

Authors:
Hans Dockter
See Also:
GradleLauncher


Field Summary
static java.io.File DEFAULT_GRADLE_USER_HOME

The default user home directory.

static java.lang.String GRADLE_USER_HOME_PROPERTY_KEY

 
Constructor Summary
StartParameter()

Creates a StartParameter with default values.

 
Method Summary
void addInitScript(java.io.File initScriptFile)

Adds the given file to the list of init scripts that are run before the build starts.

boolean equals(java.lang.Object obj)

java.io.File getBuildFile()

Returns the build file to use to select the default project.

org.gradle.groovy.scripts.ScriptSource getBuildScriptSource()

CacheUsage getCacheUsage()

java.io.File getCurrentDir()

Returns the directory to use to select the default project, and to search for the settings file.

org.gradle.initialization.ProjectSpec getDefaultProjectSelector()

Returns the selector used to choose the default project of the build.

java.util.Set getExcludedTaskNames()

Returns the names of the tasks to be excluded from this build.

java.io.File getGradleUserHomeDir()

Returns the directory to use as the user home directory.

java.util.List getInitScripts()

Returns all explicitly added init scripts that will be run before the build starts.

java.util.Map getMergedSystemProperties()

Returns a newly constructed map that is the JVM system properties merged with the system property args.

java.io.File getProjectCacheDir()

Returns the project's cache dir.

org.gradle.api.internal.artifacts.ProjectDependenciesBuildInstruction getProjectDependenciesBuildInstruction()

java.util.Map getProjectProperties()

org.gradle.groovy.scripts.ScriptSource getSettingsScriptSource()

java.util.Map getSystemPropertiesArgs()

java.util.List getTaskNames()

Returns the names of the tasks to execute in this build.

int hashCode()

boolean isContinueOnFailure()

Specifies whether the build should continue on task failure.

boolean isDryRun()

boolean isNoOpt()

boolean isProfile()

Returns true if a profile report will be generated.

boolean isSearchUpwards()

StartParameter newBuild()

StartParameter newInstance()

Duplicates this StartParameter instance.

void setBuildFile(java.io.File buildFile)

Sets the build file to use to select the default project.

StartParameter setBuildScriptSource(org.gradle.groovy.scripts.ScriptSource buildScript)

void setCacheUsage(CacheUsage cacheUsage)

void setContinueOnFailure(boolean continueOnFailure)

Specifies whether the build should continue on task failure.

void setCurrentDir(java.io.File currentDir)

Sets the directory to use to select the default project, and to search for the settings file.

void setDefaultProjectSelector(org.gradle.initialization.ProjectSpec defaultProjectSelector)

Sets the selector used to choose the default project of the build.

void setDryRun(boolean dryRun)

void setExcludedTaskNames(java.lang.Iterable excludedTaskNames)

Sets the tasks to exclude from this build.

void setGradleUserHomeDir(java.io.File gradleUserHomeDir)

Sets the directory to use as the user home directory.

void setInitScripts(java.util.List initScripts)

void setNoOpt(boolean noOpt)

void setProfile(boolean profile)

Specifies if a profile report should be generated.

void setProjectCacheDir(java.io.File projectCacheDir)

Sets the project's cache location.

void setProjectDependenciesBuildInstruction(org.gradle.api.internal.artifacts.ProjectDependenciesBuildInstruction projectDependenciesBuildInstruction)

void setProjectDir(java.io.File projectDir)

Sets the project directory to use to select the default project.

void setProjectProperties(java.util.Map projectProperties)

void setSearchUpwards(boolean searchUpwards)

void setSettingsFile(java.io.File settingsFile)

Sets the settings file to use for the build.

void setSettingsScriptSource(org.gradle.groovy.scripts.ScriptSource settingsScriptSource)

void setSystemPropertiesArgs(java.util.Map systemPropertiesArgs)

void setTaskNames(java.lang.Iterable taskNames)

java.lang.String toString()

StartParameter useEmbeddedBuildFile(java.lang.String buildScriptText)

 
Methods inherited from class org.gradle.logging.LoggingConfiguration
org.gradle.logging.LoggingConfiguration#getShowStacktrace(), org.gradle.logging.LoggingConfiguration#getLogLevel(), org.gradle.logging.LoggingConfiguration#setLogLevel(org.gradle.api.logging.LogLevel), org.gradle.logging.LoggingConfiguration#setColorOutput(boolean), org.gradle.logging.LoggingConfiguration#setShowStacktrace(org.gradle.logging.ShowStacktrace), org.gradle.logging.LoggingConfiguration#isColorOutput(), org.gradle.logging.LoggingConfiguration#wait(), org.gradle.logging.LoggingConfiguration#wait(long), org.gradle.logging.LoggingConfiguration#wait(long, int), org.gradle.logging.LoggingConfiguration#equals(java.lang.Object), org.gradle.logging.LoggingConfiguration#toString(), org.gradle.logging.LoggingConfiguration#hashCode(), org.gradle.logging.LoggingConfiguration#getClass(), org.gradle.logging.LoggingConfiguration#notify(), org.gradle.logging.LoggingConfiguration#notifyAll()
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

DEFAULT_GRADLE_USER_HOME

public static final java.io.File DEFAULT_GRADLE_USER_HOME
The default user home directory.


GRADLE_USER_HOME_PROPERTY_KEY

public static final java.lang.String GRADLE_USER_HOME_PROPERTY_KEY


 
Constructor Detail

StartParameter

public StartParameter()
Creates a StartParameter with default values. This is roughly equivalent to running Gradle on the command-line with no arguments.


 
Method Detail

addInitScript

public void addInitScript(java.io.File initScriptFile)
Adds the given file to the list of init scripts that are run before the build starts. This list is in addition to the user init script located in ${user.home}/.gradle/init.gradle.
Parameters:
initScriptFile - The init script to be run during the Gradle invocation.


equals

public boolean equals(java.lang.Object obj)


getBuildFile

public java.io.File getBuildFile()
Returns the build file to use to select the default project. Returns null when the build file is not used to select the default project.
Returns:
The build file. May be null.


getBuildScriptSource

public org.gradle.groovy.scripts.ScriptSource getBuildScriptSource()

Returns the org.gradle.groovy.scripts.ScriptSource to use for the build file for this build. Returns null when the default build file(s) are to be used. This source is used for all projects included in the build.

Returns:
The build file source, or null to use the defaults.


getCacheUsage

public CacheUsage getCacheUsage()


getCurrentDir

public java.io.File getCurrentDir()
Returns the directory to use to select the default project, and to search for the settings file.
Returns:
The current directory. Never returns null.


getDefaultProjectSelector

public org.gradle.initialization.ProjectSpec getDefaultProjectSelector()
Returns the selector used to choose the default project of the build. This is the project used as the starting point for resolving task names, and for determining the default tasks.
Returns:
The default project. Never returns null.


getExcludedTaskNames

public java.util.Set getExcludedTaskNames()
Returns the names of the tasks to be excluded from this build. When empty, no tasks are excluded from the build.
Returns:
The names of the excluded tasks. Returns an empty set if there are no such tasks.


getGradleUserHomeDir

public java.io.File getGradleUserHomeDir()
Returns the directory to use as the user home directory.
Returns:
The home directory.


getInitScripts

public java.util.List getInitScripts()
Returns all explicitly added init scripts that will be run before the build starts. This list does not contain the user init script located in ${user.home}/.gradle/init.gradle, even though that init script will also be run.
Returns:
list of all explicitly added init scripts.


getMergedSystemProperties

public java.util.Map getMergedSystemProperties()
Returns a newly constructed map that is the JVM system properties merged with the system property args.

System property args take precedency overy JVM system properties.

Returns:
The merged system properties


getProjectCacheDir

public java.io.File getProjectCacheDir()
Returns the project's cache dir.
Returns:
project's cache dir, or null if the default location is to be used.


getProjectDependenciesBuildInstruction

public org.gradle.api.internal.artifacts.ProjectDependenciesBuildInstruction getProjectDependenciesBuildInstruction()


getProjectProperties

public java.util.Map getProjectProperties()


getSettingsScriptSource

public org.gradle.groovy.scripts.ScriptSource getSettingsScriptSource()

Returns the org.gradle.groovy.scripts.ScriptSource to use for the settings script for this build. Returns null when the default settings script is to be used.

Returns:
The settings script source, or null to use the default.


getSystemPropertiesArgs

public java.util.Map getSystemPropertiesArgs()


getTaskNames

public java.util.List getTaskNames()
Returns the names of the tasks to execute in this build. When empty, the default tasks for the project will be executed.
Returns:
the names of the tasks to execute in this build. Never returns null.


hashCode

public int hashCode()


isContinueOnFailure

public boolean isContinueOnFailure()
Specifies whether the build should continue on task failure. The default is false.


isDryRun

public boolean isDryRun()


isNoOpt

public boolean isNoOpt()


isProfile

public boolean isProfile()
Returns true if a profile report will be generated.


isSearchUpwards

public boolean isSearchUpwards()


newBuild

public StartParameter newBuild()

Creates the parameters for a new build, using these parameters as a template. Copies the environmental properties from this parameter (eg gradle user home dir, etc), but does not copy the build specific properties (eg task names).

Returns:
The new parameters.


newInstance

public StartParameter newInstance()
Duplicates this StartParameter instance.
Returns:
the new parameters.


setBuildFile

public void setBuildFile(java.io.File buildFile)
Sets the build file to use to select the default project. Use null to disable selecting the default project using the build file.
Parameters:
buildFile - The build file. May be null.


setBuildScriptSource

public StartParameter setBuildScriptSource(org.gradle.groovy.scripts.ScriptSource buildScript)

Specifies that the given script should be used as the build file for this build. Uses an empty settings file.

Parameters:
buildScript - The script to use as the build file.
Returns:
this


setCacheUsage

public void setCacheUsage(CacheUsage cacheUsage)


setContinueOnFailure

public void setContinueOnFailure(boolean continueOnFailure)
Specifies whether the build should continue on task failure. The default is false.


setCurrentDir

public void setCurrentDir(java.io.File currentDir)
Sets the directory to use to select the default project, and to search for the settings file. Set to null to use the default current directory.
Parameters:
currentDir - The directory. Should not be null.


setDefaultProjectSelector

public void setDefaultProjectSelector(org.gradle.initialization.ProjectSpec defaultProjectSelector)
Sets the selector used to choose the default project of the build.
Parameters:
defaultProjectSelector - The selector. Should not be null.


setDryRun

public void setDryRun(boolean dryRun)


setExcludedTaskNames

public void setExcludedTaskNames(java.lang.Iterable excludedTaskNames)
Sets the tasks to exclude from this build.
Parameters:
excludedTaskNames - The task names. Can be null.


setGradleUserHomeDir

public void setGradleUserHomeDir(java.io.File gradleUserHomeDir)
Sets the directory to use as the user home directory. Set to null to use the default directory.
Parameters:
gradleUserHomeDir - The home directory. May be null.


setInitScripts

public void setInitScripts(java.util.List initScripts)


setNoOpt

public void setNoOpt(boolean noOpt)


setProfile

public void setProfile(boolean profile)
Specifies if a profile report should be generated.
Parameters:
profile - true if a profile report should be generated


setProjectCacheDir

public void setProjectCacheDir(java.io.File projectCacheDir)
Sets the project's cache location. Set to null to use the default location.
Parameters:
projectCacheDir


setProjectDependenciesBuildInstruction

public void setProjectDependenciesBuildInstruction(org.gradle.api.internal.artifacts.ProjectDependenciesBuildInstruction projectDependenciesBuildInstruction)


setProjectDir

public void setProjectDir(java.io.File projectDir)
Sets the project directory to use to select the default project. Use null to use the default criteria for selecting the default project.
Parameters:
projectDir - The project directory. May be null.


setProjectProperties

public void setProjectProperties(java.util.Map projectProperties)


setSearchUpwards

public void setSearchUpwards(boolean searchUpwards)


setSettingsFile

public void setSettingsFile(java.io.File settingsFile)
Sets the settings file to use for the build. Use null to use the default settings file.
Parameters:
settingsFile - The settings file to use. May be null.


setSettingsScriptSource

public void setSettingsScriptSource(org.gradle.groovy.scripts.ScriptSource settingsScriptSource)

Sets the org.gradle.groovy.scripts.ScriptSource to use for the settings script. Set to null to use the default settings script.

Parameters:
settingsScriptSource - The settings script source.


setSystemPropertiesArgs

public void setSystemPropertiesArgs(java.util.Map systemPropertiesArgs)


setTaskNames

public void setTaskNames(java.lang.Iterable taskNames)

Sets the tasks to execute in this build. Set to an empty list, or null, to execute the default tasks for the project. The tasks are executed in the order provided, subject to dependency between the tasks.

Parameters:
taskNames - the names of the tasks to execute in this build.


toString

@Override
public java.lang.String toString()


useEmbeddedBuildFile

public StartParameter useEmbeddedBuildFile(java.lang.String buildScriptText)

Specifies that the given script should be used as the build file for this build. Uses an empty settings file.

Parameters:
buildScriptText - The script to use as the build file.
Returns:
this


 

Groovy Documentation