java.io.Serializable
, LoggingConfiguration
, ParallelismConfiguration
public class StartParameter extends java.lang.Object implements LoggingConfiguration, ParallelismConfiguration, java.io.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 | Description |
---|---|---|
static java.io.File |
DEFAULT_GRADLE_USER_HOME |
The default user home directory.
|
static java.lang.String |
GRADLE_USER_HOME_PROPERTY_KEY |
|
protected java.io.File |
gradleHomeDir |
Modifier | Constructor | Description |
---|---|---|
|
StartParameter() |
Creates a
StartParameter with default values. |
protected |
StartParameter(org.gradle.initialization.BuildLayoutParameters layoutParameters) |
Creates a
StartParameter initialized from the given BuildLayoutParameters . |
Modifier and Type | Method | Description |
---|---|---|
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.util.List<java.io.File> |
getAllInitScripts() |
Returns all init scripts, including explicit init scripts and implicit init scripts.
|
java.io.File |
getBuildFile() |
Deprecated.
Setting custom build file to select the default project has been deprecated.
|
ConsoleOutput |
getConsoleOutput() |
Returns the style of logging output that should be written to the console.
|
java.io.File |
getCurrentDir() |
Returns the directory to use to select the default project, and to search for the settings file.
|
DependencyVerificationMode |
getDependencyVerificationMode() |
Returns the dependency verification mode.
|
java.util.Set<java.lang.String> |
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<java.io.File> |
getIncludedBuilds() |
|
java.util.List<java.io.File> |
getInitScripts() |
Returns all explicitly added init scripts that will be run before the build starts.
|
java.util.List<java.lang.String> |
getLockedDependenciesToUpdate() |
Returns the list of modules that are to be allowed to update their version compared to the lockfile.
|
LogLevel |
getLogLevel() |
Returns the minimum logging level to use.
|
int |
getMaxWorkerCount() |
Returns the maximum number of concurrent workers used for underlying build operations.
|
java.io.File |
getProjectCacheDir() |
Returns the project's cache dir.
|
java.io.File |
getProjectDir() |
Returns the project dir to use to select the default project.
|
java.util.Map<java.lang.String,java.lang.String> |
getProjectProperties() |
|
java.io.File |
getSettingsFile() |
Deprecated.
Setting custom build file to select the default project has been deprecated.
|
ShowStacktrace |
getShowStacktrace() |
Returns the detail that should be included in stacktraces.
|
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.
|
java.util.List<TaskExecutionRequest> |
getTaskRequests() |
Returns the tasks to execute in this build.
|
WarningMode |
getWarningMode() |
Specifies which type of warnings should be written to the console.
|
WelcomeMessageConfiguration |
getWelcomeMessageConfiguration() |
Returns when to display a welcome message on the command line.
|
java.util.List<java.lang.String> |
getWriteDependencyVerifications() |
Indicates if a dependency verification metadata file should be written at the
end of this build.
|
int |
hashCode() |
|
void |
includeBuild(java.io.File includedBuild) |
|
boolean |
isBuildCacheDebugLogging() |
Whether build cache debug logging is enabled.
|
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 |
isConfigurationCacheRequested() |
Returns true if configuration caching has been requested.
|
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 |
isExportKeys() |
If true, after writing the dependency verification file, a public keyring
file will be generated with all keys seen during generation of the file.
|
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 |
isRefreshDependencies() |
Specifies whether the dependencies should be refreshed..
|
boolean |
isRefreshKeys() |
If true, Gradle will try to download missing keys again.
|
boolean |
isRerunTasks() |
Specifies whether the cached task results should be ignored and each task should be forced to be executed.
|
boolean |
isWriteDependencyLocks() |
Returns true when dependency resolution is to be persisted for locking
|
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 |
setBuildCacheDebugLogging(boolean buildCacheDebugLogging) |
Whether build cache debug logging is enabled.
|
void |
setBuildCacheEnabled(boolean buildCacheEnabled) |
Enables/disables the build cache.
|
void |
setBuildFile(java.io.File buildFile) |
Deprecated.
Setting custom build file to select the default project has been deprecated.
|
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(java.io.File currentDir) |
Sets the directory to use to select the default project, and to search for the settings file.
|
void |
setDependencyVerificationMode(DependencyVerificationMode verificationMode) |
Sets the dependency verification mode.
|
void |
setDryRun(boolean dryRun) |
|
void |
setExcludedTaskNames(java.lang.Iterable<java.lang.String> excludedTaskNames) |
Sets the tasks to exclude from this build.
|
void |
setExportKeys(boolean exportKeys) |
If true, after writing the dependency verification file, a public keyring
file will be generated with all keys seen during generation of the file.
|
void |
setGradleUserHomeDir(java.io.File gradleUserHomeDir) |
Sets the directory to use as the user home directory.
|
void |
setIncludedBuilds(java.util.List<java.io.File> includedBuilds) |
|
void |
setInitScripts(java.util.List<java.io.File> initScripts) |
Sets the list of init scripts to be run before the build starts.
|
void |
setLockedDependenciesToUpdate(java.util.List<java.lang.String> lockedDependenciesToUpdate) |
Indicates that specified dependencies are to be allowed to update their version.
|
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(java.io.File projectCacheDir) |
Sets the project's cache location.
|
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 |
setRefreshDependencies(boolean refreshDependencies) |
Specifies whether the dependencies should be refreshed..
|
void |
setRefreshKeys(boolean refresh) |
Sets the key refresh flag.
|
void |
setRerunTasks(boolean rerunTasks) |
Specifies whether the cached task results should be ignored and each task should be forced to be executed.
|
void |
setSettingsFile(java.io.File settingsFile) |
Deprecated.
Setting custom settings file for the build has been deprecated.
|
void |
setShowStacktrace(ShowStacktrace showStacktrace) |
Sets the detail that should be included in stacktraces.
|
void |
setSystemPropertiesArgs(java.util.Map<java.lang.String,java.lang.String> systemPropertiesArgs) |
|
void |
setTaskNames(java.lang.Iterable<java.lang.String> taskNames) |
Sets the tasks to execute in this build.
|
void |
setTaskRequests(java.lang.Iterable<? extends TaskExecutionRequest> taskParameters) |
Sets the task parameters to execute in this build.
|
void |
setWarningMode(WarningMode warningMode) |
Specifies which type of warnings should be written to the console.
|
void |
setWelcomeMessageConfiguration(WelcomeMessageConfiguration welcomeMessageConfiguration) |
Updates when to display a welcome message on the command line.
|
void |
setWriteDependencyLocks(boolean writeDependencyLocks) |
Specifies whether dependency resolution needs to be persisted for locking
|
void |
setWriteDependencyVerifications(java.util.List<java.lang.String> checksums) |
Tells if a dependency verification metadata file should be written at the end
of this build.
|
java.lang.String |
toString() |
public static final java.lang.String GRADLE_USER_HOME_PROPERTY_KEY
public static final java.io.File DEFAULT_GRADLE_USER_HOME
protected java.io.File gradleHomeDir
public StartParameter()
StartParameter
with default values. This is roughly equivalent to running Gradle on the command-line with no arguments.protected StartParameter(org.gradle.initialization.BuildLayoutParameters layoutParameters)
StartParameter
initialized from the given BuildLayoutParameters
.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 WarningMode getWarningMode()
getWarningMode
in interface LoggingConfiguration
public void setWarningMode(WarningMode warningMode)
setWarningMode
in interface LoggingConfiguration
public void setProjectCacheDir(@Nullable java.io.File projectCacheDir)
@Nullable public java.io.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 boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
@Deprecated @Nullable public java.io.File getBuildFile()
@Deprecated public void setBuildFile(@Nullable java.io.File buildFile)
setProjectDir(File)
to specify the directory of the default project instead.
This method will be removed in Gradle 9.0.buildFile
- The build file. May be null.public java.util.List<java.lang.String> getTaskNames()
TaskExecutionRequest
s are set for this build then names from these task parameters are returned.public void setTaskNames(@Nullable java.lang.Iterable<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. 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.public java.util.List<TaskExecutionRequest> getTaskRequests()
public void setTaskRequests(java.lang.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 java.util.Set<java.lang.String> getExcludedTaskNames()
public void setExcludedTaskNames(java.lang.Iterable<java.lang.String> excludedTaskNames)
excludedTaskNames
- The task names.public java.io.File getCurrentDir()
public void setCurrentDir(@Nullable java.io.File currentDir)
currentDir
- The directory. Set to null to use the default.public java.util.Map<java.lang.String,java.lang.String> getProjectProperties()
public void setProjectProperties(java.util.Map<java.lang.String,java.lang.String> projectProperties)
public java.util.Map<java.lang.String,java.lang.String> getSystemPropertiesArgs()
public void setSystemPropertiesArgs(java.util.Map<java.lang.String,java.lang.String> systemPropertiesArgs)
public java.io.File getGradleUserHomeDir()
public void setGradleUserHomeDir(@Nullable java.io.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)
@Deprecated public void setSettingsFile(@Nullable java.io.File settingsFile)
setProjectDir(File)
to specify the directory of the default project instead.
This method will be removed in Gradle 9.0.settingsFile
- The settings file to use. May be null.@Deprecated @Nullable public java.io.File getSettingsFile()
public void addInitScript(java.io.File initScriptFile)
initScriptFile
- The init scripts.public void setInitScripts(java.util.List<java.io.File> initScripts)
initScripts
- The init scripts.public java.util.List<java.io.File> getInitScripts()
public java.util.List<java.io.File> getAllInitScripts()
public void setProjectDir(@Nullable java.io.File projectDir)
projectDir
- The project directory. May be null.@Nullable public java.io.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 isParallelProjectExecutionEnabled()
isParallelProjectExecutionEnabled
in interface ParallelismConfiguration
ParallelismConfiguration.getMaxWorkerCount()
public void setParallelProjectExecutionEnabled(boolean parallelProjectExecution)
setParallelProjectExecutionEnabled
in interface ParallelismConfiguration
ParallelismConfiguration.isParallelProjectExecutionEnabled()
public boolean isBuildCacheEnabled()
public void setBuildCacheEnabled(boolean buildCacheEnabled)
public boolean isBuildCacheDebugLogging()
public void setBuildCacheDebugLogging(boolean buildCacheDebugLogging)
public int getMaxWorkerCount()
getMaxWorkerCount
in interface ParallelismConfiguration
Runtime.availableProcessors()
public void setMaxWorkerCount(int maxWorkerCount)
setMaxWorkerCount
in interface ParallelismConfiguration
ParallelismConfiguration.getMaxWorkerCount()
@Incubating public boolean isConfigureOnDemand()
public java.lang.String toString()
toString
in class java.lang.Object
@Incubating public void setConfigureOnDemand(boolean configureOnDemand)
public boolean isContinuous()
public void setContinuous(boolean enabled)
public void includeBuild(java.io.File includedBuild)
public void setIncludedBuilds(java.util.List<java.io.File> includedBuilds)
public java.util.List<java.io.File> getIncludedBuilds()
public boolean isBuildScan()
public void setBuildScan(boolean buildScan)
public boolean isNoBuildScan()
public void setNoBuildScan(boolean noBuildScan)
public void setWriteDependencyLocks(boolean writeDependencyLocks)
public boolean isWriteDependencyLocks()
public void setLockedDependenciesToUpdate(java.util.List<java.lang.String> lockedDependenciesToUpdate)
lockedDependenciesToUpdate
- the modules to updateisWriteDependencyLocks()
public java.util.List<java.lang.String> getWriteDependencyVerifications()
public void setWriteDependencyVerifications(java.util.List<java.lang.String> checksums)
checksums
- the list of checksums to generatepublic java.util.List<java.lang.String> getLockedDependenciesToUpdate()
public void setDependencyVerificationMode(DependencyVerificationMode verificationMode)
verificationMode
- if true, enables lenient dependency verificationpublic DependencyVerificationMode getDependencyVerificationMode()
public void setRefreshKeys(boolean refresh)
refresh
- If set to true, missing keys will be checked again. By default missing keys are cached for 24 hours.public boolean isRefreshKeys()
public boolean isExportKeys()
public void setExportKeys(boolean exportKeys)
exportKeys
- set to true if keys should be exported@Incubating public WelcomeMessageConfiguration getWelcomeMessageConfiguration()
WelcomeMessageDisplayMode
@Incubating public void setWelcomeMessageConfiguration(WelcomeMessageConfiguration welcomeMessageConfiguration)
welcomeMessageConfiguration
- The welcome message configuration.WelcomeMessageDisplayMode
@Incubating public boolean isConfigurationCacheRequested()