-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
8218685: jlink --list-plugins needs to be readable and tidy #305
Conversation
👋 Welcome back igraves! A progress list of the required criteria for merging this PR into |
@igraves The following label will be automatically applied to this pull request: When this pull request is ready to be reviewed, an RFR email will be sent to the corresponding mailing list. If you would like to change these labels, use the |
Webrevs
|
The output looks much better. Have you considered to sort them in alphabetical order of the plugin name? |
Yes! I had intended to but it looks like I got hung up making sure non-documented plugins came last. Will push a change for this. |
Can we put a base abstract class in jdk.tools.jlink.internal.plugins that implements getUsage. That would avoid needing to have the same getUsage method in all the plugins. The text in the value of some of the .usage keys looks like it will wrap significantly, can the values of release-info.usage and strip-native-debug-symbols.usage be re-formatted so that the usage is readable with a default terminal? |
I'll shrink narrow those descriptions down to 80 characters. As to the abstract class, I think it'd make sense to have that implement getUsage, getName, and getDescription -- essentially combine all of those very similar things in the same place. |
Updated to consolidate documentation/resource-related methods into an abstract base class and shortened the mentioned usage bodies to 80 chars or less. |
AbstractPlugin might be a better name for the abstract class as it will likely define methods beyond access to name, description and usage. It also needs a copyright header. |
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.
I suggest to update the PR description with the new jlink --show-plugins
output.
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
import java.util.*; |
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.
I assume this change is unintentional. Probably IDE converted the single-class imports to this.
|
||
import jdk.tools.jlink.plugin.Plugin; | ||
|
||
public abstract class DocumentedPlugin implements Plugin { |
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.
I agree with Alan that AbstractPlugin
is better.
This should also provide the default implementation of getArgumentsDescription()
such that the plugins don't need to implement.
|
||
public abstract class DocumentedPlugin implements Plugin { | ||
|
||
private final String NAME; |
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.
Nit: use lowercase for final instance field name.
@@ -46,23 +46,19 @@ | |||
* | |||
* Order Resources plugin | |||
*/ | |||
public final class OrderResourcesPlugin implements Plugin { | |||
public final class OrderResourcesPlugin extends DocumentedPlugin { | |||
public static final String NAME = "order-resources"; |
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.
This is not related to your change. It can be private static final field. In my past observation, this static final NAME field is defined in every plugin which isn't really a need for it (at least in the current implementation). It might be good to consider the clean up to remove this static final field and instead call getName()
to get the name. Just a thought.
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.
Looks good to me. It may be useful to have a regression test to verify the plugin order of the output if possible.
@igraves This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for more details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 109 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@mlchung, @AlanBateman) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
The new AbstractPlugin and each of the implementations extending it look good. The new usages messages look good too. A few minor formatting nits in a few places but otherwise I think good to go. |
@AlanBateman Unknown command |
Updated JLinkTest to assert alphabetical order. With that I will /integrate . |
/integrate |
/sponsor |
@mlchung @igraves Since your change was applied there have been 109 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 8df3e72. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
These changes update the jlink plugin command line documentation to tidy them up into a more canonical form.
The output generated by jlink from this change appears as follows:
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/305/head:pull/305
$ git checkout pull/305