[Bazel] Replace the use of @bazel_tools//src/conditions:host_windows#1683
[Bazel] Replace the use of @bazel_tools//src/conditions:host_windows#1683stevenlr wants to merge 1 commit intoemscripten-core:mainfrom
Conversation
This has been deprecated and will be removed in Bazel 10. This implementation of the platform information retrieval is similar to what is done in Skylib (see https://github.com/bazelbuild/bazel-skylib/blob/56a2abbaf131332835ab2721a258ea3c763a7178/rules/private/copy_file_private.bzl#L117) however this does not use the experimental platform API. - We define a provider that gives the script extension for a given platform and a rule to instantiate it. - We define a target with the `platform_info` rule that selects the correct settings based on constraints from `@platform`. - During toolchain config creation we inject that target **using the `exec` config**. - We can then retrieve the platform information in the toolchain config (namely the script extension here). Note that the platform information could have given a simple `is_windows` flag, but I chose this implementation because it matches the previous one more closely. Note also that it was not possible to keep the `script_extension` attribute as string, because the `cfg` field is not supported on string attributes.
sbc100
left a comment
There was a problem hiding this comment.
I wonder if we could somehow depend on bash on windows (it comes with git for example) and just delete the bat files?
|
Both Bazel and its ecosystem have been moving away from depending on Bash on Windows. So it's not really recommended. I've seen the discussion on a previous PR about using A simpler approach could be to use the Python interpreter as the tool for each cc toolchain action, and the first argument would be the script (emar.py, emcc.py, etc). That way we could remove the wrapper scripts but still keep all Bazel stuff in this repo. I could take a swing at it this week-end or early next week, see where it leads, but it's a separate topic anyway. |
|
Hi, I've been trying to remove the need for the batch and bash files, however I don't think it's doable. It seems like Emscripten expects the |
This is a followup of #1682.
This has been deprecated and will be removed in Bazel 10.
This implementation of the platform information retrieval is similar to what is done in Skylib (see https://github.com/bazelbuild/bazel-skylib/blob/56a2abbaf131332835ab2721a258ea3c763a7178/rules/private/copy_file_private.bzl#L117) however this does not use the experimental platform API.
platform_inforule that selects the correct settings based on constraints from@platform.execconfig.Note that the platform information could have given a simple
is_windowsflag, but I chose this implementation because it matches the previous one more closely.Note also that it was not possible to keep the
script_extensionattribute as string, because thecfgfield is not supported on string attributes.