Skip to content

_maybe_wrap_launcher_for_windows selects wrapper based on target platform #420

@malt3

Description

@malt3

_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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneed: discussionNeeds a proper discussion around the problem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions