From 9e0ddaffefbc225f628be9a904e3bc1bb3c271fe Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 23 May 2023 09:52:38 +0200 Subject: [PATCH] [DEPRECATION] Drop C++11 support (#2146) --- .github/workflows/benchmark.yml | 6 ++- .github/workflows/ci.yml | 53 +++++++++++++++++---------- .github/workflows/codeql-analysis.yml | 8 +++- CMakeLists.txt | 5 ++- bazel/repository.bzl | 6 +-- ci/do_ci.sh | 1 + ci/setup_cmake.sh | 16 ++++++-- third_party_release | 2 +- 8 files changed, 64 insertions(+), 33 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 1826603214..9823252c58 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -24,9 +24,11 @@ jobs: path: /home/runner/.cache/bazel key: bazel_benchmark - name: setup + env: + GOOGLETEST_VERSION: 1.13.0 run: | - sudo ./ci/setup_cmake.sh - sudo ./ci/setup_ci_environment.sh + sudo -E ./ci/setup_cmake.sh + sudo -E ./ci/setup_ci_environment.sh - name: Run benchmark id: run_benchmarks run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1666dabbb..ace58fe8dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: env: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 + GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -76,7 +77,7 @@ jobs: env: CC: /usr/bin/gcc-12 CXX: /usr/bin/g++-12 - GOOGLETEST_VERSION: 1.12.1 + GOOGLETEST_VERSION: 1.13.0 PROTOBUF_VERSION: 21.12 run: | sudo -E ./ci/setup_cmake.sh @@ -109,7 +110,7 @@ jobs: env: CC: /usr/bin/gcc-12 CXX: /usr/bin/g++-12 - GOOGLETEST_VERSION: 1.12.1 + GOOGLETEST_VERSION: 1.13.0 PROTOBUF_VERSION: 21.12 run: | sudo -E ./ci/setup_cmake.sh @@ -142,7 +143,7 @@ jobs: env: CC: /usr/bin/clang-14 CXX: /usr/bin/clang++-14 - GOOGLETEST_VERSION: 1.12.1 + GOOGLETEST_VERSION: 1.13.0 PROTOBUF_VERSION: 21.12 run: | sudo -E ./ci/setup_cmake.sh @@ -175,7 +176,7 @@ jobs: env: CC: /usr/bin/clang-14 CXX: /usr/bin/clang++-14 - GOOGLETEST_VERSION: 1.12.1 + GOOGLETEST_VERSION: 1.13.0 PROTOBUF_VERSION: 21.12 run: | sudo -E ./ci/setup_cmake.sh @@ -222,6 +223,7 @@ jobs: env: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 + GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -240,9 +242,11 @@ jobs: with: submodules: 'recursive' - name: setup + env: + GOOGLETEST_VERSION: 1.13.0 run: | - sudo ./ci/setup_cmake.sh - sudo ./ci/setup_ci_environment.sh + sudo -E ./ci/setup_cmake.sh + sudo -E ./ci/setup_ci_environment.sh - name: run cmake tests (enable abseil-cpp) run: | sudo ./ci/install_abseil.sh @@ -256,9 +260,11 @@ jobs: with: submodules: 'recursive' - name: setup + env: + GOOGLETEST_VERSION: 1.13.0 run: | - sudo ./ci/setup_cmake.sh - sudo ./ci/setup_ci_environment.sh + sudo -E ./ci/setup_cmake.sh + sudo -E ./ci/setup_ci_environment.sh - name: run cmake tests (enable opentracing-shim) run: ./ci/do_ci.sh cmake.opentracing_shim.test @@ -281,8 +287,8 @@ jobs: env: CC: /usr/bin/gcc-4.8 CXX: /usr/bin/g++-4.8 - GOOGLETEST_VERSION: "1.10.0" - run: sudo -E ./ci/setup_cmake.sh + run: | + sudo -E ./ci/setup_cmake.sh - name: run tests env: CC: /usr/bin/gcc-4.8 @@ -308,7 +314,6 @@ jobs: env: CC: /usr/bin/gcc-4.8 CXX: /usr/bin/g++-4.8 - GOOGLETEST_VERSION: "1.10.0" run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_grpc.sh -v 4.8 @@ -327,7 +332,8 @@ jobs: submodules: 'recursive' - name: setup env: - CMAKE_VERSION: "3.20.6" + CMAKE_VERSION: 3.20.6 + GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_ci_environment.sh sudo -E ./ci/setup_cmake.sh @@ -348,7 +354,8 @@ jobs: CC: /usr/bin/clang CXX: /usr/bin/clang++ CXXFLAGS: "-stdlib=libc++" - CMAKE_VERSION: "3.20.6" + CMAKE_VERSION: 3.20.6 + GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_ci_environment.sh sudo -E ./ci/setup_cmake.sh @@ -373,9 +380,11 @@ jobs: with: submodules: 'recursive' - name: setup + env: + GOOGLETEST_VERSION: 1.13.0 run: | - sudo ./ci/setup_cmake.sh - sudo ./ci/setup_ci_environment.sh + sudo -E ./ci/setup_cmake.sh + sudo -E ./ci/setup_ci_environment.sh - name: run otlp exporter tests run: | sudo ./ci/setup_grpc.sh @@ -389,9 +398,11 @@ jobs: with: submodules: 'recursive' - name: setup + env: + GOOGLETEST_VERSION: 1.13.0 run: | - sudo ./ci/setup_cmake.sh - sudo ./ci/setup_ci_environment.sh + sudo -E ./ci/setup_cmake.sh + sudo -E ./ci/setup_ci_environment.sh - name: run otlp exporter tests run: | sudo ./ci/setup_grpc.sh @@ -405,9 +416,11 @@ jobs: with: submodules: 'recursive' - name: setup + env: + GOOGLETEST_VERSION: 1.13.0 run: | - sudo ./ci/setup_cmake.sh - sudo ./ci/setup_ci_environment.sh + sudo -E ./ci/setup_cmake.sh + sudo -E ./ci/setup_ci_environment.sh - name: run otlp exporter tests run: | sudo ./ci/setup_grpc.sh -T @@ -424,6 +437,7 @@ jobs: env: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 + GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh @@ -753,6 +767,7 @@ jobs: env: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 + GOOGLETEST_VERSION: 1.13.0 run: | sudo -E ./ci/setup_cmake.sh sudo -E ./ci/setup_ci_environment.sh diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d86e1d55d2..b751e6d407 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -19,9 +19,13 @@ jobs: run: | rm -rf third_party - name: Setup + env: + CC: /usr/bin/gcc-10 + CXX: /usr/bin/g++-10 + GOOGLETEST_VERSION: 1.13.0 run: | - sudo CC=/usr/bin/gcc-10 CXX=/usr/bin/g++-10 ./ci/setup_cmake.sh - sudo CC=/usr/bin/gcc-10 CXX=/usr/bin/g++-10 ./ci/setup_ci_environment.sh + sudo -E ./ci/setup_cmake.sh + sudo -E ./ci/setup_ci_environment.sh - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index fb483f5a58..db42f74a33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,8 +208,8 @@ set(OTELCPP_PROTO_PATH if(WIN32) if(BUILD_TESTING) if(MSVC) - # GTest bug: https://github.com/google/googletest/issues/860 - add_compile_options(/wd4275) + # Warning as error: warning STL4036: is removed in C++20 + add_compile_options(/wd4996) endif() endif() option(WITH_ETW "Whether to include the ETW Exporter in the SDK" ON) @@ -512,6 +512,7 @@ list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") include(CTest) if(BUILD_TESTING) + set(CMAKE_CXX_STANDARD 20) add_definitions(-DENABLE_TEST) if(EXISTS ${CMAKE_BINARY_DIR}/lib/libgtest.a) # Prefer GTest from build tree. GTest is not always working with diff --git a/bazel/repository.bzl b/bazel/repository.bzl index 0cf8a2d8b2..3dbf3e70d4 100644 --- a/bazel/repository.bzl +++ b/bazel/repository.bzl @@ -46,10 +46,10 @@ def opentelemetry_cpp_deps(): maybe( http_archive, name = "com_google_googletest", - sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2", - strip_prefix = "googletest-release-1.12.1", + sha256 = "ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363", + strip_prefix = "googletest-1.13.0", urls = [ - "https://github.com/google/googletest/archive/release-1.12.1.tar.gz", + "https://github.com/google/googletest/archive/v1.13.0.tar.gz", ], ) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index e4e4807c82..72804e0493 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -213,6 +213,7 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then -DWITH_LOGS_PREVIEW=ON \ -DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ + -DCMAKE_CXX_STANDARD=20 \ -DWITH_STL=ON \ "${SRC_DIR}" make -j $(nproc) diff --git a/ci/setup_cmake.sh b/ci/setup_cmake.sh index cdce76b38d..02f6a20f7d 100755 --- a/ci/setup_cmake.sh +++ b/ci/setup_cmake.sh @@ -12,8 +12,16 @@ if [ "x$CMAKE_VERSION" = "x" ]; then export CMAKE_VERSION=3.15.2 fi +# This variable not set on CI pipeline for only legacy environment(GCC 4.8). +# With 1.13.0 version, C++14 must be set which does not supported by legacy environment anymore. +# Also with this version, release version path needs to be adapted. if [ "x$GOOGLETEST_VERSION" = "x" ]; then - export GOOGLETEST_VERSION=1.12.1 + export GOOGLETEST_VERSION=1.10.0 + GOOGLETEST_VERSION_PATH="release-${GOOGLETEST_VERSION}" + GOOGLETEST_FOLDER_PATH="googletest-release-${GOOGLETEST_VERSION}" +else + GOOGLETEST_VERSION_PATH="v${GOOGLETEST_VERSION}" + GOOGLETEST_FOLDER_PATH="googletest-${GOOGLETEST_VERSION}" fi cmake_install() { @@ -31,9 +39,9 @@ googletest_install() { # https://gist.github.com/dlime/313f74fd23e4267c4a915086b84c7d3d tmp_dir=$(mktemp -d) pushd $tmp_dir - wget https://github.com/google/googletest/archive/release-${GOOGLETEST_VERSION}.tar.gz - tar -xf release-${GOOGLETEST_VERSION}.tar.gz - cd googletest-release-${GOOGLETEST_VERSION}/ + wget https://github.com/google/googletest/archive/${GOOGLETEST_VERSION_PATH}.tar.gz + tar -xf ${GOOGLETEST_VERSION_PATH}.tar.gz + cd ${GOOGLETEST_FOLDER_PATH}/ mkdir build && cd build cmake .. -DBUILD_SHARED_LIBS=ON -DINSTALL_GTEST=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr make -j $(nproc) diff --git a/third_party_release b/third_party_release index 0864c60471..253110aa7a 100644 --- a/third_party_release +++ b/third_party_release @@ -16,7 +16,7 @@ gRPC=v1.49.2 abseil=20220623.1 benchmark=v1.7.1 -googletest=release-1.12.1 +googletest=release-1.13.0 ms-gsl=v3.1.0-67-g6f45293 nlohmann-json=v3.11.2 opentelemetry-proto=v0.20.0