org.gradle
Class StartParameter

java.lang.Object
  extended by org.gradle.StartParameter

public class StartParameter
extends java.lang.Object

StartParameter defines the configuration used by a Gradle instance to execute a build. The properties of StartParameter generally correspond to the command-line options of Gradle. You pass a StartParameter instance to Gradle.newInstance(StartParameter) 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().

See Also:
Gradle

Nested Class Summary
static class StartParameter.ShowStacktrace
           
 
Constructor Summary
StartParameter()
          Creates a StartParameter with default values.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 BuildExecuter getBuildExecuter()
          Returns the BuildExecuter to use for the build.
 java.io.File getBuildFile()
          Returns the build file to use to select the default project.
 ScriptSource getBuildScriptSource()
          Returns the ScriptSource to use for the build file for this build.
 CacheUsage getCacheUsage()
           
 java.io.File getCurrentDir()
          Returns the directory to use to select the default project, and to search for the settings file.
 java.io.File getDefaultImportsFile()
           
 ProjectSpec getDefaultProjectSelector()
          Returns the selector used to choose the default project of the build.
 java.io.File getGradleHomeDir()
           
 java.io.File getGradleUserHomeDir()
           
 LogLevel getLogLevel()
           
 java.io.File getPluginPropertiesFile()
           
 ProjectDependenciesBuildInstruction getProjectDependenciesBuildInstruction()
           
 java.util.Map<java.lang.String,java.lang.String> getProjectProperties()
           
 ScriptSource getSettingsScriptSource()
          Returns the ScriptSource to use for the settings script for this build.
 StartParameter.ShowStacktrace getShowStacktrace()
           
 java.util.Map<java.lang.String,java.lang.String> getSystemPropertiesArgs()
           
 java.util.List<java.lang.String> getTaskNames()
          Returns the names of the tasks to execute in this build.
 int hashCode()
           
 boolean isDryRun()
           
 boolean isNoOpt()
           
 boolean isSearchUpwards()
           
 boolean isShowHelp()
           
 boolean isShowVersion()
           
 StartParameter newBuild()
          Creates the parameters for a new build, using these parameters as a template.
 StartParameter newInstance()
          Duplicates this StartParameter instance.
 void setBuildExecuter(BuildExecuter buildExecuter)
          Sets the BuildExecuter to use for the build.
 void setBuildFile(java.io.File buildFile)
          Sets the build file to use to select the default project.
 void setCacheUsage(CacheUsage cacheUsage)
           
 void setCurrentDir(java.io.File currentDir)
          Sets the directory to use to select the default project, and to search for the settings file.
 void setDefaultImportsFile(java.io.File defaultImportsFile)
           
 void setDefaultProjectSelector(ProjectSpec defaultProjectSelector)
          Sets the selector used to choose the default project of the build.
 void setDryRun(boolean dryRun)
           
 void setGradleHomeDir(java.io.File gradleHomeDir)
           
 void setGradleUserHomeDir(java.io.File gradleUserHomeDir)
           
 void setLogLevel(LogLevel logLevel)
           
 void setNoOpt(boolean noOpt)
           
 void setPluginPropertiesFile(java.io.File pluginPropertiesFile)
           
 void setProjectDependenciesBuildInstruction(ProjectDependenciesBuildInstruction projectDependenciesBuildInstruction)
           
 void setProjectDir(java.io.File projectDir)
          Sets the project directory to use to select the default project.
 void setProjectProperties(java.util.Map<java.lang.String,java.lang.String> projectProperties)
           
 void setSearchUpwards(boolean searchUpwards)
           
 void setSettingsFile(java.io.File settingsFile)
          Sets the settings file to use for the build.
 void setSettingsScriptSource(ScriptSource settingsScriptSource)
          Sets the ScriptSource to use for the settings script.
 void setShowHelp(boolean showHelp)
           
 void setShowStacktrace(StartParameter.ShowStacktrace showStacktrace)
           
 void setShowVersion(boolean showVersion)
           
 void setSystemPropertiesArgs(java.util.Map<java.lang.String,java.lang.String> systemPropertiesArgs)
           
 void setTaskNames(java.util.List<java.lang.String> taskNames)
          Sets the tasks to execute in this build.
 StartParameter useEmbeddedBuildFile(java.lang.String buildScript)
          Specifies that the given script should be used as the build file for this build.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

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

