aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Mauro <dmauro@google.com>2024-01-29 15:04:23 -0800
committerCopybara-Service <copybara-worker@google.com>2024-01-29 15:05:26 -0800
commit04af270f6d3a0e647946663764a5f869c104af8f (patch)
tree956208ba9cd36ce7f15c6ac3755c0ed23c8a7ff5
parentd5eb503257f23d41f3e67933ffd85fb989141acb (diff)
downloadabseil-04af270f6d3a0e647946663764a5f869c104af8f.tar.gz
abseil-04af270f6d3a0e647946663764a5f869c104af8f.tar.bz2
abseil-04af270f6d3a0e647946663764a5f869c104af8f.zip
Add empty WORKSPACE.bzlmod
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
-rw-r--r--BUILD.bazel12
-rw-r--r--MODULE.bazel3
-rw-r--r--WORKSPACE.bzlmod19
-rw-r--r--absl/BUILD.bazel11
-rwxr-xr-xci/windows_clangcl_bazel.bat2
5 files changed, 34 insertions, 13 deletions
diff --git a/BUILD.bazel b/BUILD.bazel
index 79fb0ecd..03122a95 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -1,4 +1,3 @@
-#
# Copyright 2020 The Abseil Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -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",
+ ],
+)
diff --git a/MODULE.bazel b/MODULE.bazel
index 18190e8e..fc1534a7 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -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.
diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod
new file mode 100644
index 00000000..83e67baa
--- /dev/null
+++ b/WORKSPACE.bzlmod
@@ -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.
diff --git a/absl/BUILD.bazel b/absl/BUILD.bazel
index 14c30b38..253c0aef 100644
--- a/absl/BUILD.bazel
+++ b/absl/BUILD.bazel
@@ -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 = [
diff --git a/ci/windows_clangcl_bazel.bat b/ci/windows_clangcl_bazel.bat
index 5162628b..ac2f9167 100755
--- a/ci/windows_clangcl_bazel.bat
+++ b/ci/windows_clangcl_bazel.bat
@@ -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" ^