api / org.gradle / StartParameter

StartParameter

open class StartParameter : 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.

Constructors

<init>

StartParameter()

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

Properties

DEFAULT_GRADLE_USER_HOME

static val DEFAULT_GRADLE_USER_HOME: File

The default user home directory.

GRADLE_USER_HOME_PROPERTY_KEY

static val GRADLE_USER_HOME_PROPERTY_KEY: String

Functions

addInitScript

open fun addInitScript(initScriptFile: File): Unit

Adds the given file to the list of init scripts that are run before the build starts. This list is in addition to the default init scripts.

equals

open fun equals(other: Any?): Boolean

getAllInitScripts

open fun getAllInitScripts(): MutableList<File>

Returns all init scripts, including explicit init scripts and implicit init scripts.

getBuildFile

open fun getBuildFile(): File

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.

getConsoleOutput

open fun getConsoleOutput(): ConsoleOutput

{@inheritDoc}

getCurrentDir

open fun getCurrentDir(): File

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

getExcludedTaskNames

open fun getExcludedTaskNames(): MutableSet<String>

Returns the names of the tasks to be excluded from this build. When empty, no tasks are excluded from the build.

getGradleUserHomeDir

open fun getGradleUserHomeDir(): File

Returns the directory to use as the user home directory.

getIncludedBuilds

open fun getIncludedBuilds(): MutableList<File>

getInitScripts

open fun getInitScripts(): MutableList<File>

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.

getLockedDependenciesToUpdate

open fun getLockedDependenciesToUpdate(): MutableList<String>

Returns the list of modules that are to be allowed to update their version compared to the lockfile.

getLogLevel

open fun getLogLevel(): LogLevel

{@inheritDoc}

getMaxWorkerCount

open fun getMaxWorkerCount(): Int

{@inheritDoc}

getProjectCacheDir

open fun getProjectCacheDir(): File

Returns the project's cache dir.

getProjectDir

open fun getProjectDir(): File

Returns the project dir to use to select the default project. Returns null when the build file is not used to select the default project

getProjectProperties

open fun getProjectProperties(): MutableMap<String, String>

getSettingsFile

open fun getSettingsFile(): File

Returns the explicit settings file to use for the build, or null. Will return null if the default settings file is to be used. However, if #isUseEmptySettings() returns true, then no settings file at all will be used.

getShowStacktrace

open fun getShowStacktrace(): ShowStacktrace

{@inheritDoc}

getSystemPropertiesArgs

open fun getSystemPropertiesArgs(): MutableMap<String, String>

getTaskNames

open fun getTaskNames(): MutableList<String>

Returns the names of the tasks to execute in this build. When empty, the default tasks for the project will be executed. If TaskExecutionRequests are set for this build then names from these task parameters are returned.

getTaskRequests

open fun getTaskRequests(): MutableList<TaskExecutionRequest>

Returns the tasks to execute in this build. When empty, the default tasks for the project will be executed.

getWarningMode

open fun getWarningMode(): WarningMode

{@inheritDoc}

hashCode

open fun hashCode(): Int

includeBuild

open fun includeBuild(includedBuild: File): Unit

isBuildCacheDebugLogging

open fun isBuildCacheDebugLogging(): Boolean

Whether build cache debug logging is enabled.

isBuildCacheEnabled

open fun isBuildCacheEnabled(): Boolean

Returns true if the build cache is enabled.

isBuildProjectDependencies

open fun isBuildProjectDependencies(): Boolean

Returns true if project dependencies are to be built, false if they should not be. The default is true.

isBuildScan

open fun isBuildScan(): Boolean

Returns true if build scan should be created.

isConfigureOnDemand

open fun isConfigureOnDemand(): Boolean

If the configure-on-demand mode is active

isContinueOnFailure

open fun isContinueOnFailure(): Boolean

Specifies whether the build should continue on task failure. The default is false.

isContinuous

open fun isContinuous(): Boolean

isDryRun

open fun isDryRun(): Boolean

isInteractive

open fun isInteractive(): Boolean

Returns true when console is interactive.

isNoBuildScan

open fun isNoBuildScan(): Boolean

Returns true when build scan creation is explicitly disabled.

isOffline

open fun isOffline(): Boolean

Specifies whether the build should be performed offline (ie without network access).

isParallelProjectExecutionEnabled

open fun isParallelProjectExecutionEnabled(): Boolean

{@inheritDoc}

isProfile

open fun isProfile(): Boolean

Returns true if a profile report will be generated.

isRecompileScripts

open fun isRecompileScripts(): Boolean

Specifies whether the build scripts should be recompiled.

isRefreshDependencies

open fun isRefreshDependencies(): Boolean

Specifies whether the dependencies should be refreshed..

isRerunTasks

open fun isRerunTasks(): Boolean

Specifies whether the cached task results should be ignored and each task should be forced to be executed.

isSearchUpwards

open fun isSearchUpwards(): Boolean

isUseEmptySettings

open fun isUseEmptySettings(): Boolean

Returns whether an empty settings script will be used regardless of whether one exists in the default location.

isWriteDependencyLocks

open fun isWriteDependencyLocks(): Boolean

Returns true when dependency resolution is to be persisted for locking

newBuild

open fun newBuild(): StartParameter

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

newInstance

open fun newInstance(): StartParameter

