Skip to content

fix: add execution platforms to more analysis tests #2869

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fmeum
Copy link
Member

@fmeum fmeum commented May 9, 2025

Work towards #2850

@fmeum
Copy link
Member Author

fmeum commented May 9, 2025

@rickeylev @aignas I need help here. I am registering the test target platform as an execution platform to ensure compatibility with the new test toolchain, but that runs into an issue I'm planning to resolve in the future by bazelbuild/bazel#26019: every py_executable has an exec dependency on a C++ toolchain through launcher_maker.

In this particular case, I could work around this by transitioning to the host platform rather than the fixed platform LINUX_X86_64. Would that be acceptable?

@rickeylev
Copy link
Collaborator

The launcher_maker is only needed for windows, so that dependency shouldn't be occurring for linux et al. I see it's refering to @bazel_tools//tools/launcher:launcher_maker directly, though. IIRC, bazel_tools has a select() to point that to something no-op. So it shouldn't still be requiring a C++ toolchain?

Would it help if we changed py_executable to point to an alias with select()?

alias(
    name = "launcher_maker",
    actual = select({
        "@platforms//os:windows": "@bazel_tools/tools/launcher:launcher_maker",
        "//conditions:default": "//python:none",
    })

py_executable has an optional dependency on the cc toolchain regardless, but I'm assuming that's OK.

@fmeum
Copy link
Member Author

fmeum commented May 9, 2025

Yes, it's only needed for Windows, but with the current setup within Bazel, every OS pays the price (the exec dep on a C++ toolchain).

The selects (both the one that exists in Bazel and the one you suggest) apply after the exec transition and thus can't distinguish between a build that targets Windows and a build that doesn't. That's why I'm planning to introduce a toolchain for the launcher maker, which can match on both exec and target platform simultaneously.

However, this will require Bazel feature detection or a new BCR module for the launcher maker, so it won't help here (at least not soon).

@rickeylev
Copy link
Collaborator

I think I follow, I think 🙃

Transitioning to the host platform is probably ok.

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