-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add summaries and groups to Gradle tasks #190
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,38 @@ | ||||||||||||||||||
/** | ||||||||||||||||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. | ||||||||||||||||||
* | ||||||||||||||||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||
* you may not use this file except in compliance with the License. | ||||||||||||||||||
* You may obtain a copy of the License at | ||||||||||||||||||
* | ||||||||||||||||||
* https://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||
* | ||||||||||||||||||
* Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||
* distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||
* See the License for the specific language governing permissions and | ||||||||||||||||||
* limitations under the License. | ||||||||||||||||||
*/ | ||||||||||||||||||
package org.pkl.gradle; | ||||||||||||||||||
|
||||||||||||||||||
/** Constant values used by tasks */ | ||||||||||||||||||
class TaskConstants { | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it is more conventional to put these constants directly to the plugin class. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||||||||||||||||||
private TaskConstants() { | ||||||||||||||||||
/* no construction */ | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
/** Gradle task group declared for code-gen tasks. */ | ||||||||||||||||||
static final String TASK_GROUP_CODEGEN = "Code generation"; | ||||||||||||||||||
|
||||||||||||||||||
/** Gradle task group declared for documentation tasks. */ | ||||||||||||||||||
static final String TASK_GROUP_DOCS = "Documentation"; | ||||||||||||||||||
Comment on lines
+25
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like these group names are generally lowercase single words.
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
/** Gradle task description for generating Java code from Pkl modules. */ | ||||||||||||||||||
static final String GENERATE_JAVA_DESCRIPTION = "Generate Java code from Pkl modules"; | ||||||||||||||||||
|
||||||||||||||||||
/** Gradle task description for generating Kotlin code from Pkl modules. */ | ||||||||||||||||||
static final String GENERATE_KOTLIN_DESCRIPTION = "Generate Kotlin code from Pkl modules"; | ||||||||||||||||||
|
||||||||||||||||||
/** Gradle task description for generating Pkldoc from Pkl modules. */ | ||||||||||||||||||
static final String GENERATE_PKLDOC_DESCRIPTION = "Generate Pkldoc from Pkl modules"; | ||||||||||||||||||
Comment on lines
+24
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Task constants that will show in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||||||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, this is how I'm configuring
description
andgroup
on these tasks.