Question: How is an `AntBuilder` passed around in ...
# plugin-development
k
Question: How is an
AntBuilder
passed around in Gradle? Suppose I have this:
Copy code
fun AntBuilder.taskdef(name: String, classname: String, classpath: Configuration) = withGroovyBuilder { ... }

class MyPlugin : Plugin<Project> {
  override fun apply(project: Project) {
    project.ant.taskdef("myTask", ...)
  }
}
Does that mean that a task defined as so:
Copy code
abstract task MyGradleTask : DefaultTask() {
  @TaskAction
  fun run() {
    ant.withGroovyBuilder {
      "myTask"(...)
    }
  }
}
will only make sense if
MyPlugin
is applied? Conversely, if the
taskdef()
was inside
MyGradleTask
, and you have a
MyOtherGradleTask
that has its own
taskdef()
, will they conflict?