Hi! Is there any better DSL to configure tasks (e...
# gradle
m
Hi! Is there any better DSL to configure tasks (e.g.
jar
) then this:
Copy code
(tasks["jar"] as Jar).apply {
    (manifest as OsgiManifest).apply {
        name = "..."
        symbolicName = "..."
        vendor = "..."

        instruction(
                "Import-Package", "a.b.c"
        )
    }
}
?
d
madhead: I think it’s pretty great! It’s type-safe, isolated and IDE-supported
Alternatively you could just assign the task and manifest to `val`s if you want to avoid
apply
“magic”
c
Copy code
tasks.withType<Jar> {
	manifest {
		(this as OsgiManifest).name = "..."
		symbolicName = "..."
		vendor = "..."
		instruction("Import-Package", "a.b.c")
	}
}
This will not work correctly, if you have more than one task of type Jar, because this style applies configuration to all tasks of given type. I have no idea if that's possible, though.
m
Ok then, thanks!