From 41a2a2555588253dce0e10db4c545463c4a64731 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Thu, 11 Jan 2024 15:58:39 -0800 Subject: Add support for Bzlmod for the next release https://bazel.build/external/overview#bzlmod Bzlmod will be the default in a future Bazel release. By default it requires projects to be registered with the Bazel Central Registry (https://registry.bazel.build/) and thus uses regular releases by default. Users that want to "live-at-head" can still do this through with overrides (https://bazel.build/external/module#overrides). This change updates Abseil dependencies to use released versions. CI uses Bzlmod except in the case of linux_gcc-floor, which will keep testing the old WORKSPACE-based dependency system. PiperOrigin-RevId: 597676666 Change-Id: I8d33facc432477c6dc7daa06fd00bb4ae8c4adba --- ci/cmake_common.sh | 6 +++++- ci/linux_arm_clang-latest_libcxx_bazel.sh | 2 +- ci/linux_clang-latest_libcxx_asan_bazel.sh | 2 +- ci/linux_clang-latest_libcxx_bazel.sh | 2 +- ci/linux_clang-latest_libcxx_tsan_bazel.sh | 2 +- ci/linux_clang-latest_libstdcxx_bazel.sh | 2 +- ci/linux_gcc-floor_libstdcxx_bazel.sh | 3 +++ ci/linux_gcc-latest_libstdcxx_bazel.sh | 2 +- ci/macos_xcode_bazel.sh | 2 +- ci/windows_clangcl_bazel.bat | 2 +- ci/windows_msvc_bazel.bat | 2 +- ci/windows_msvc_cmake.bat | 8 +++++++- 12 files changed, 24 insertions(+), 11 deletions(-) (limited to 'ci') 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 -- cgit v1.2.3