-
Notifications
You must be signed in to change notification settings - Fork 611
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
[all java] Add Java module support #7424
base: main
Are you sure you want to change the base?
Conversation
This PR modifies commands. Please open a corresponding PR in Python Commands and include a link to this PR. |
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
module wpilib.commands2 { |
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.
Open discussion: wpilib.commands
or wpilib.commands2
? The module names already differ from the package names.
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.
commands2
makes sense if we plan on making a commands3
, unless there's some way to version it separately. If we can use vendordep versioning and prevent users from installing two versions at once, we could just use commands
.
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.
commands2
makes the most sense. We'll have a commands3 in 2027, and each version is essentially a completely different library so reusing the same module name wouldn't be practical (or likely even possible)
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.
That argument doesn't make sense to me. WPILib 2008 and 2024 look completely different, yet we still call it wpilibj. Major version numbers exist to represent things like major API refactors, so we should be using the major version for that instead of the library name itself.
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.
Because wpilib was changed gradually over time, without multiple incompatible versions concurrently being available for use. Commands v3 will probably be available side by side with v2 during a transition period
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.
That's the case for most libraries though, and they don't name their libraries like that. Giving them different names would allow users to use them both simultaneously, which we should explicitly disallow. Allowing that for v1 and v2 was a mistake due to the package naming confusion that introduced.
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.
An advantage of the numbered naming was that it made it very clear if classes were from v1 or v2.
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.
It’s actually quite common in Java to have versions in package names, sometimes as a subpackage name (eg commands.v1, commands.v2). The common recommendation however is to not put the version in the class name.
Resolves #7236
Non-modular Java dependencies (ejml, opencv) need a gradle plugin to add a module-info file to the JAR. I'm not sure if this is the correct approach, since those JARs won't be repacked and published for user programs to consume. Will need to test the artifacts to see if user programs will be broken