Gradle

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
To raise new issues or bugs against Gradle, please use forums.gradle.org.
  • Gradle
  • GRADLE-1828

Document task-specific switch feature

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Resolution: Unresolved
  • Affects Version/s: 1.0-milestone-3
  • Fix Version/s: None

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?

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
  • TeamCity
  • Commits
  • Source
  • Reviews
Hide
Permalink
Adam Murdoch added a comment - 11/Oct/11 10:09 PM

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.

Show
Adam Murdoch added a comment - 11/Oct/11 10:09 PM 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.
Hide
Permalink
Adam Murdoch added a comment - 11/Oct/11 10:53 PM

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).

Show
Adam Murdoch added a comment - 11/Oct/11 10:53 PM 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).
Hide
Permalink
Blaine Simpson added a comment - 12/Oct/11 11:00 AM - edited

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.

Show
Blaine Simpson added a comment - 12/Oct/11 11:00 AM - edited 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.
Hide
Permalink
Blaine Simpson added a comment - 12/Oct/11 6:42 PM

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".

Show
Blaine Simpson added a comment - 12/Oct/11 6:42 PM 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".
Hide
Permalink
Blaine Simpson added a comment - 20/Oct/11 10:36 AM

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).

Show
Blaine Simpson added a comment - 20/Oct/11 10:36 AM 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).

People

  • Assignee:
    Unassigned
    Reporter:
    Blaine Simpson
Vote (0)
Watch (0)

Dates

  • Created:
    11/Oct/11 8:00 PM
    Updated:
    20/Oct/11 10:36 AM
  • Atlassian JIRA (v5.0.3#729-sha1:bf569e4)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Gradle. Try JIRA - bug tracking software for your team.