[solved] hello! I'm writing custom gradle plugin a...
# gradle
d
[solved] hello! I'm writing custom gradle plugin and trying to figure out proper configuration for tasks and plugin extension • I have 2 tasks (
A
and
B
) that can be executed independently of each other • task
B
can optionally take an input from task
A
output (or just read file from a file system) • [works] I would like to provide an option for end users to either configure tasks directly in their build scripts
Copy code
// build.gradle.kts
val a by tasks.getting(TaskA::class) {
  propA.set("whatever")
}
tasks.withType(TaskB::class) {
  propB.set("xyz")
  input.set(a.output)
  dependsOn("taskA")
}
• [doesn't work] I would also like to provide an option to to automatically create those tasks and their dependencies if project extension is configured, e.g.
Copy code
// build.gradle.kts
myExtension {
  propA = "whatever"
  propB = "xyz"
}
Is that even possible?
example project that applies the plugin with explicit task config -> https://github.com/dariuszkuc/graphql-kotlin/blob/plugin/examples/client/gradle-client/build.gradle.kts
my issue was that I needed to configure tasks based on extension properties in
project.afterEvaluate
block