[GRADLE-1828] Document task-specific switch feature Created: 11/Oct/11  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-3
Fix Version/s: None

Type: Bug
Reporter: Blaine Simpson Assignee: Unassigned
Resolution: Won't Fix Votes: 0


 Description   

The task-specific switch syntax of Gradle is undocumented.

USAGE: gradle [option...] [task...]

That syntax message is just, as it does not allow for "gradle tasks --help". Note that there is a switch after the task name.

More important for me personally is, how do I code targets to detect and make use of these task-specific switches?



 Comments   
Comment by Adam Murdoch [ 11/Oct/11 ]

Task-specific command-line options are an internal feature for now. We will provide a public interface for them at some point in the future, probably after the Gradle 1.0 release.

Comment by Adam Murdoch [ 11/Oct/11 ]

Having said that, if you're happy to use an internal feature (which may change), you can attach a @CommandLineOption annotation to a task property setter to make that property available as a command-line option.

Currently, it only works with properties of type boolean, and only with setter methods (eg not on groovy properties).

Comment by Blaine Simpson [ 12/Oct/11 ]

I checked the Gradle source code and I see that this needs to be done in Java. No problem with the Java, as I have much more experience with Java than with Groovy, but the risk and maintenance for carrying around .class customizations isn't acceptable for my project.

I needed to override the "tasks" target for some important reasons, but I will just have to leave my current work-around in place, where I emulate gradlew tasks --all with gradlew -PallTasks=true tasks.

Thanks for the information and advice.

Comment by Blaine Simpson [ 12/Oct/11 ]

I see that Jira doesn't let me edit the Issue's Description.

I wrote the wrong switch there. The existing task-specific switch is "gradle tasks --all", not "gradle tasks --help".

Comment by Blaine Simpson [ 20/Oct/11 ]

Nothing said here contradicts that the in-program and user guide documentation is wrong where it does not allow for task-specific switches.

I think that rather than correcting the documentation and help text, you should enhance the "tasks" implementation to not require a quirky and singular syntax. It's counter-productive when trying to educate people about Gradle syntax when you also instruct them to give a command violating the stated rules. Just check for a boolean build property so that people can use the same exact functionality with advertized, public, and general Gradle usage. (Like I described with my usage of the allTasks property above).

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:05:27 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.