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

_maybe_wrap_launcher_for_windows selects wrapper based on target platform #420

Open
malt3 opened this issue Nov 20, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@malt3
Copy link
Contributor

malt3 commented Nov 20, 2023

_maybe_wrap_launcher_for_windows selects wrapper based on target platform.

By using ctx.target_platform_has_constraint(ctx.attr._windows_constraint[platform_common.ConstraintValueInfo]), the bat wrapper is added when targeting windows and not when executing actions on Windows.
This breaks in two cases:

  • When cross compiling on Windows, the wrapper is not added (since the target platform is linux)
  • When targeting windows on Linux (with transitions), the bat wrapper is added and fails

I feel like this should use a different mechanism to select the correct wrapper based on the execution platform.

EDIT: I'm not sure if I understand all of the nuance here but I think we could either add an attribute to rules:

_is_windows = select({
        "@bazel_tools//src/conditions:host_windows": True,
        "//conditions:default": False,
}),

... or do the wrapping as part of a toolchain. What do you think?

@alexeagle
Copy link
Collaborator

Ugh, yeah. This is an old thread, I recall having misgivings about it in earlier PRs.

bazel-contrib/bazel-lib#95
-> aspect-build/rules_js#986

FYI @gregmagolan

@thesayyn
Copy link
Collaborator

@alexeagle i created bazel-contrib/bazel-lib#702 which ought to solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants