[GRADLE-2972] "--tests" doesn't work from the Tooling API Created: 05/Dec/13 Updated: 15/Feb/14 Resolved: 15/Feb/14 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 1.10-rc-1 |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Benjamin Muschko | Assignee: | Szczepan Faber |
Resolution: | Not A Bug | Votes: | 0 |
Description |
Reported on the Gradle Forum: When using ProjectConnection.newBuild() and passing withArguments "--tests" and "mypackage.testMethod" the task execution fails with a no such command option exception. It works perfectly fine from the command line. When I tried it from NetBeans, it failed however. Of course, I have verified that I use the appropriate Gradle version (it is simple to verify, since the version is included in the exception message). |
Comments |
Comment by Szczepan Faber [ 15/Feb/14 ] |
--tests flag works in the tooling api this way: withArguments('test', '--tests', 'FooTest.passes') It's not possible to use the flag with the 'buildLauncher.forTasks' api at the moment. Down the road we will add support for this. It will be a part of Tooling api improvements: modeling the task command line options explicitly. |
Comment by Attila Kelemen [ 15/Feb/14 ] |
Thank you, I have implemented a workaround (i.e., not call forTasks but pass the tasks to withArguments as well). Is it only for "--tests" or for something else as well? That is, what are the options needing this workaround? (e.g., "--init-script" works fine with forTasks). |
Comment by Szczepan Faber [ 15/Feb/14 ] |
All 'task options' require this. 'init-script' is not a task option but a build invocation option. That's why it works ok with forTasks. Perhaps you can always use the withArguments (even for tasks) instead of forTasks. Hope that helps! |
Comment by Attila Kelemen [ 15/Feb/14 ] |
Yes it does, it is good to know that there are these distinct groups of options. To be on the safe side, I'll keep using forTasks (except for "--tests") for now and will reconsider things when there are people in need for other "task options". |