How to overwrite a task? #705
Comments
I've tried it a little bit and came to this solution: tasks("copy") {
doLast {
println("HelloWorld")
}
}
tasks.replace("copy").doLast {
println("Not Hello World")
} This will print We have to use the TaskContainer#replace since there is no extension function yet in the Kotlin DSL: I think we should add the extension functions to the ProjectExtensions class :) |
Would be good to add a sample for this |
As long as it isn't really supported it don't need a sample. Additionally
not everything needs a sample IMO.
…On Feb 4, 2018 4:25 PM, "Janek" ***@***.***> wrote:
Would be good to add a sample for this
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#705 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJwYe-N_wbCOZcgW4AFsZX5IeoN_77t_ks5tRcvVgaJpZM4R4HBq>
.
|
Closing as answered |
I don't think that it should be closed.
Better to keep it open to remind us to to add the extension function...
…On Feb 9, 2018 5:07 PM, "Paul Merlin" ***@***.***> wrote:
Closing as answered
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#705 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJwYew-ciMYC-_eE_NHZ5lrfTFhacQhuks5tTG1IgaJpZM4R4HBq>
.
|
The Gradle API provides TaskContainer#replace. // TaskContainer.java
Task replace(String name);
<T extends Task> T replace(String name, Class<T> type); There's no need for an extension on the Gradle Kotlin DSL side to make this usable. |
But as it stands now, I can't find a way to override a task within a |
Good point @Xerus2000! I opened #716 to account for the more general issue. |
Any news on this? |
I can't find any documentation or sample on how to overwrite a task.
The text was updated successfully, but these errors were encountered: