Skip to content

[Bazel] Replace uses of deprecated bazel_tools things#1682

Merged
sbc100 merged 1 commit intoemscripten-core:mainfrom
stevenlr:bazel_use_rules_cc
Mar 24, 2026
Merged

[Bazel] Replace uses of deprecated bazel_tools things#1682
sbc100 merged 1 commit intoemscripten-core:mainfrom
stevenlr:bazel_use_rules_cc

Conversation

@stevenlr
Copy link
Contributor

@stevenlr stevenlr commented Feb 26, 2026

Using the C++ rules, libraries and utilities from bazel_tools is being deprecated in favor of using rules_cc.

Similarly the @bazel_tools//src/conditions:host_windows constraint has been deprecated for a while and will be removed with Bazel 10.

@stevenlr stevenlr force-pushed the bazel_use_rules_cc branch 2 times, most recently from a2e4fcb to 1ac99d2 Compare February 26, 2026 20:58
@stevenlr
Copy link
Contributor Author

stevenlr commented Mar 1, 2026

I believe the test failure here was just a flake, it seems the download of a Baze module failed somehow.

All C++ infrastructure should come from @rules_cc now.
auto-merge was automatically disabled March 24, 2026 09:27

Head branch was pushed to by a user without write access

@stevenlr stevenlr force-pushed the bazel_use_rules_cc branch from 1ac99d2 to 590fbad Compare March 24, 2026 09:27
sbc100 pushed a commit that referenced this pull request Mar 24, 2026
…1683)

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.

- 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 sbc100 requested review from DoDoENT and mmorel-35 March 24, 2026 14:30
@sbc100 sbc100 merged commit 6d0ed4b into emscripten-core:main Mar 24, 2026
9 checks passed
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.

3 participants