Skip to content

Commit

Permalink
Add empty WORKSPACE.bzlmod
Browse files Browse the repository at this point in the history
When bzlmod is enabled and WORKSPACE.bzlmod exists, the content of
WORKSPACE is ignored. This prevents bzlmod builds from unintentionally
depending on the WORKSPACE file.

This exposed some small problems with our clang-cl configuration,
which are also fixed in this change.

PiperOrigin-RevId: 602511311
Change-Id: I0ba411edde2df0e17f4eeede4117ddb6934dd8f8
  • Loading branch information
derekmauro authored and copybara-github committed Jan 29, 2024
1 parent d5eb503 commit 04af270
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 13 deletions.
12 changes: 11 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#
# Copyright 2020 The Abseil Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -23,3 +22,14 @@ exports_files([
"AUTHORS",
"LICENSE",
])

# For building with clang-cl.
# https://bazel.build/configure/windows#clang
platform(
name = "x64_windows-clang-cl",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
"@bazel_tools//tools/cpp:clang-cl",
],
)
3 changes: 3 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ module(
compatibility_level = 1,
)

cc_configure = use_extension("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_configure_extension")
use_repo(cc_configure, "local_config_cc")

# Only direct dependencies need to be listed below.
# Please keep the versions in sync with the versions in the WORKSPACE file.

Expand Down
19 changes: 19 additions & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 The Abseil Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# https://bazel.build/external/migration#workspace.bzlmod
#
# This file is intentionally empty. When bzlmod is enabled and this
# file exists, the contents of WORKSPACE is ignored. This prevents
# bzlmod builds from unintentionally depending on the WORKSPACE file.
11 changes: 0 additions & 11 deletions absl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,6 @@ config_setting(
visibility = [":__subpackages__"],
)

# x64_windows-clang-cl - used for selecting clang-cl for CI builds
platform(
name = "x64_windows-clang-cl",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
"@bazel_tools//tools/cpp:clang-cl",
],
visibility = [":__subpackages__"],
)

config_setting(
name = "osx",
constraint_values = [
Expand Down
2 changes: 1 addition & 1 deletion ci/windows_clangcl_bazel.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ IF NOT "%ALTERNATE_OPTIONS%"=="" copy %ALTERNATE_OPTIONS% absl\base\options.h
--define=absl=1 ^
--distdir=%KOKORO_GFILE_DIR%\distdir ^
--enable_bzlmod=true ^
--extra_execution_platforms=//absl:x64_windows-clang-cl ^
--extra_execution_platforms=//:x64_windows-clang-cl ^
--extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl ^
--keep_going ^
--test_env="GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1" ^
Expand Down

0 comments on commit 04af270

Please sign in to comment.