Skip to content
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

Fixes for Windows issues found in the course of updating rules_jvm_external to use Starlark Android rules #1274

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ahumesky
Copy link
Collaborator

@ahumesky ahumesky commented Feb 13, 2025

In the course of updating rules_jvm_external to use the Starlark Android rules here: bazel-contrib/rules_jvm_external#1297 a couple issues were found in rules_jvm_external's Windows tests:

  1. Use platform-specific path separators
  2. Add Kotlin standard library jars to the data of tool targets so that the Windows Java launcher can find them in the runfiles manifest

This fixes issues like this in Kotlin tools:
LAUNCHER ERROR: Rlocation failed on _main/external/rules_kotlin++rules_kotlin_extensions+com_github_jetbrains_kotlin_git/lib/annotations-13.0.jar, path doesn't exist in MANIFEST file

…vm_external#1297: 1) Use platform-specific path separators. 2) Add Kotlin standard library jars to the data of tools so that the Windows Java launcher can find them in the runfiles manifest.
@ahumesky
Copy link
Collaborator Author

The _KOTLIN_STDLIBS list is repeated in the two BUILD.bazel files, not sure what is the preferred place to centralize them

@ahumesky
Copy link
Collaborator Author

Looks like this fix breaks a bunch of other stuff -- not terribly shocking unfortunately given the nature of the changes. I'll make this a draft until this passes CI

@ahumesky
Copy link
Collaborator Author

Looks like the integration tests are failing with name 'bzl_library' is not defined (did you mean 'objc_library'?) which doesn't look related to this change at first glance

@restingbull
Copy link
Collaborator

Looks like the integration tests are failing with name 'bzl_library' is not defined (did you mean 'objc_library'?) which doesn't look related to this change at first glance

Looking...

qq: why doesn't windows get the stdlibs from runfiles?

@ahumesky
Copy link
Collaborator Author

qq: why doesn't windows get the stdlibs from runfiles?

I'm told it's because on linux, all (or at least more) inputs are added to the runfiles, and this was not done (fixed?) in the windows implementation of runfiles. I looked through bazel's code to try to find the different, but didn't get very far in the time I had

@ahumesky
Copy link
Collaborator Author

ahumesky commented Feb 14, 2025

Looks like this fix breaks a bunch of other stuff -- not terribly shocking unfortunately given the nature of the changes. I'll make this a draft until this passes CI

The breakages (at least those not in the integration tests) were due to switching from path to short_path in this PR, and this turned out to be because I was testing with Bazel 8 on my Windows machine but Bazel 7 on linux -- so this would seem to mean that, separate from all these changes, Bazel 8 and Bazel 7 are doing something different with runfiles manifests at least on windows -- but that will be a problem for another day so I've removed that change from the PR. I would expect if we start changing how runfiles manifests work, a lot of stuff would break, so I'm not sure what the story here is.

@ahumesky
Copy link
Collaborator Author

ahumesky commented Feb 14, 2025

The path vs short_path issue in Bazel 8 vs Bazel 7 appears to be bazelbuild/bazel#23574, adding --legacy_external_runfiles=true gets my fixes to rules_jvm_external (bazel-contrib/rules_jvm_external#1297) and this PR working together again on Bazel 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants