Base class for an extension that can both be used on a project or a task.
Constructor and description |
---|
protected AbstractCombinedProjectTaskExtension
(Project project) Attach this extension to a project |
protected AbstractCombinedProjectTaskExtension
(Task task, String projectExtName) Attach this extension to a task |
Type Params | Return Type | Name and description |
---|---|---|
|
protected Project |
getProject() Project this extension is associated with. |
|
protected AbstractCombinedProjectTaskExtension |
getProjectExtension() Returns the extension that is attached to the project. |
|
protected ExtensionContainer |
getProjectExtensions() Returns the project's extension container, but safe in configuration cache context. |
|
protected ProjectOperations |
getProjectOperations() Returns a instance of ProjectOperations. |
|
protected Task |
getTask() Task this extension is attached to. |
|
Object |
getValue(groovy.lang.Closure getter) Uses a closure to resolve a value on a project extension or a task extension. |
|
Object |
getValueByMethod(String methodName) Uses reflection to invoke a method on a project extension or a task extension. |
Attach this extension to a project
project
- Project to attach to.Project this extension is associated with.
task ? task.project : project
Returns the extension that is attached to the project. This method should not be called in Gradle's execution phase.
Returns the project's extension container, but safe in configuration cache context.
project.extensions
Returns a instance of ProjectOperations.
Task this extension is attached to.
null
if extension is not attached to a task.Uses a closure to resolve a value on a project extension or a task extension. If the extension is attached to a task and the returned value is null, it will first try to resolve the value by the project extension.
getter
- A closure which will be passed an extension object which is an implementation of
AbstractCombinedProjectTaskExtension
.null
.Uses reflection to invoke a method on a project extension or a task extension. If the extension is attached to a task and the returned value is null, it will first try to resolve the value by the project extension.
methodName
- Method to invoke.null
.