Martin
06/11/2024, 12:36 PMVampire
06/11/2024, 1:57 PMval foo by configurations.consumable("foo")
val sideEffect by tasks.registering {
outputs.file(temporaryDir)
}
foo.outgoing.artifact(sideEffect)
or you could depend on the task by string path like implementation(":subproject:task") as that is resolved as late as possible.
It is less typesafe than to reach into the subproject model to get the task reference, but more clean as it does not as much couple the projects. If you are not concerned about the project coupling (but you should) you could maybe also do something like implementation(project(":subproject").tasks.named { it = "task" }), but that will also completely break task-configuration avoidance unless https://github.com/gradle/gradle/issues/28347 is resolved.Martin
06/11/2024, 2:26 PMyou could depend on the task by string path likeAh! that was what I was missing. That sounds exactly like what I’m looking for 👍as that is resolved as late as possibleimplementation(":subproject:task")
Martin
06/11/2024, 2:27 PMIsolatedProjectMartin
06/11/2024, 2:31 PM":subproject:task" may not exist.... So I guess fake artifact it is 👍Vampire
06/11/2024, 2:40 PM