Add summaries and groups to Gradle tasks#190
Conversation
There was a problem hiding this comment.
In general, this is how I'm configuring description and group on these tasks.
There was a problem hiding this comment.
Task constants that will show in ./gradlew tasks for a project with the Pkl Gradle Plugin added.
There was a problem hiding this comment.
FWIW, I think that if these strings are not reused anywhere, it might make sense to inline them to the specific task definitions within the plugin code. But I don't have a strong opinion on this.
Fixes and closes apple#188 by adding task names and groups to major Pkl Gradle Plugin tasks Signed-off-by: Sam Gammon <sam@elide.ventures>
5d4fe9f to
4f6ebfe
Compare
| package org.pkl.gradle; | ||
|
|
||
| /** Constant values used by tasks */ | ||
| class TaskConstants { |
There was a problem hiding this comment.
I believe it is more conventional to put these constants directly to the plugin class.
There was a problem hiding this comment.
What about the category settings, which must be shared between plugins? I think there may be symbols for those somewhere in Gradle's API. I'll look for appropriate ones to use.
There was a problem hiding this comment.
There's LifecycleBasePlugin which provides the base task names and groups.
Then there's JvmConstants, but this seems less appropriate for us.
I think it's fine to just have these as strings, though.
There was a problem hiding this comment.
There is only one plugin in the project, so there is nothing to share, or an I missing something?
Anyway, if you look at the built-in Gradle plugins, they always contain constants related to tasks configured by these plugins within the plugin class. If we ever decide to make new plugins, we can move these constants to the appropriate location at that time.
| static final String TASK_GROUP_CODEGEN = "Code generation"; | ||
|
|
||
| /** Gradle task group declared for documentation tasks. */ | ||
| static final String TASK_GROUP_DOCS = "Documentation"; |
There was a problem hiding this comment.
Seems like these group names are generally lowercase single words.
| static final String TASK_GROUP_CODEGEN = "Code generation"; | |
| /** Gradle task group declared for documentation tasks. */ | |
| static final String TASK_GROUP_DOCS = "Documentation"; | |
| static final String TASK_GROUP_CODEGEN = "codegen"; | |
| /** Gradle task group declared for documentation tasks. */ | |
| static final String TASK_GROUP_DOCS = "documentation"; |
| package org.pkl.gradle; | ||
|
|
||
| /** Constant values used by tasks */ | ||
| class TaskConstants { |
There was a problem hiding this comment.
There's LifecycleBasePlugin which provides the base task names and groups.
Then there's JvmConstants, but this seems less appropriate for us.
I think it's fine to just have these as strings, though.
Fixes and closes #188 by adding task names and groups to major Pkl Gradle Plugin tasks. I would love advice from library authors that these are the right tasks to expose to users.