-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 "arch" struct field to repository_os #14738
Conversation
2dfd610
to
ad23665
Compare
This new field provides access to the Java "os.arch" property to repository rules, which previously had to rely on uname (Unix) or additional env variables (Windows) to detect the architecture. This also fixes a small issue in the existing implementation of repository_ctx.os.name, which should use the root locale when converting the value of the "os.name" property to lowercase. Existing sites of manual architecture detection in shipped repository rules as well as redundant calls to lower() on the value of repository_ctx.os.name are cleaned up.
ad23665
to
b45298b
Compare
Looks great, thank you! Any more changes planned before you un-draft this? |
@Wyverald The implementation is complete, I'm just not sure whether it does the right thing: As discussed in #14685, |
Ah, I see. It seems fine to me to use |
Nice, thanks for adding this! @katre With this change, we probably can starlarkify https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/bazel/repository/LocalConfigPlatformFunction.java ? (Although the exact logic of getting OS and CPU is a bit different that just checking |
@meteorcloudy Marked as ready, thanks for the review. |
@meteorcloudy Yes, we could possibly use this to rewrite LocalConfigPlatformFunction, although it's at such a low level in the hierarchy of dependencies I'd be very worried about correctness and performance. |
This new field provides access to the Java "os.arch" property to repository rules, which previously had to rely on uname (Unix) or additional env variables (Windows) to detect the architecture. This also fixes a small issue in the existing implementation of repository_ctx.os.name, which should use the root locale when converting the value of the "os.name" property to lowercase. Existing sites of manual architecture detection in shipped repository rules as well as redundant calls to lower() on the value of repository_ctx.os.name are cleaned up. Fixes bazelbuild#14685 Closes bazelbuild#14738. PiperOrigin-RevId: 427147225 (cherry picked from commit 32d1606)
This new field provides access to the Java "os.arch" property to repository rules, which previously had to rely on uname (Unix) or additional env variables (Windows) to detect the architecture. This also fixes a small issue in the existing implementation of repository_ctx.os.name, which should use the root locale when converting the value of the "os.name" property to lowercase. Existing sites of manual architecture detection in shipped repository rules as well as redundant calls to lower() on the value of repository_ctx.os.name are cleaned up. Fixes #14685 Closes #14738. PiperOrigin-RevId: 427147225 (cherry picked from commit 32d1606) Co-authored-by: Fabian Meumertzheim <[email protected]>
This new field provides access to the Java "os.arch" property to
repository rules, which previously had to rely on uname (Unix) or
additional env variables (Windows) to detect the architecture.
This also fixes a small issue in the existing implementation of
repository_ctx.os.name, which should use the root locale when converting
the value of the "os.name" property to lowercase.
Existing sites of manual architecture detection in shipped repository
rules as well as redundant calls to lower() on the value of
repository_ctx.os.name are cleaned up.
Fixes #14685