-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8303485: Replacing os.name for operating system customization #12931
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
Conversation
Improvements should support OS specific customization for JDK internal use: - To select values and code; allowing elimination of unused code and values - Optionally evaluated by build processes, compilation, or archiving (i.e. CDS) - Simple API to replace adhoc comparisons with `os.name` - Clear and consistent use across build, runtime, and JDK modules
👋 Welcome back rriggs! A progress list of the required criteria for merging this PR into |
@RogerRiggs The following labels 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 lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
src/java.base/share/classes/jdk/internal/misc/OperatingSystem.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/jdk/internal/misc/OperatingSystemProps.java.template
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/jdk/internal/misc/OperatingSystemProps.java.template
Outdated
Show resolved
Hide resolved
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 wonder if jdk.internal.platform
would be a better home for OperatingSystem
class?
src/java.base/share/classes/jdk/internal/misc/OperatingSystemProps.java.template
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/jdk/internal/misc/OperatingSystem.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/jdk/internal/misc/OperatingSystem.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/jdk/internal/misc/OperatingSystemProps.java.template
Outdated
Show resolved
Hide resolved
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. Some minor nits follow.
src/java.base/share/classes/jdk/internal/util/StaticProperty.java
Outdated
Show resolved
Hide resolved
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 guess I'm surprised this hasn't been done long before now. :)
Just a couple of drive by comments (I agree with comments made by others).
Has this totally killed of BSD support on the JDK side? I thought building non-macOS BSD was still viable, but perhaps not - certainly not after this change.
Thanks
src/java.base/share/classes/jdk/internal/misc/OperatingSystem.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/jdk/internal/misc/OperatingSystem.java
Outdated
Show resolved
Hide resolved
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.
Build changes look good.
@RogerRiggs 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 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 230 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. ➡️ To integrate this PR with the above commit message to the |
I haven't found any use of BSD and I don't think the build supports a BSD build. |
Mailing list message from Justin King on build-dev: Let's please not kill generic BSD support if at all possible. There is On Wed, Mar 8, 2023, 6:54 PM David Holmes <dholmes at openjdk.org> wrote: -------------- next part -------------- |
Mailing list message from Roger Riggs on build-dev: Hi Justin, How would I go about building one of those? Or knowing what the Thanks, Roger On 3/8/23 11:02 PM, Justin King wrote: |
jdk.internal.platform seems to be focused on information about container environments such as Docker. jdk.internal.misc already contains other classes that are shared out of java.base to other modules. |
To see the knock-on effects of using the API in other modules, see the Draft PR #12961 |
It looks like FreeBSD and NetBSD have their own separate ports. They fork the OpenJDK repos and then add changes on-top to make it work for BSD. That is kind of disappointing...one more thing for them to patch I suppose. I wonder how big the diff is...it looks like github.com/battleblow/jdk19u is what FreeBSD uses. |
The macOS port in 7u4 was based on a BSD port and there was a time when it was possible to build. Right now, we have src/hotspot/os/bsd and native code in the libs that is compiled in with _ALLBSD_SOURCE. It's sad to see the BSD port bit rot but if it's not maintained or tested in the OpenJDK project then the changes proposed here may be okay. For porters, they need to know which code needs to be ported is important, ideally there would be a compile or build time if something significant is missing. |
src/java.base/share/classes/jdk/internal/misc/OperatingSystem.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/jdk/internal/misc/OperatingSystem.java
Outdated
Show resolved
Hide resolved
Yes it is unfortunate. It would be nice if NetBSD, FreeBSD, OpenBSD, and friends would collaborate. I think the majority of their changes are fixing build issues and making AWT/Swing use X11 instead of macOS-specific stuff (Quartz or Cocoa or whatever). Maybe I'll go poke them eventually. |
Rename Mac -> MacOS; isMac() -> isMacOS()
I bet @battleblow has tried, but that wasn't fruitful with the OpenJDK team. |
This looks wrong because it would leave out a lot of ports which this solution cannot cover. Rephrased: An exhaustive list of values to an non-exhaustive amount of systems just feels wrong. |
Please review the revisions. |
src/java.base/share/classes/jdk/internal/util/OperatingSystem.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/jdk/internal/util/OperatingSystem.java
Outdated
Show resolved
Hide resolved
@battleblow FYI |
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.
LGTM
Mailing list message from David Holmes on core-libs-dev: On 25/03/2023 3:06 am, Roger Riggs wrote:
Also: https://www.oracle.com/au/linux/ David |
* {@return the default or requested launch mechanism} | ||
* @throws Error if the requested launch mechanism is not found or valid | ||
*/ | ||
@SuppressWarnings("removal") |
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.
So, we can remove it
@SuppressWarnings("removal") |
/integrate |
Going to push as commit 6c3b10f.
Your commit was automatically rebased without conflicts. |
@RogerRiggs Pushed as commit 6c3b10f. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Improvements to support OS specific customization for JDK internal use:
os.name
The PR includes updates within java.base to use the new API.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/12931/head:pull/12931
$ git checkout pull/12931
Update a local copy of the PR:
$ git checkout pull/12931
$ git pull https://git.openjdk.org/jdk.git pull/12931/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12931
View PR using the GUI difftool:
$ git pr show -t 12931
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12931.diff