Slackbot
07/24/2023, 5:54 PMTom Koptel
07/24/2023, 6:34 PMdef compileShmStaticLibraryShmCpp = tasks.named(":qgi:compileShmStaticLibraryShmCpp")
def compileUdsStaticLibraryUdsCpp = tasks.named(":qgi:compileUdsStaticLibraryUdsCpp")
platforms.each { platform ->
tasks.register(name: "copyDependentDebugObjects${platform.capitalize()}", type: Copy) {
// you need to sneak peek into the implementation of task to figure its output file
from(compileShmStaticLibraryShmCpp.map { it.output })
from(compileUdsStaticLibraryUdsCpp.map { it.output })
into(project.layout.buildDirectory.dir("/objs/main/shared/mainCpp/${platform}"))
}
When you named
and register
will give you Provider<Task>
types. Then with map
or flatMap
you can access outputs of the task and wire them inputs to the task you register. This allows you avoid explicitely setting using dependsOn
as well as this would follow the task configuration avoidance mantra.Dileepkumar Siriki
07/25/2023, 4:59 AM