tony
07/30/2026, 5:44 PM@Option to a task? My use-case is in an Android project. It has tasks like testDebugUnitTest and testReleaseUnitTest, as well as a lifecycle task test that depends on each of those two variant-specific Test tasks.
I would love to add a --tests option to this preexisting (from another plugin, I do not control it) test lifecycle task.
I've tried this, but it doesn't work:
project.tasks.named { it == "test" }.configureEach {
inputs
.property("tests", "") // passing no value as a test
.optional(true)
}
I still get > Unknown command-line option '--tests'.tony
07/30/2026, 6:37 PMephemient
07/31/2026, 8:33 AMtony
07/31/2026, 5:04 PMBenedikt Ritter
08/01/2026, 7:59 PMBenedikt Ritter
08/01/2026, 7:59 PM@Option. It only works if the task defining the option is the one you requested.Benedikt Ritter
08/01/2026, 8:01 PMTest used to have some magic to make it possible to just pass --test and it would figure out the right thing to do. But since recently you will get failures saying the filter didn't match any tests which is a huge usability problem IMHO.tony
08/01/2026, 8:31 PMtask.setTestNameIncludePatterns(/* value from extra properties */). Maybe too clever? It works thoughBenedikt Ritter
08/02/2026, 6:15 PMtony
08/02/2026, 6:25 PM--tests case, which is why I thought it interesting enough to wrap up in a plugin
https://github.com/autonomousapps/dedebug