Introduce platform host-windows-clang-cl
#1195
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a preparation to build Mozc for Windows with clang-cl (#1179).
Now that Windows Bazel builds rely on CC toolchain resolution (#1112),
clang-cl
needs to be picked up based onplatform
specified to Bazel. This gives us an inverse problem what needs to be passed to Bazel so that such a resolution can happen.The simplest solution as far as I have figures out is doing the following two steps.
Specify
--host_platform=//:host-windows-clang-cl
, where it is defined as follows.By doing this,
@bazel_tools//tools/cpp:clang-cl
can be propagated into each execution platform, which is mandatory forclang-cl
to be picked up.Specify
--extra_toolchains
command line options to put the following toolchains fromrules_cc
in higher priority than cl.exe.@local_config_cc//:cc-toolchain-x64_x86_windows-clang-cl
@local_config_cc//:cc-toolchain-x64_windows-clang-cl
This is important because CC toolchain resolution picks up the first toolchain that satisfies all the constraints. To give a higher priority to
clang-cl
toolchains, they need to be registered before 'cl' toolchains are registered.Note that
in
MODULE.bazel
registers toolchains in the alphabetical order. To give a higher priority toclang-cl
toolchains,--extra_toolchains
command line looks to be the best way.What this commit does is the step 1. Without the step 2, there must be no observable behavior change yet.
Issue IDs
clang-cl
to build Mozc for Windows with Bazel #1179Steps to test new behaviors (if any)