public interface 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 Project.getBuildscript()
or Script.getBuildscript()
.
To declare the script classpath, you use the DependencyHandler
provided by
getDependencies()
to attach dependencies to the "classpath" 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 RepositoryHandler
provided by getRepositories()
.
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
CLASSPATH_CONFIGURATION |
The name of the configuration used to assemble the script classpath.
|
Modifier and Type | Method | Description |
---|---|---|
void |
dependencies(Closure configureClosure) |
Configures the dependencies for the script.
|
void |
dependencyLocking(Closure configureClosure) |
Configures dependency locking
|
java.lang.ClassLoader |
getClassLoader() |
Returns the
ClassLoader which contains the classpath for this script. |
ConfigurationContainer |
getConfigurations() |
Returns the configurations of this handler.
|
DependencyHandler |
getDependencies() |
Returns the dependencies of the script.
|
DependencyLockingHandler |
getDependencyLocking() |
Provides access to configuring dependency locking
|
RepositoryHandler |
getRepositories() |
Returns a handler to create repositories which are used for retrieving dependencies for the script classpath.
|
java.io.File |
getSourceFile() |
Returns the file containing the source for the script, if any.
|
java.net.URI |
getSourceURI() |
Returns the URI for the script source, if any.
|
void |
repositories(Closure configureClosure) |
Configures the repositories for the script dependencies.
|
static final java.lang.String CLASSPATH_CONFIGURATION
@Nullable java.io.File getSourceFile()
@Nullable java.net.URI getSourceURI()
RepositoryHandler getRepositories()
void repositories(Closure configureClosure)
RepositoryHandler
for this handler. The RepositoryHandler
is passed to the closure as the closure's
delegate.configureClosure
- the closure to use to configure the repositories.DependencyHandler getDependencies()
getConfigurations()
void dependencies(Closure configureClosure)
DependencyHandler
for
this handler. The DependencyHandler
is passed to the closure as the closure's delegate.configureClosure
- the closure to use to configure the dependencies.ConfigurationContainer getConfigurations()
void dependencyLocking(Closure configureClosure)
configureClosure
- the configuration actionDependencyLockingHandler getDependencyLocking()
DependencyLockingHandler
java.lang.ClassLoader getClassLoader()
ClassLoader
which contains the classpath for this script.