public class StartParameter extends Object implements LoggingConfiguration, ParallelismConfiguration, Serializable
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 can obtain an instance of a StartParameter
by either creating a new one, or duplicating an existing one using newInstance()
or newBuild()
.
Modifier and Type | Field and Description |
---|---|
static File |
DEFAULT_GRADLE_USER_HOME
The default user home directory.
|
static String |
GRADLE_USER_HOME_PROPERTY_KEY |
Constructor and Description |
---|
StartParameter()
Creates a
StartParameter with default values. |
Modifier and Type | Method and Description |
---|---|
void |
addInitScript(File initScriptFile)
Adds the given file to the list of init scripts that are run before the build starts.
|
boolean |
equals(Object obj) |
List<File> |
getAllInitScripts()
Returns all init scripts, including explicit init scripts and implicit init scripts.
|
File |
getBuildFile()
Returns the build file to use to select the default project.
|
ConsoleOutput |
getConsoleOutput()
Returns the style of logging output that should be written to the console.
|
File |
getCurrentDir()
Returns the directory to use to select the default project, and to search for the settings file.
|
Set<String> |
getExcludedTaskNames()
Returns the names of the tasks to be excluded from this build.
|
File |
getGradleUserHomeDir()
Returns the directory to use as the user home directory.
|
List<File> |
getIncludedBuilds() |
List<File> |
getInitScripts()
Returns all explicitly added init scripts that will be run before the build starts.
|
LogLevel |
getLogLevel()
Returns the minimum logging level to use.
|
int |
getMaxWorkerCount()
Returns the maximum number of concurrent workers used for underlying build operations.
|
File |
getProjectCacheDir()
Returns the project's cache dir.
|
File |
getProjectDir()
Returns the project dir to use to select the default project.
|
Map<String,String> |
getProjectProperties() |
File |
getSettingsFile()
Returns the explicit settings file to use for the build, or null.
|
ShowStacktrace |
getShowStacktrace()
Returns the detail that should be included in stacktraces.
|
Map<String,String> |
getSystemPropertiesArgs() |
List<String> |
getTaskNames()
Returns the names of the tasks to execute in this build.
|
List<TaskExecutionRequest> |
getTaskRequests()
Returns the tasks to execute in this build.
|
int |
hashCode() |
void |
includeBuild(File includedBuild) |
boolean |
isBuildCacheEnabled()
Returns true if the build cache is enabled.
|
boolean |
isBuildProjectDependencies()
Returns true if project dependencies are to be built, false if they should not be.
|
boolean |
isBuildScan()
Returns true if build scan should be created.
|
boolean |
isConfigureOnDemand()
If the configure-on-demand mode is active
|
boolean |
isContinueOnFailure()
Specifies whether the build should continue on task failure.
|
boolean |
isContinuous() |
boolean |
isDryRun() |
boolean |
isNoBuildScan()
Returns true when build scan creation is explicitly disabled.
|
boolean |
isOffline()
Specifies whether the build should be performed offline (ie without network access).
|
boolean |
isParallelProjectExecutionEnabled()
Returns true if parallel project execution is enabled.
|
boolean |
isProfile()
Returns true if a profile report will be generated.
|
boolean |
isRecompileScripts()
Specifies whether the build scripts should be recompiled.
|
boolean |
isRefreshDependencies()
Specifies whether the dependencies should be refreshed..
|
boolean |
isRerunTasks()
Specifies whether the cached task results should be ignored and each task should be forced to be executed.
|
boolean |
isSearchUpwards() |
boolean |
isTaskOutputCacheEnabled()
Deprecated.
|
boolean |
isUseEmptySettings()
Returns whether an empty settings script will be used regardless of whether one exists in the default location.
|
StartParameter |
newBuild()
Creates the parameters for a new build, using these parameters as a template.
|
StartParameter |
newInstance()
Duplicates this
StartParameter instance. |
protected StartParameter |
prepareNewBuild(StartParameter p) |
protected StartParameter |
prepareNewInstance(StartParameter p) |
void |
setBuildCacheEnabled(boolean buildCacheEnabled)
Enables/disables the build cache.
|
void |
setBuildFile(File buildFile)
Sets the build file to use to select the default project.
|
StartParameter |
setBuildProjectDependencies(boolean build)
Specifies whether project dependencies should be built.
|
void |
setBuildScan(boolean buildScan)
Specifies whether a build scan should be created.
|
void |
setConfigureOnDemand(boolean configureOnDemand) |
void |
setConsoleOutput(ConsoleOutput consoleOutput)
Specifies the style of logging output that should be written to the console.
|
void |
setContinueOnFailure(boolean continueOnFailure)
Specifies whether the build should continue on task failure.
|
void |
setContinuous(boolean enabled) |
void |
setCurrentDir(File currentDir)
Sets the directory to use to select the default project, and to search for the settings file.
|
void |
setDryRun(boolean dryRun) |
void |
setExcludedTaskNames(Iterable<String> excludedTaskNames)
Sets the tasks to exclude from this build.
|
void |
setGradleUserHomeDir(File gradleUserHomeDir)
Sets the directory to use as the user home directory.
|
void |
setIncludedBuilds(List<File> includedBuilds) |
void |
setInitScripts(List<File> initScripts)
Sets the list of init scripts to be run before the build starts.
|
void |
setLogLevel(LogLevel logLevel)
Specifies the minimum logging level to use.
|
void |
setMaxWorkerCount(int maxWorkerCount)
Specifies the maximum number of concurrent workers used for underlying build operations.
|
void |
setNoBuildScan(boolean noBuildScan)
Specifies whether build scan creation is explicitly disabled.
|
void |
setOffline(boolean offline)
Specifies whether the build should be performed offline (ie without network access).
|
void |
setParallelProjectExecutionEnabled(boolean parallelProjectExecution)
Enables/disables parallel project execution.
|
void |
setProfile(boolean profile)
Specifies if a profile report should be generated.
|
void |
setProjectCacheDir(File projectCacheDir)
Sets the project's cache location.
|
void |
setProjectDir(File projectDir)
Sets the project directory to use to select the default project.
|
void |
setProjectProperties(Map<String,String> projectProperties) |
void |
setRecompileScripts(boolean recompileScripts)
Specifies whether the build scripts should be recompiled.
|
void |
setRefreshDependencies(boolean refreshDependencies)
Specifies whether the dependencies should be refreshed..
|
void |
setRerunTasks(boolean rerunTasks)
Specifies whether the cached task results should be ignored and each task should be forced to be executed.
|
void |
setSearchUpwards(boolean searchUpwards) |
void |
setSettingsFile(File settingsFile)
Sets the settings file to use for the build.
|
void |
setShowStacktrace(ShowStacktrace showStacktrace)
Sets the detail that should be included in stacktraces.
|
void |
setSystemPropertiesArgs(Map<String,String> systemPropertiesArgs) |
void |
setTaskNames(Iterable<String> taskNames)
Sets the tasks to execute in this build.
|
void |
setTaskOutputCacheEnabled(boolean buildCacheEnabled)
Deprecated.
|
void |
setTaskRequests(Iterable<? extends TaskExecutionRequest> taskParameters)
Sets the task parameters to execute in this build.
|
String |
toString() |
StartParameter |
useEmptySettings()
Specifies that an empty settings script should be used.
|
public static final String GRADLE_USER_HOME_PROPERTY_KEY
public static final File DEFAULT_GRADLE_USER_HOME
public StartParameter()
StartParameter
with default values. This is roughly equivalent to running Gradle on the command-line with no arguments.public LogLevel getLogLevel()
LogLevel.LIFECYCLE
.getLogLevel
in interface LoggingConfiguration
public void setLogLevel(LogLevel logLevel)
setLogLevel
in interface LoggingConfiguration
public ShowStacktrace getShowStacktrace()
ShowStacktrace.INTERNAL_EXCEPTIONS
.getShowStacktrace
in interface LoggingConfiguration
public void setShowStacktrace(ShowStacktrace showStacktrace)
setShowStacktrace
in interface LoggingConfiguration
public ConsoleOutput getConsoleOutput()
ConsoleOutput.Auto
getConsoleOutput
in interface LoggingConfiguration
public void setConsoleOutput(ConsoleOutput consoleOutput)
setConsoleOutput
in interface LoggingConfiguration
public void setProjectCacheDir(File projectCacheDir)
public File getProjectCacheDir()
public StartParameter newInstance()
StartParameter
instance.protected StartParameter prepareNewInstance(StartParameter p)
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).
protected StartParameter prepareNewBuild(StartParameter p)
public File getBuildFile()
public void setBuildFile(File buildFile)
buildFile
- The build file. May be null.public StartParameter useEmptySettings()
setSettingsFile(java.io.File)
, it will not be used.
If setSettingsFile(java.io.File)
is called after this, it will supersede calling this method.public boolean isUseEmptySettings()
public List<String> getTaskNames()
TaskExecutionRequest
s are set for this build then names from
these task parameters are returned.public void setTaskNames(Iterable<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. The tasks are executed in the order provided, subject to dependency between the tasks.
taskNames
- the names of the tasks to execute in this build.@Incubating public List<TaskExecutionRequest> getTaskRequests()
@Incubating public void setTaskRequests(Iterable<? extends TaskExecutionRequest> taskParameters)
Sets the task parameters to execute in this build. Set to an empty list, to execute the default tasks for the project. The tasks are executed in the order provided, subject to dependency between the tasks.
taskParameters
- the tasks to execute in this build.public Set<String> getExcludedTaskNames()
public void setExcludedTaskNames(Iterable<String> excludedTaskNames)
excludedTaskNames
- The task names. Can be null.public File getCurrentDir()
public void setCurrentDir(File currentDir)
currentDir
- The directory. Set to null to use the default.public boolean isSearchUpwards()
public void setSearchUpwards(boolean searchUpwards)
public void setSystemPropertiesArgs(Map<String,String> systemPropertiesArgs)
public File getGradleUserHomeDir()
public void setGradleUserHomeDir(File gradleUserHomeDir)
gradleUserHomeDir
- The home directory. May be null.public boolean isBuildProjectDependencies()
public StartParameter setBuildProjectDependencies(boolean build)
public boolean isDryRun()
public void setDryRun(boolean dryRun)
public void setSettingsFile(File settingsFile)
settingsFile
- The settings file to use. May be null.public File getSettingsFile()
isUseEmptySettings()
returns true, then no settings file at all will be used.isUseEmptySettings()
public void addInitScript(File initScriptFile)
initScriptFile
- The init scripts.public void setInitScripts(List<File> initScripts)
initScripts
- The init scripts.public List<File> getInitScripts()
@Incubating public List<File> getAllInitScripts()
public void setProjectDir(File projectDir)
projectDir
- The project directory. May be null.public File getProjectDir()
public void setProfile(boolean profile)
profile
- true if a profile report should be generatedpublic boolean isProfile()
public boolean isContinueOnFailure()
public void setContinueOnFailure(boolean continueOnFailure)
public boolean isOffline()
public void setOffline(boolean offline)
public boolean isRefreshDependencies()
public void setRefreshDependencies(boolean refreshDependencies)
public boolean isRerunTasks()
public void setRerunTasks(boolean rerunTasks)
public boolean isRecompileScripts()
public void setRecompileScripts(boolean recompileScripts)
@Incubating public boolean isParallelProjectExecutionEnabled()
isParallelProjectExecutionEnabled
in interface ParallelismConfiguration
ParallelismConfiguration.getMaxWorkerCount()
@Incubating public void setParallelProjectExecutionEnabled(boolean parallelProjectExecution)
setParallelProjectExecutionEnabled
in interface ParallelismConfiguration
ParallelismConfiguration.isParallelProjectExecutionEnabled()
@Incubating public boolean isBuildCacheEnabled()
@Incubating public void setBuildCacheEnabled(boolean buildCacheEnabled)
@Incubating @Deprecated public boolean isTaskOutputCacheEnabled()
isBuildCacheEnabled()
@Incubating @Deprecated public void setTaskOutputCacheEnabled(boolean buildCacheEnabled)
setBuildCacheEnabled(boolean)
@Incubating public int getMaxWorkerCount()
getMaxWorkerCount
in interface ParallelismConfiguration
Runtime.availableProcessors()
@Incubating public void setMaxWorkerCount(int maxWorkerCount)
setMaxWorkerCount
in interface ParallelismConfiguration
ParallelismConfiguration.getMaxWorkerCount()
@Incubating public boolean isConfigureOnDemand()
@Incubating public void setConfigureOnDemand(boolean configureOnDemand)
@Incubating public boolean isContinuous()
@Incubating public void setContinuous(boolean enabled)
@Incubating public void includeBuild(File includedBuild)
@Incubating public void setIncludedBuilds(List<File> includedBuilds)
@Incubating public List<File> getIncludedBuilds()
@Incubating public boolean isBuildScan()
@Incubating public void setBuildScan(boolean buildScan)
@Incubating public boolean isNoBuildScan()
@Incubating public void setNoBuildScan(boolean noBuildScan)