newInstance

public StartParameter newInstance()
Duplicates this StartParameter instance.

Returns:
the new parameters.

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.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

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.

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.

getGradleHomeDir

public java.io.File getGradleHomeDir()

setGradleHomeDir

public void setGradleHomeDir(java.io.File gradleHomeDir)

getBuildScriptSource

public ScriptSource getBuildScriptSource()

Returns the 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.

getSettingsScriptSource

public ScriptSource getSettingsScriptSource()

Returns the 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.

setSettingsScriptSource

public void setSettingsScriptSource(ScriptSource settingsScriptSource)

Sets the ScriptSource to use for the settings script. Set to null to use the default settings script.

Parameters:
settingsScriptSource - The settings script source.

useEmbeddedBuildFile

public StartParameter useEmbeddedBuildFile(java.lang.String 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

getBuildExecuter

public BuildExecuter getBuildExecuter()

Returns the BuildExecuter to use for the build.

Returns:
The BuildExecuter. Never returns null.

setBuildExecuter

public void setBuildExecuter(BuildExecuter buildExecuter)

Sets the BuildExecuter to use for the build. You can use the method to change the algorithm used to execute the build, by providing your own BuildExecuter implementation.

Set to null to use the default executer. When this property is set to a non-null value, the taskNames and mergedBuild properties are ignored.

Parameters:
buildExecuter - The executer to use, or null to use the default executer.

getTaskNames

public java.util.List<java.lang.String> 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.

setTaskNames

public void setTaskNames(java.util.List<java.lang.String> taskNames)

Sets the tasks to execute in this build. Set to an empty list, or null, to execute the default tasks for the project.

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

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.

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.

isSearchUpwards

public boolean isSearchUpwards()

setSearchUpwards

public void setSearchUpwards(boolean searchUpwards)

getProjectProperties

public java.util.Map<java.lang.String,java.lang.String> getProjectProperties()

setProjectProperties

public void setProjectProperties(java.util.Map<java.lang.String,java.lang.String> projectProperties)

getSystemPropertiesArgs

public java.util.Map<java.lang.String,java.lang.String> getSystemPropertiesArgs()

setSystemPropertiesArgs

public void setSystemPropertiesArgs(java.util.Map<java.lang.String,java.lang.String> systemPropertiesArgs)

getGradleUserHomeDir

public java.io.File getGradleUserHomeDir()

setGradleUserHomeDir

public void setGradleUserHomeDir(java.io.File gradleUserHomeDir)

getDefaultImportsFile

public java.io.File getDefaultImportsFile()

setDefaultImportsFile

public void setDefaultImportsFile(java.io.File defaultImportsFile)

getPluginPropertiesFile

public java.io.File getPluginPropertiesFile()

setPluginPropertiesFile

public void setPluginPropertiesFile(java.io.File pluginPropertiesFile)

getProjectDependenciesBuildInstruction

public ProjectDependenciesBuildInstruction getProjectDependenciesBuildInstruction()

setProjectDependenciesBuildInstruction

public void setProjectDependenciesBuildInstruction(ProjectDependenciesBuildInstruction projectDependenciesBuildInstruction)

getCacheUsage

public CacheUsage getCacheUsage()

setCacheUsage

public void setCacheUsage(CacheUsage cacheUsage)

isShowHelp

public boolean isShowHelp()

setShowHelp

public void setShowHelp(boolean showHelp)

isShowVersion

public boolean isShowVersion()

setShowVersion

public void setShowVersion(boolean showVersion)

isDryRun

public boolean isDryRun()

setDryRun

public void setDryRun(boolean dryRun)

isNoOpt

public boolean isNoOpt()

setNoOpt

public void setNoOpt(boolean noOpt)

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.

getLogLevel

public LogLevel getLogLevel()

setLogLevel

public void setLogLevel(LogLevel logLevel)

getShowStacktrace

public StartParameter.ShowStacktrace getShowStacktrace()

setShowStacktrace

public void setShowStacktrace(StartParameter.ShowStacktrace showStacktrace)

getDefaultProjectSelector

public 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.

setDefaultProjectSelector

public void setDefaultProjectSelector(ProjectSpec defaultProjectSelector)
Sets the selector used to choose the default project of the build.

Parameters:
defaultProjectSelector - The selector. Should not be null.

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.