diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | MODULE.bazel | 39 | ||||
-rw-r--r-- | WORKSPACE | 38 | ||||
-rw-r--r-- | ci/cmake_common.sh | 6 | ||||
-rwxr-xr-x | ci/linux_arm_clang-latest_libcxx_bazel.sh | 2 | ||||
-rwxr-xr-x | ci/linux_clang-latest_libcxx_asan_bazel.sh | 2 | ||||
-rwxr-xr-x | ci/linux_clang-latest_libcxx_bazel.sh | 2 | ||||
-rwxr-xr-x | ci/linux_clang-latest_libcxx_tsan_bazel.sh | 2 | ||||
-rwxr-xr-x | ci/linux_clang-latest_libstdcxx_bazel.sh | 2 | ||||
-rwxr-xr-x | ci/linux_gcc-floor_libstdcxx_bazel.sh | 3 | ||||
-rwxr-xr-x | ci/linux_gcc-latest_libstdcxx_bazel.sh | 2 | ||||
-rwxr-xr-x | ci/macos_xcode_bazel.sh | 2 | ||||
-rwxr-xr-x | ci/windows_clangcl_bazel.bat | 2 | ||||
-rwxr-xr-x | ci/windows_msvc_bazel.bat | 2 | ||||
-rwxr-xr-x | ci/windows_msvc_cmake.bat | 8 | ||||
-rwxr-xr-x | create_lts.py | 5 |
16 files changed, 88 insertions, 31 deletions
@@ -1,3 +1,5 @@ +# Bzlmod lockfile +MODULE.bazel.lock # Ignore all bazel-* symlinks. /bazel-* # Ignore Bazel verbose explanations diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..18190e8e --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,39 @@ +# 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/overview#bzlmod + +module( + name = "abseil-cpp", + version = "head", + compatibility_level = 1, +) + +# Only direct dependencies need to be listed below. +# Please keep the versions in sync with the versions in the WORKSPACE file. + +bazel_dep(name = "bazel_skylib", + version = "1.5.0") + +bazel_dep(name = "google_benchmark", + version = "1.8.3", + repo_name = "com_github_google_benchmark", + dev_dependency = True) + +bazel_dep(name = "googletest", + version = "1.14.0.bcr.1", + repo_name = "com_google_googletest") + +bazel_dep(name = "platforms", + version = "0.0.8") @@ -20,42 +20,40 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # GoogleTest/GoogleMock framework. Used by most unit-tests. http_archive( - name = "com_google_googletest", # 2023-10-05T21:13:04Z - sha256 = "ba96972e0aa8a1428596570ac573958c1c879483bd148a2b72994453f9dfa7c2", - strip_prefix = "googletest-2dd1c131950043a8ad5ab0d2dda0e0970596586a", + name = "com_google_googletest", + sha256 = "8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7", + strip_prefix = "googletest-1.14.0", # Keep this URL in sync with ABSL_GOOGLETEST_COMMIT in ci/cmake_common.sh and # ci/windows_msvc_cmake.bat. - urls = ["https://github.com/google/googletest/archive/2dd1c131950043a8ad5ab0d2dda0e0970596586a.zip"], + urls = ["https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz"], ) # RE2 (the regular expression library used by GoogleTest) http_archive( - name = "com_googlesource_code_re2", # 2023-03-17T11:36:51Z - sha256 = "cb8b5312a65f2598954545a76e8bce913f35fbb3a21a5c88797a4448e9f9b9d9", - strip_prefix = "re2-578843a516fd1da7084ae46209a75f3613b6065e", - urls = ["https://github.com/google/re2/archive/578843a516fd1da7084ae46209a75f3613b6065e.zip"], + name = "com_googlesource_code_re2", + sha256 = "828341ad08524618a626167bd320b0c2acc97bd1c28eff693a9ea33a7ed2a85f", + strip_prefix = "re2-2023-11-01", + urls = ["https://github.com/google/re2/releases/download/2023-11-01/re2-2023-11-01.zip"], ) # Google benchmark. http_archive( - name = "com_github_google_benchmark", # 2023-08-01T07:47:09Z - sha256 = "db1e39ee71dc38aa7e57ed007f2c8b3bb59e13656435974781a9dc0617d75cc9", - strip_prefix = "benchmark-02a354f3f323ae8256948e1dc77ddcb1dfc297da", - urls = ["https://github.com/google/benchmark/archive/02a354f3f323ae8256948e1dc77ddcb1dfc297da.zip"], + name = "com_github_google_benchmark", + sha256 = "6bc180a57d23d4d9515519f92b0c83d61b05b5bab188961f36ac7b06b0d9e9ce", + strip_prefix = "benchmark-1.8.3", + urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.8.3.tar.gz"], ) # Bazel Skylib. http_archive( - name = "bazel_skylib", # 2023-05-31T19:24:07Z - sha256 = "08c0386f45821ce246bbbf77503c973246ed6ee5c3463e41efc197fa9bc3a7f4", - strip_prefix = "bazel-skylib-288731ef9f7f688932bd50e704a91a45ec185f9b", - urls = ["https://github.com/bazelbuild/bazel-skylib/archive/288731ef9f7f688932bd50e704a91a45ec185f9b.zip"], + name = "bazel_skylib", + sha256 = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94", + urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz"], ) # Bazel platform rules. http_archive( - name = "platforms", # 2023-07-28T19:44:27Z - sha256 = "40eb313613ff00a5c03eed20aba58890046f4d38dec7344f00bb9a8867853526", - strip_prefix = "platforms-4ad40ef271da8176d4fc0194d2089b8a76e19d7b", - urls = ["https://github.com/bazelbuild/platforms/archive/4ad40ef271da8176d4fc0194d2089b8a76e19d7b.zip"], + name = "platforms", + sha256 = "8150406605389ececb6da07cbcb509d5637a3ab9a24bc69b1101531367d89d74", + urls = ["https://github.com/bazelbuild/platforms/releases/download/0.0.8/platforms-0.0.8.tar.gz"], ) diff --git a/ci/cmake_common.sh b/ci/cmake_common.sh index 98976bc1..784b3815 100644 --- a/ci/cmake_common.sh +++ b/ci/cmake_common.sh @@ -14,7 +14,11 @@ # The commit of GoogleTest to be used in the CMake tests in this directory. # Keep this in sync with the commit in the WORKSPACE file. -readonly ABSL_GOOGLETEST_COMMIT="2dd1c131950043a8ad5ab0d2dda0e0970596586a" +# TODO(dmauro): After the next GoogleTest release, use the stable file required +# by Bzlmod. This means downloading a copy of the file and reuploading it to +# avoid changing checksums if the compression is changed by GitHub. It also +# means stop referring to it as a commit and instead use the uploaded filename. +readonly ABSL_GOOGLETEST_COMMIT="f8d7d77c06936315286eb55f8de22cd23c188571" # Avoid depending on GitHub by looking for a cached copy of the commit first. if [[ -r "${KOKORO_GFILE_DIR:-}/distdir/${ABSL_GOOGLETEST_COMMIT}.zip" ]]; then diff --git a/ci/linux_arm_clang-latest_libcxx_bazel.sh b/ci/linux_arm_clang-latest_libcxx_bazel.sh index d751f303..13f4ad13 100755 --- a/ci/linux_arm_clang-latest_libcxx_bazel.sh +++ b/ci/linux_arm_clang-latest_libcxx_bazel.sh @@ -86,7 +86,7 @@ for std in ${STD}; do --copt=\"-DGTEST_REMOVE_LEGACY_TEST_CASEAPI_=1\" \ --copt=-Werror \ --define=\"absl=1\" \ - --enable_bzlmod=false \ + --enable_bzlmod=true \ --features=external_include_paths \ --keep_going \ --show_timestamps \ diff --git a/ci/linux_clang-latest_libcxx_asan_bazel.sh b/ci/linux_clang-latest_libcxx_asan_bazel.sh index 2f847ff6..3153fae4 100755 --- a/ci/linux_clang-latest_libcxx_asan_bazel.sh +++ b/ci/linux_clang-latest_libcxx_asan_bazel.sh @@ -84,7 +84,7 @@ for std in ${STD}; do --copt="-fsanitize=undefined" \ --copt="-fno-sanitize-blacklist" \ --copt=-Werror \ - --enable_bzlmod=false \ + --enable_bzlmod=true \ --features=external_include_paths \ --keep_going \ --linkopt="-fsanitize=address" \ diff --git a/ci/linux_clang-latest_libcxx_bazel.sh b/ci/linux_clang-latest_libcxx_bazel.sh index 6e31fe53..4f3eba49 100755 --- a/ci/linux_clang-latest_libcxx_bazel.sh +++ b/ci/linux_clang-latest_libcxx_bazel.sh @@ -86,7 +86,7 @@ for std in ${STD}; do --copt=\"-DGTEST_REMOVE_LEGACY_TEST_CASEAPI_=1\" \ --copt=-Werror \ --define=\"absl=1\" \ - --enable_bzlmod=false \ + --enable_bzlmod=true \ --features=external_include_paths \ --keep_going \ --show_timestamps \ diff --git a/ci/linux_clang-latest_libcxx_tsan_bazel.sh b/ci/linux_clang-latest_libcxx_tsan_bazel.sh index 715fb859..06f4c2ec 100755 --- a/ci/linux_clang-latest_libcxx_tsan_bazel.sh +++ b/ci/linux_clang-latest_libcxx_tsan_bazel.sh @@ -82,7 +82,7 @@ for std in ${STD}; do --copt="-fsanitize=thread" \ --copt="-fno-sanitize-blacklist" \ --copt=-Werror \ - --enable_bzlmod=false \ + --enable_bzlmod=true \ --features=external_include_paths \ --keep_going \ --linkopt="-fsanitize=thread" \ diff --git a/ci/linux_clang-latest_libstdcxx_bazel.sh b/ci/linux_clang-latest_libstdcxx_bazel.sh index 8aea159d..d499e13c 100755 --- a/ci/linux_clang-latest_libstdcxx_bazel.sh +++ b/ci/linux_clang-latest_libstdcxx_bazel.sh @@ -80,7 +80,7 @@ for std in ${STD}; do --copt="-march=haswell" \ --copt=-Werror \ --define="absl=1" \ - --enable_bzlmod=false \ + --enable_bzlmod=true \ --features=external_include_paths \ --keep_going \ --linkopt="--gcc-toolchain=/usr/local" \ diff --git a/ci/linux_gcc-floor_libstdcxx_bazel.sh b/ci/linux_gcc-floor_libstdcxx_bazel.sh index 68b39994..5bd1dbf8 100755 --- a/ci/linux_gcc-floor_libstdcxx_bazel.sh +++ b/ci/linux_gcc-floor_libstdcxx_bazel.sh @@ -59,6 +59,9 @@ if [[ ${KOKORO_GFILE_DIR:-} ]] && [[ -d "${KOKORO_GFILE_DIR}/distdir" ]]; then BAZEL_EXTRA_ARGS="--distdir=/distdir ${BAZEL_EXTRA_ARGS:-}" fi +# TODO(absl-team): This currently uses Bazel 5. When upgrading to a version +# of Bazel that supports Bzlmod, add --enable_bzlmod=false to keep test +# coverage for the old WORKSPACE dependency management. for std in ${STD}; do for compilation_mode in ${COMPILATION_MODE}; do for exceptions_mode in ${EXCEPTIONS_MODE}; do diff --git a/ci/linux_gcc-latest_libstdcxx_bazel.sh b/ci/linux_gcc-latest_libstdcxx_bazel.sh index 6f965a0e..8f773466 100755 --- a/ci/linux_gcc-latest_libstdcxx_bazel.sh +++ b/ci/linux_gcc-latest_libstdcxx_bazel.sh @@ -84,7 +84,7 @@ for std in ${STD}; do --copt=\"-DGTEST_REMOVE_LEGACY_TEST_CASEAPI_=1\" \ --copt=-Werror \ --define=\"absl=1\" \ - --enable_bzlmod=false \ + --enable_bzlmod=true \ --features=external_include_paths \ --keep_going \ --show_timestamps \ diff --git a/ci/macos_xcode_bazel.sh b/ci/macos_xcode_bazel.sh index 460f94da..bb8fb4bd 100755 --- a/ci/macos_xcode_bazel.sh +++ b/ci/macos_xcode_bazel.sh @@ -56,7 +56,7 @@ ${BAZEL_BIN} test ... \ --copt="-DGTEST_REMOVE_LEGACY_TEST_CASEAPI_=1" \ --copt="-Werror" \ --cxxopt="-std=c++14" \ - --enable_bzlmod=false \ + --enable_bzlmod=true \ --features=external_include_paths \ --keep_going \ --show_timestamps \ diff --git a/ci/windows_clangcl_bazel.bat b/ci/windows_clangcl_bazel.bat index 246b733b..5162628b 100755 --- a/ci/windows_clangcl_bazel.bat +++ b/ci/windows_clangcl_bazel.bat @@ -48,7 +48,7 @@ IF NOT "%ALTERNATE_OPTIONS%"=="" copy %ALTERNATE_OPTIONS% absl\base\options.h --copt=-Wno-microsoft-cast ^ --define=absl=1 ^ --distdir=%KOKORO_GFILE_DIR%\distdir ^ - --enable_bzlmod=false ^ + --enable_bzlmod=true ^ --extra_execution_platforms=//absl:x64_windows-clang-cl ^ --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl ^ --keep_going ^ diff --git a/ci/windows_msvc_bazel.bat b/ci/windows_msvc_bazel.bat index f13398a6..e2acf5fd 100755 --- a/ci/windows_msvc_bazel.bat +++ b/ci/windows_msvc_bazel.bat @@ -41,7 +41,7 @@ IF NOT "%ALTERNATE_OPTIONS%"=="" copy %ALTERNATE_OPTIONS% absl\base\options.h --copt=/std:%STD% ^ --define=absl=1 ^ --distdir=%KOKORO_GFILE_DIR%\distdir ^ - --enable_bzlmod=false ^ + --enable_bzlmod=true ^ --keep_going ^ --test_env="GTEST_INSTALL_FAILURE_SIGNAL_HANDLER=1" ^ --test_env=TZDIR="%CD%\absl\time\internal\cctz\testdata\zoneinfo" ^ diff --git a/ci/windows_msvc_cmake.bat b/ci/windows_msvc_cmake.bat index b026352a..c0f1ac94 100755 --- a/ci/windows_msvc_cmake.bat +++ b/ci/windows_msvc_cmake.bat @@ -14,7 +14,13 @@ SETLOCAL ENABLEDELAYEDEXPANSION -SET ABSL_GOOGLETEST_COMMIT=2dd1c131950043a8ad5ab0d2dda0e0970596586a +:: The commit of GoogleTest to be used in the CMake tests in this directory. +:: Keep this in sync with the commit in the WORKSPACE file. +:: TODO(dmauro): After the next GoogleTest release, use the stable file required +:: by Bzlmod. This means downloading a copy of the file and reuploading it to +:: avoid changing checksums if the compression is changed by GitHub. It also +:: means stop referring to it as a commit and instead use the uploaded filename. +SET ABSL_GOOGLETEST_COMMIT=f8d7d77c06936315286eb55f8de22cd23c188571 IF EXIST %KOKORO_GFILE_DIR%\distdir\%ABSL_GOOGLETEST_COMMIT%.zip ( SET ABSL_GOOGLETEST_DOWNLOAD_URL=file://%KOKORO_GFILE_DIR%\distdir\%ABSL_GOOGLETEST_COMMIT%.zip diff --git a/create_lts.py b/create_lts.py index 642b8847..7e5368e1 100755 --- a/create_lts.py +++ b/create_lts.py @@ -96,6 +96,11 @@ def main(argv): # Replacement directives go here. ReplaceStringsInFile( + 'MODULE.bazel', { + 'version = "head"': + 'version = "{}.0"'.format(datestamp) + }) + ReplaceStringsInFile( 'absl/base/config.h', { '#undef ABSL_LTS_RELEASE_VERSION': '#define ABSL_LTS_RELEASE_VERSION {}'.format(datestamp), |