ScriptHandler

A ScriptHandler allows you to manage the compilation and execution of a build script. You can declare the classpath used to compile and execute a build script. This classpath is also used to load the plugins which the build script uses.

You can obtain a ScriptHandler instance using getBuildscript or getBuildscript.

To declare the script classpath, you use the org.gradle.api.artifacts.dsl.DependencyHandler provided by getDependencies to attach dependencies to the {@value #CLASSPATH_CONFIGURATION} configuration. These dependencies are resolved just prior to script compilation, and assembled into the classpath for the script.

For most external dependencies you will also need to declare one or more repositories where the dependencies can be found, using the org.gradle.api.artifacts.dsl.RepositoryHandler provided by getRepositories.

Properties

Link copied to clipboard
val CLASSPATH_CONFIGURATION: String = "classpath"
The name of the configuration used to assemble the script classpath.

Functions

Link copied to clipboard
abstract fun configurations(configureClosure: Action<in ConfigurationContainer>)
Configures the configurations for the script.
Link copied to clipboard
abstract fun dependencies(configureClosure: Closure)
Configures the dependencies for the script.
Link copied to clipboard
abstract fun dependencyLocking(configureClosure: Closure)
Configures dependency locking
Link copied to clipboard
fun ScriptHandler.dependencyLocking(configuration: DependencyLockingHandler.() -> Unit)

Configures the dependency locking for the script dependency configurations.

Link copied to clipboard
abstract fun getClassLoader(): ClassLoader
Returns the ClassLoader which contains the classpath for this script.
Link copied to clipboard
Returns the configurations of this handler.
Link copied to clipboard
Returns the dependencies of the script.
Link copied to clipboard
Provides access to configuring dependency locking
Link copied to clipboard
Returns a handler to create repositories which are used for retrieving dependencies for the script classpath.
Link copied to clipboard
@Nullable
abstract fun getSourceFile(): File
Returns the file containing the source for the script, if any.
Link copied to clipboard
@Nullable
abstract fun getSourceURI(): URI
Returns the URI for the script source, if any.
Link copied to clipboard
abstract fun repositories(configureClosure: Closure)
Configures the repositories for the script dependencies.
Link copied to clipboard

Configures the repositories for the script dependencies.