Duplicates this StartParameter instance.

setBuildCacheDebugLogging

open fun setBuildCacheDebugLogging(buildCacheDebugLogging: Boolean): Unit

Whether build cache debug logging is enabled.

setBuildCacheEnabled

open fun setBuildCacheEnabled(buildCacheEnabled: Boolean): Unit

Enables/disables the build cache.

setBuildFile

open fun setBuildFile(buildFile: File): Unit

Sets the build file to use to select the default project. Use null to disable selecting the default project using the build file.

setBuildProjectDependencies

open fun setBuildProjectDependencies(build: Boolean): StartParameter

Specifies whether project dependencies should be built. Defaults to true.

setBuildScan

open fun setBuildScan(buildScan: Boolean): Unit

Specifies whether a build scan should be created.

setConfigureOnDemand

open fun setConfigureOnDemand(configureOnDemand: Boolean): Unit

setConsoleOutput

open fun setConsoleOutput(consoleOutput: ConsoleOutput): Unit

{@inheritDoc}

setContinueOnFailure

open fun setContinueOnFailure(continueOnFailure: Boolean): Unit

Specifies whether the build should continue on task failure. The default is false.

setContinuous

open fun setContinuous(enabled: Boolean): Unit

setCurrentDir

open fun setCurrentDir(currentDir: File): Unit

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.

setDryRun

open fun setDryRun(dryRun: Boolean): Unit

setExcludedTaskNames

open fun setExcludedTaskNames(excludedTaskNames: MutableIterable<String>): Unit

Sets the tasks to exclude from this build.

setGradleUserHomeDir

open fun setGradleUserHomeDir(gradleUserHomeDir: File): Unit

Sets the directory to use as the user home directory. Set to null to use the default directory.

setIncludedBuilds

open fun setIncludedBuilds(includedBuilds: MutableList<File>): Unit

setInitScripts

open fun setInitScripts(initScripts: MutableList<File>): Unit

Sets the list of init scripts to be run before the build starts. This list is in addition to the default init scripts.

setInteractive

open fun setInteractive(interactive: Boolean): Unit

Specifies whether console is interactive.

setLockedDependenciesToUpdate

open fun setLockedDependenciesToUpdate(lockedDependenciesToUpdate: MutableList<String>): Unit

Indicates that specified dependencies are to be allowed to update their version. Implicitly activates dependency locking persistence.

setLogLevel

open fun setLogLevel(logLevel: LogLevel): Unit

{@inheritDoc}

setMaxWorkerCount

open fun setMaxWorkerCount(maxWorkerCount: Int): Unit

{@inheritDoc}

setNoBuildScan

open fun setNoBuildScan(noBuildScan: Boolean): Unit

Specifies whether build scan creation is explicitly disabled.

setOffline

open fun setOffline(offline: Boolean): Unit

Specifies whether the build should be performed offline (ie without network access).

setParallelProjectExecutionEnabled

open fun setParallelProjectExecutionEnabled(parallelProjectExecution: Boolean): Unit

{@inheritDoc}

setProfile

open fun setProfile(profile: Boolean): Unit

Specifies if a profile report should be generated.

setProjectCacheDir

open fun setProjectCacheDir(projectCacheDir: File): Unit

Sets the project's cache location. Set to null to use the default location.

setProjectDir

open fun setProjectDir(projectDir: File): Unit

Sets the project directory to use to select the default project. Use null to use the default criteria for selecting the default project.

setProjectProperties

open fun setProjectProperties(projectProperties: MutableMap<String, String>): Unit

setRecompileScripts

open fun setRecompileScripts(recompileScripts: Boolean): Unit

Specifies whether the build scripts should be recompiled.

setRefreshDependencies

open fun setRefreshDependencies(refreshDependencies: Boolean): Unit

Specifies whether the dependencies should be refreshed..

setRerunTasks

open fun setRerunTasks(rerunTasks: Boolean): Unit

Specifies whether the cached task results should be ignored and each task should be forced to be executed.

setSearchUpwards

open fun setSearchUpwards(searchUpwards: Boolean): Unit

setSettingsFile

open fun setSettingsFile(settingsFile: File): Unit

Sets the settings file to use for the build. Use null to use the default settings file.

setShowStacktrace

open fun setShowStacktrace(showStacktrace: ShowStacktrace): Unit

{@inheritDoc}

setSystemPropertiesArgs

open fun setSystemPropertiesArgs(systemPropertiesArgs: MutableMap<String, String>): Unit

setTaskNames

open fun setTaskNames(taskNames: MutableIterable<String>): Unit

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.

setTaskRequests

open fun setTaskRequests(taskParameters: MutableIterable<TaskExecutionRequest>): Unit

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.

setWarningMode

open fun setWarningMode(warningMode: WarningMode): Unit

{@inheritDoc}

setWriteDependencyLocks

open fun setWriteDependencyLocks(writeDependencyLocks: Boolean): Unit

Specifies whether dependency resolution needs to be persisted for locking

toString

open fun toString(): String

useEmptySettings

open fun useEmptySettings(): StartParameter

Specifies that an empty settings script should be used. This means that even if a settings file exists in the conventional location, or has been previously specified by #setSettingsFile(File), it will not be used. If #setSettingsFile(File) is called after this, it will supersede calling this method.