From 9952159295ad30c1d5fc7662e753b35d2f79de6b Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Fri, 30 Jan 2026 18:45:29 -0500 Subject: [PATCH 01/12] gha config --- .github/workflows/test-runner.yml | 52 +++++------------------------ .github/workflows/windows-cmake.yml | 2 +- 2 files changed, 9 insertions(+), 45 deletions(-) diff --git a/.github/workflows/test-runner.yml b/.github/workflows/test-runner.yml index b36abbb02c7fe..332fc660dbd67 100644 --- a/.github/workflows/test-runner.yml +++ b/.github/workflows/test-runner.yml @@ -88,15 +88,17 @@ jobs: execute-integration-tests: true secrets: inherit windows-bazel: + # Disabled + if: false # Build the full matrix only on push events to the default branch, or # when PR gets the has a `gha:full-build` label, or when it had the # label already and it gets a new commit. - if: |- - ${{ - github.event_name == 'schedule' || - github.event_name == 'push' || - contains(github.event.pull_request.labels.*.name, 'gha:full-build') - }} +# if: |- +# ${{ +# github.event_name == 'schedule' || +# github.event_name == 'push' || +# contains(github.event.pull_request.labels.*.name, 'gha:full-build') +# }} name: Windows-Bazel needs: [pre-flight] uses: ./.github/workflows/windows-bazel.yml @@ -127,8 +129,6 @@ jobs: execute-integration-tests: true secrets: inherit windows-cmake: - # Disabled - if: false name: Windows-CMake needs: [pre-flight] uses: ./.github/workflows/windows-cmake.yml @@ -147,39 +147,3 @@ jobs: vcpkg-cache-mode: 'readwrite' execute-integration-tests: true secrets: inherit - notify: - name: Notify-Google-Chat - # Wait until all the other jobs have completed. - needs: - # macos-bazel is disabled - # macos-cmake is disabled - - windows-bazel - # windows-cmake is disabled is disabled - # Run even if the other jobs failed or were skipped. - if: always() - runs-on: ubuntu-latest - steps: - - name: Notify Google Chat - shell: bash - run: | - event_name="${{ github.event_name }}" - case "${event_name}" in - schedule) - ;; - push) - ;; - *) - exit 0 - ;; - esac - failure="${{ contains(needs.*.result, 'failure') }}" - cancelled="${{ contains(needs.*.result, 'cancelled') }}" - status="" - # Report whether any of the jobs failed or were cancelled. - if [[ "${cancelled}" == "true" ]]; then status="cancelled"; fi - if [[ "${failure}" == "true" ]]; then status="failure"; fi - # Exit early if there is nothing interesting to report. - if [[ -z "${status}" ]]; then exit 0; fi - printf '{"text": "GHA Build %s %s/%s/actions/runs/%s"}' \ - "${status}" "${{ github.server_url }}" "${{ github.repository }}" "${{ github.run_id }}" | - curl -fsX POST -o /dev/null -d@- -H "Content-Type: application/json; charset=UTF-8" '${{ secrets.CLOUD_CPP_BUILD_ALERTS_WEBHOOK }}' diff --git a/.github/workflows/windows-cmake.yml b/.github/workflows/windows-cmake.yml index e4df0d5868dcd..d5072543af247 100644 --- a/.github/workflows/windows-cmake.yml +++ b/.github/workflows/windows-cmake.yml @@ -41,7 +41,7 @@ jobs: msvc: [ msvc-2022 ] build_type: [ Release ] arch: [ x64 ] - shard: [ Core3, Core4 ] + shard: [ Core1, Core3, Core4 ] exclude: # Also skip shards (Compute and Other) that contain only generated code. - exclude-from-full-trick: ${{ ! inputs.full-matrix }} From 3f83e4440efcc02a8067a546de296ce3ac074e46 Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Fri, 30 Jan 2026 18:45:47 -0500 Subject: [PATCH 02/12] ci script updates --- ci/etc/vcpkg-version.txt | 2 +- ci/gha/builds/lib/cmake.sh | 3 +- .../opentelemetry-cpp/fix-target_link.patch | 17 +++ .../opentelemetry-cpp/portfile.cmake | 26 +++-- .../opentelemetry-cpp/vcpkg.json | 108 ++++++++++++++++++ 5 files changed, 144 insertions(+), 12 deletions(-) create mode 100644 ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/fix-target_link.patch create mode 100644 ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/vcpkg.json diff --git a/ci/etc/vcpkg-version.txt b/ci/etc/vcpkg-version.txt index fdf37ec4deabe..922462b2e1e1c 100644 --- a/ci/etc/vcpkg-version.txt +++ b/ci/etc/vcpkg-version.txt @@ -1 +1 @@ -2025.10.17 +3895230f38e498525f2560a281223d12066fa74a diff --git a/ci/gha/builds/lib/cmake.sh b/ci/gha/builds/lib/cmake.sh index de923525946e8..5b99fb0803a93 100755 --- a/ci/gha/builds/lib/cmake.sh +++ b/ci/gha/builds/lib/cmake.sh @@ -44,6 +44,7 @@ function cmake::common_args() { fi local args args=( + -DCMAKE_CXX_STANDARD=17 -DGOOGLE_CLOUD_CPP_ENABLE_CCACHE=OFF -DGOOGLE_CLOUD_CPP_ENABLE_WERROR=ON -GNinja @@ -58,7 +59,7 @@ function cmake::common_args() { if [[ -n "${VCPKG_TRIPLET:-}" ]]; then args+=("-DVCPKG_TARGET_TRIPLET=${VCPKG_TRIPLET}") fi - args+=("-DVCPKG_OVERLAY_PORTS=ci/gha/builds/vcpkg-overlays") + args+=("-DVCPKG_OVERLAY_PORTS=ci\gha\builds\vcpkg-overlays") printf "%s\n" "${args[@]}" } diff --git a/ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/fix-target_link.patch b/ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/fix-target_link.patch new file mode 100644 index 0000000000000..f4709e8b1c28f --- /dev/null +++ b/ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/fix-target_link.patch @@ -0,0 +1,17 @@ +diff --git a/cmake/opentracing-cpp.cmake b/cmake/opentracing-cpp.cmake +index f014ecd..fd8898a 100644 +--- a/cmake/opentracing-cpp.cmake ++++ b/cmake/opentracing-cpp.cmake +@@ -1,7 +1,11 @@ + # Copyright The OpenTelemetry Authors + # SPDX-License-Identifier: Apache-2.0 + +-find_package(OpenTracing CONFIG QUIET) ++find_package(OpenTracing CONFIG REQUIRED) ++if(NOT TARGET OpenTracing::opentracing AND TARGET OpenTracing::opentracing-static) ++ add_library(OpenTracing::opentracing ALIAS OpenTracing::opentracing-static) ++endif() ++ + set(OpenTracing_PROVIDER "find_package") + + if(NOT OpenTracing_FOUND) diff --git a/ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/portfile.cmake b/ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/portfile.cmake index eacf1ea4ada70..878e45be8b27e 100644 --- a/ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/portfile.cmake +++ b/ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/portfile.cmake @@ -10,12 +10,11 @@ vcpkg_from_github( REF "v${VERSION}" SHA512 - c93005c9b24b358a9998141f6c7fd9675778731775dacaad18f0e81117fd00aaabff371c04cf96688a9c86117727181052a141d961d4db28fc457b454351c570 + 6dc0357d8b3410852d3f970f72b8bec59dba9d6c533ca600432102e65de161903bd9170d98cef7ff0af5191309577ffd2a69ccd004b840914a910a6a282204e4 HEAD_REF main PATCHES - # Missing find_dependency for Abseil - add-missing-find-dependency.patch) + fix-target_link.patch) vcpkg_check_features( OUT_FEATURE_OPTIONS @@ -29,6 +28,8 @@ vcpkg_check_features( WITH_PROMETHEUS elasticsearch WITH_ELASTICSEARCH + otlp-file + WITH_OTLP_FILE otlp-http WITH_OTLP_HTTP otlp-grpc @@ -37,14 +38,18 @@ vcpkg_check_features( WITH_GENEVA user-events WITH_USER_EVENTS + opentracing + WITH_OPENTRACING INVERTED_FEATURES user-events BUILD_TRACEPOINTS) # opentelemetry-proto is a third party submodule and opentelemetry-cpp release # did not pack it. -if (WITH_OTLP_GRPC OR WITH_OTLP_HTTP) - set(OTEL_PROTO_VERSION "1.3.1") +if (WITH_OTLP_FILE + OR WITH_OTLP_GRPC + OR WITH_OTLP_HTTP) + set(OTEL_PROTO_VERSION "1.6.0") vcpkg_download_distfile( ARCHIVE URLS @@ -52,7 +57,7 @@ if (WITH_OTLP_GRPC OR WITH_OTLP_HTTP) FILENAME "opentelemetry-proto-${OTEL_PROTO_VERSION}.tar.gz" SHA512 - 8c75e4ff79c4b5b251e0ec8ece92ec901d70ec601644505ffdd137fb728daac91fd9203e1f448500124906737d91d80f10b694977688c655418b94f61c828d06 + 0e72e0c32d2d699d7a832a4c57a9dbe60e844d4c4e8d7b39eb45e4282cde89fccfeef893eae70b9d018643782090a7228c3ef60863b00747498e80f0cf1db8ae ) vcpkg_extract_source_archive(src ARCHIVE "${ARCHIVE}") @@ -62,13 +67,13 @@ if (WITH_OTLP_GRPC OR WITH_OTLP_HTTP) # Create empty .git directory to prevent opentelemetry from cloning it # during build time file(MAKE_DIRECTORY "${SOURCE_PATH}/third_party/opentelemetry-proto/.git") - list(APPEND FEATURE_OPTIONS -DCMAKE_CXX_STANDARD=14) list( APPEND FEATURE_OPTIONS "-DgRPC_CPP_PLUGIN_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/grpc/grpc_cpp_plugin${VCPKG_HOST_EXECUTABLE_SUFFIX}" ) endif () +list(APPEND FEATURE_OPTIONS -DCMAKE_CXX_STANDARD=17 -DWITH_STL=CXX17) set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS "OFF") @@ -111,15 +116,16 @@ vcpkg_cmake_configure( -DBUILD_TESTING=OFF -DWITH_EXAMPLES=OFF -DOPENTELEMETRY_INSTALL=ON - -DWITH_STL=CXX14 - -DWITH_ABSEIL=ON -DWITH_BENCHMARK=OFF + -DCMAKE_CXX_STANDARD=17 + -DWITH_STL=CXX17 -DOPENTELEMETRY_EXTERNAL_COMPONENT_PATH=${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS} ${FEATURE_OPTIONS} MAYBE_UNUSED_VARIABLES WITH_GENEVA WITH_USER_EVENTS - BUILD_TRACEPOINTS) + BUILD_TRACEPOINTS + gRPC_CPP_PLUGIN_EXECUTABLE) vcpkg_cmake_install() vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}") diff --git a/ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/vcpkg.json b/ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/vcpkg.json new file mode 100644 index 0000000000000..0570a7bd2e108 --- /dev/null +++ b/ci/gha/builds/vcpkg-overlays/opentelemetry-cpp/vcpkg.json @@ -0,0 +1,108 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "opentelemetry-cpp", + "version-semver": "1.23.0", + "description": [ + "OpenTelemetry is a collection of tools, APIs, and SDKs.", + "You use it to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) for analysis in order to understand your software's performance and behavior." + ], + "homepage": "https://github.com/open-telemetry/opentelemetry-cpp", + "license": "Apache-2.0", + "dependencies": [ + "abseil", + "nlohmann-json", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "elasticsearch": { + "description": "Whether to include the Elasticsearch Client in the SDK", + "dependencies": [ + { + "name": "curl", + "default-features": false + } + ] + }, + "etw": { + "description": "Whether to include the ETW Exporter in the SDK", + "supports": "windows" + }, + "geneva": { + "description": "Whether to include the Geneva Exporter from the opentelemetry-cpp-contrib repository", + "dependencies": [ + { + "name": "opentelemetry-cpp", + "features": [ + "etw" + ], + "platform": "windows" + }, + "opentelemetry-cpp-contrib-version" + ] + }, + "opentracing": { + "description": "Whether to include the Opentracing shim", + "dependencies": [ + "opentracing" + ] + }, + "otlp-file": { + "description": "Whether to include the OpenTelemetry Protocol to File exporter in the SDK", + "supports": "!uwp", + "dependencies": [ + "protobuf" + ] + }, + "otlp-grpc": { + "description": "Whether to include the OTLP gRPC exporter in the SDK", + "dependencies": [ + "grpc", + { + "name": "grpc", + "host": true + } + ] + }, + "otlp-http": { + "description": "Whether to include the OpenTelemetry Protocol over HTTP in the SDK", + "dependencies": [ + "curl", + "protobuf" + ] + }, + "prometheus": { + "description": "Whether to include the Prometheus Client in the SDK", + "dependencies": [ + "prometheus-cpp" + ] + }, + "user-events": { + "description": "Whether to include the User Events Exporter from the opentelemetry-cpp-contrib repository", + "supports": "linux", + "dependencies": [ + "libeventheader-tracepoint", + "libtracepoint", + { + "name": "opentelemetry-cpp", + "features": [ + "otlp-http" + ] + }, + "opentelemetry-cpp-contrib-version" + ] + }, + "zipkin": { + "description": "Whether to include the Zipkin exporter in the SDK", + "dependencies": [ + "curl" + ] + } + } +} From 137a960a916019e39c5dc622525e1f960073712d Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Fri, 30 Jan 2026 18:59:30 -0500 Subject: [PATCH 03/12] NOMINMAX on command line --- ci/gha/builds/windows-cmake.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/gha/builds/windows-cmake.sh b/ci/gha/builds/windows-cmake.sh index 674b7202e7000..621499bdcaeaf 100755 --- a/ci/gha/builds/windows-cmake.sh +++ b/ci/gha/builds/windows-cmake.sh @@ -52,6 +52,8 @@ fi # [2]: https://stackoverflow.com/questions/3775406 args+=("-DCMAKE_EXE_LINKER_FLAGS=/MANIFEST:NO") +args+=("-DNOMINMAX") + io::log_h1 "Starting Build" TIMEFORMAT="==> 🕑 CMake configuration done in %R seconds" time { From b2e899053aa8303cb4885161d1a9c09e8adb1f15 Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Fri, 30 Jan 2026 19:04:38 -0500 Subject: [PATCH 04/12] ggive NOMINMAX a value --- ci/gha/builds/windows-cmake.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/gha/builds/windows-cmake.sh b/ci/gha/builds/windows-cmake.sh index 621499bdcaeaf..f2da8fd2ae7ce 100755 --- a/ci/gha/builds/windows-cmake.sh +++ b/ci/gha/builds/windows-cmake.sh @@ -52,7 +52,7 @@ fi # [2]: https://stackoverflow.com/questions/3775406 args+=("-DCMAKE_EXE_LINKER_FLAGS=/MANIFEST:NO") -args+=("-DNOMINMAX") +args+=("-DNOMINMAX=1") io::log_h1 "Starting Build" TIMEFORMAT="==> 🕑 CMake configuration done in %R seconds" From 61e7862c3472c190f8974f493a10abe196862e6d Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Fri, 30 Jan 2026 19:17:44 -0500 Subject: [PATCH 05/12] add_definitions NOMINMAX --- ci/gha/builds/windows-cmake.sh | 2 -- google/cloud/CMakeLists.txt | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/gha/builds/windows-cmake.sh b/ci/gha/builds/windows-cmake.sh index f2da8fd2ae7ce..674b7202e7000 100755 --- a/ci/gha/builds/windows-cmake.sh +++ b/ci/gha/builds/windows-cmake.sh @@ -52,8 +52,6 @@ fi # [2]: https://stackoverflow.com/questions/3775406 args+=("-DCMAKE_EXE_LINKER_FLAGS=/MANIFEST:NO") -args+=("-DNOMINMAX=1") - io::log_h1 "Starting Build" TIMEFORMAT="==> 🕑 CMake configuration done in %R seconds" time { diff --git a/google/cloud/CMakeLists.txt b/google/cloud/CMakeLists.txt index da8552306d630..76c2230703100 100644 --- a/google/cloud/CMakeLists.txt +++ b/google/cloud/CMakeLists.txt @@ -18,6 +18,8 @@ if (GOOGLE_CLOUD_CPP_USE_INSTALLED_COMMON) return() endif () +add_definitions(-DNOMINMAX) + set(DOXYGEN_PROJECT_NAME "Google Cloud C++ Client") set(DOXYGEN_PROJECT_BRIEF "C++ Client Library for Google Cloud Platform") set(DOXYGEN_PROJECT_NUMBER "${PROJECT_VERSION}") From 5c7abaabbda07c8c83094b77584bbfb38f3fb3f1 Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Fri, 30 Jan 2026 19:29:50 -0500 Subject: [PATCH 06/12] if win32 at top level --- CMakeLists.txt | 4 ++++ google/cloud/CMakeLists.txt | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 156cf8a2ef011..c0c4daab368f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,10 @@ if (APPLE " cmake -DGOOGLE_CLOUD_CPP_ENABLE_MACOS_OPENSSL_CHECK=OFF ...") endif () +if (WIN32) + add_definitions(-DNOMINMAX) +endif () + # If ccache is installed use it for the build. option(GOOGLE_CLOUD_CPP_ENABLE_CCACHE "Automatically use ccache if available" OFF) diff --git a/google/cloud/CMakeLists.txt b/google/cloud/CMakeLists.txt index 76c2230703100..da8552306d630 100644 --- a/google/cloud/CMakeLists.txt +++ b/google/cloud/CMakeLists.txt @@ -18,8 +18,6 @@ if (GOOGLE_CLOUD_CPP_USE_INSTALLED_COMMON) return() endif () -add_definitions(-DNOMINMAX) - set(DOXYGEN_PROJECT_NAME "Google Cloud C++ Client") set(DOXYGEN_PROJECT_BRIEF "C++ Client Library for Google Cloud Platform") set(DOXYGEN_PROJECT_NUMBER "${PROJECT_VERSION}") From 088f9ebd8bf87687af8429cbaf16692acd7a50e6 Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Fri, 30 Jan 2026 19:40:32 -0500 Subject: [PATCH 07/12] build everything --- .github/workflows/windows-cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-cmake.yml b/.github/workflows/windows-cmake.yml index d5072543af247..3901691e8b229 100644 --- a/.github/workflows/windows-cmake.yml +++ b/.github/workflows/windows-cmake.yml @@ -41,7 +41,7 @@ jobs: msvc: [ msvc-2022 ] build_type: [ Release ] arch: [ x64 ] - shard: [ Core1, Core3, Core4 ] + shard: [ Core1, Core2, Core3, Core4, Core5, Compute, AIPlatform, Shard1, Shard2, Shard3, Shard4, Shard5, Other ] exclude: # Also skip shards (Compute and Other) that contain only generated code. - exclude-from-full-trick: ${{ ! inputs.full-matrix }} From ac6164f42babcc5cc98c34d54cf92a094e2441ca Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Fri, 30 Jan 2026 20:11:23 -0500 Subject: [PATCH 08/12] add skipped libs back in --- .github/workflows/windows-cmake.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows-cmake.yml b/.github/workflows/windows-cmake.yml index 3901691e8b229..5b17e71ff82ac 100644 --- a/.github/workflows/windows-cmake.yml +++ b/.github/workflows/windows-cmake.yml @@ -103,6 +103,7 @@ jobs: dataproc discoveryengine monitoring + opentelemetry retail sql dialogflow_cx @@ -209,6 +210,8 @@ jobs: universe_domain ) shard5_features=( + asset + channel video datacatalog iam @@ -269,10 +272,6 @@ jobs: skipped_features+=("${shard3_features[@]}") skipped_features+=("${shard4_features[@]}") skipped_features+=("${shard5_features[@]}") - # We use vcpkg in this build, which ships with Protobuf v21.x. - # Both `asset` and `channel` require Protobuf >= 23.x to compile on - # Windows. - skipped_features+=(asset channel) skipped="$(printf ",-%s" "${skipped_features[@]}")" echo "features=__ga_libraries__,__experimental_libraries__,${skipped:1}" >> "${GITHUB_OUTPUT}" fi From 7f8e12802f472dcc534c0a86c5fd00ac571fa647 Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Fri, 30 Jan 2026 20:24:56 -0500 Subject: [PATCH 09/12] add overlay port to kokoro --- ci/kokoro/windows/build.bat | 1 + .../opentelemetry-cpp/fix-target_link.patch | 17 +++ .../opentelemetry-cpp/portfile.cmake | 136 ++++++++++++++++++ .../opentelemetry-cpp/vcpkg.json | 108 ++++++++++++++ 4 files changed, 262 insertions(+) create mode 100644 ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/fix-target_link.patch create mode 100644 ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/portfile.cmake create mode 100644 ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/vcpkg.json diff --git a/ci/kokoro/windows/build.bat b/ci/kokoro/windows/build.bat index 49e00da5f37e1..02be4286d5f96 100644 --- a/ci/kokoro/windows/build.bat +++ b/ci/kokoro/windows/build.bat @@ -21,6 +21,7 @@ REM Configure the environment to use MSVC %MSVC_VERSION% and then switch to Powe call "%ProgramFiles(x86)%\Microsoft Visual Studio\%MSVC_VERSION%\BuildTools\VC\Auxiliary\Build\vcvars64.bat" set "BAZEL_VC=%ProgramFiles(x86)%\Microsoft Visual Studio\%MSVC_VERSION%\BuildTools\VC" set "VCPKG_OVERLAY_TRIPLETS=%cd%\ci\kokoro\windows\triplets" +set "VCPKG_OVERLAY_PORTS=%cd%\ci\kokoro\windows\vcpkg-overlays" REM The remaining of the build script is implemented in PowerShell. @echo %date% %time% diff --git a/ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/fix-target_link.patch b/ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/fix-target_link.patch new file mode 100644 index 0000000000000..f4709e8b1c28f --- /dev/null +++ b/ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/fix-target_link.patch @@ -0,0 +1,17 @@ +diff --git a/cmake/opentracing-cpp.cmake b/cmake/opentracing-cpp.cmake +index f014ecd..fd8898a 100644 +--- a/cmake/opentracing-cpp.cmake ++++ b/cmake/opentracing-cpp.cmake +@@ -1,7 +1,11 @@ + # Copyright The OpenTelemetry Authors + # SPDX-License-Identifier: Apache-2.0 + +-find_package(OpenTracing CONFIG QUIET) ++find_package(OpenTracing CONFIG REQUIRED) ++if(NOT TARGET OpenTracing::opentracing AND TARGET OpenTracing::opentracing-static) ++ add_library(OpenTracing::opentracing ALIAS OpenTracing::opentracing-static) ++endif() ++ + set(OpenTracing_PROVIDER "find_package") + + if(NOT OpenTracing_FOUND) diff --git a/ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/portfile.cmake b/ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/portfile.cmake new file mode 100644 index 0000000000000..878e45be8b27e --- /dev/null +++ b/ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/portfile.cmake @@ -0,0 +1,136 @@ +if (VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif () + +vcpkg_from_github( + OUT_SOURCE_PATH + SOURCE_PATH + REPO + open-telemetry/opentelemetry-cpp + REF + "v${VERSION}" + SHA512 + 6dc0357d8b3410852d3f970f72b8bec59dba9d6c533ca600432102e65de161903bd9170d98cef7ff0af5191309577ffd2a69ccd004b840914a910a6a282204e4 + HEAD_REF + main + PATCHES + fix-target_link.patch) + +vcpkg_check_features( + OUT_FEATURE_OPTIONS + FEATURE_OPTIONS + FEATURES + etw + WITH_ETW + zipkin + WITH_ZIPKIN + prometheus + WITH_PROMETHEUS + elasticsearch + WITH_ELASTICSEARCH + otlp-file + WITH_OTLP_FILE + otlp-http + WITH_OTLP_HTTP + otlp-grpc + WITH_OTLP_GRPC + geneva + WITH_GENEVA + user-events + WITH_USER_EVENTS + opentracing + WITH_OPENTRACING + INVERTED_FEATURES + user-events + BUILD_TRACEPOINTS) + +# opentelemetry-proto is a third party submodule and opentelemetry-cpp release +# did not pack it. +if (WITH_OTLP_FILE + OR WITH_OTLP_GRPC + OR WITH_OTLP_HTTP) + set(OTEL_PROTO_VERSION "1.6.0") + vcpkg_download_distfile( + ARCHIVE + URLS + "https://github.com/open-telemetry/opentelemetry-proto/archive/v${OTEL_PROTO_VERSION}.tar.gz" + FILENAME + "opentelemetry-proto-${OTEL_PROTO_VERSION}.tar.gz" + SHA512 + 0e72e0c32d2d699d7a832a4c57a9dbe60e844d4c4e8d7b39eb45e4282cde89fccfeef893eae70b9d018643782090a7228c3ef60863b00747498e80f0cf1db8ae + ) + + vcpkg_extract_source_archive(src ARCHIVE "${ARCHIVE}") + file(REMOVE_RECURSE "${SOURCE_PATH}/third_party/opentelemetry-proto") + file(COPY "${src}/." + DESTINATION "${SOURCE_PATH}/third_party/opentelemetry-proto") + # Create empty .git directory to prevent opentelemetry from cloning it + # during build time + file(MAKE_DIRECTORY "${SOURCE_PATH}/third_party/opentelemetry-proto/.git") + list( + APPEND + FEATURE_OPTIONS + "-DgRPC_CPP_PLUGIN_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/grpc/grpc_cpp_plugin${VCPKG_HOST_EXECUTABLE_SUFFIX}" + ) +endif () +list(APPEND FEATURE_OPTIONS -DCMAKE_CXX_STANDARD=17 -DWITH_STL=CXX17) + +set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS "OFF") + +if (WITH_GENEVA OR WITH_USER_EVENTS) + # Geneva and user events exporters from opentelemetry-cpp-contrib are + # tightly coupled with opentelemetry-cpp repo, so they should be ported as a + # feature under opentelemetry-cpp. + clone_opentelemetry_cpp_contrib(CONTRIB_SOURCE_PATH) + + if (WITH_GENEVA) + set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS + "${CONTRIB_SOURCE_PATH}/exporters/geneva") + if (VCPKG_TARGET_IS_WINDOWS) + set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS + "${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}\;${CONTRIB_SOURCE_PATH}/exporters/geneva-trace" + ) + else () + set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS + "${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}\;${CONTRIB_SOURCE_PATH}/exporters/fluentd" + ) + endif () + endif () + + if (WITH_USER_EVENTS) + if (WITH_GENEVA) + set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS + "${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}\;${CONTRIB_SOURCE_PATH}/exporters/user_events" + ) + else () + set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS + "${CONTRIB_SOURCE_PATH}/exporters/user_events") + endif () + endif () +endif () + +vcpkg_cmake_configure( + SOURCE_PATH + "${SOURCE_PATH}" + OPTIONS + -DBUILD_TESTING=OFF + -DWITH_EXAMPLES=OFF + -DOPENTELEMETRY_INSTALL=ON + -DWITH_BENCHMARK=OFF + -DCMAKE_CXX_STANDARD=17 + -DWITH_STL=CXX17 + -DOPENTELEMETRY_EXTERNAL_COMPONENT_PATH=${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS} + ${FEATURE_OPTIONS} + MAYBE_UNUSED_VARIABLES + WITH_GENEVA + WITH_USER_EVENTS + BUILD_TRACEPOINTS + gRPC_CPP_PLUGIN_EXECUTABLE) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}") +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/vcpkg.json b/ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/vcpkg.json new file mode 100644 index 0000000000000..0570a7bd2e108 --- /dev/null +++ b/ci/kokoro/windows/vcpkg-overlays/opentelemetry-cpp/vcpkg.json @@ -0,0 +1,108 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "opentelemetry-cpp", + "version-semver": "1.23.0", + "description": [ + "OpenTelemetry is a collection of tools, APIs, and SDKs.", + "You use it to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) for analysis in order to understand your software's performance and behavior." + ], + "homepage": "https://github.com/open-telemetry/opentelemetry-cpp", + "license": "Apache-2.0", + "dependencies": [ + "abseil", + "nlohmann-json", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "elasticsearch": { + "description": "Whether to include the Elasticsearch Client in the SDK", + "dependencies": [ + { + "name": "curl", + "default-features": false + } + ] + }, + "etw": { + "description": "Whether to include the ETW Exporter in the SDK", + "supports": "windows" + }, + "geneva": { + "description": "Whether to include the Geneva Exporter from the opentelemetry-cpp-contrib repository", + "dependencies": [ + { + "name": "opentelemetry-cpp", + "features": [ + "etw" + ], + "platform": "windows" + }, + "opentelemetry-cpp-contrib-version" + ] + }, + "opentracing": { + "description": "Whether to include the Opentracing shim", + "dependencies": [ + "opentracing" + ] + }, + "otlp-file": { + "description": "Whether to include the OpenTelemetry Protocol to File exporter in the SDK", + "supports": "!uwp", + "dependencies": [ + "protobuf" + ] + }, + "otlp-grpc": { + "description": "Whether to include the OTLP gRPC exporter in the SDK", + "dependencies": [ + "grpc", + { + "name": "grpc", + "host": true + } + ] + }, + "otlp-http": { + "description": "Whether to include the OpenTelemetry Protocol over HTTP in the SDK", + "dependencies": [ + "curl", + "protobuf" + ] + }, + "prometheus": { + "description": "Whether to include the Prometheus Client in the SDK", + "dependencies": [ + "prometheus-cpp" + ] + }, + "user-events": { + "description": "Whether to include the User Events Exporter from the opentelemetry-cpp-contrib repository", + "supports": "linux", + "dependencies": [ + "libeventheader-tracepoint", + "libtracepoint", + { + "name": "opentelemetry-cpp", + "features": [ + "otlp-http" + ] + }, + "opentelemetry-cpp-contrib-version" + ] + }, + "zipkin": { + "description": "Whether to include the Zipkin exporter in the SDK", + "dependencies": [ + "curl" + ] + } + } +} From 724364652b96fb30269fc0e769aab534ef73d478 Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Fri, 30 Jan 2026 21:21:00 -0500 Subject: [PATCH 10/12] vcpkg version regex is bad, don't use it --- ci/kokoro/windows/lib/vcpkg.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/kokoro/windows/lib/vcpkg.ps1 b/ci/kokoro/windows/lib/vcpkg.ps1 index 9fc310c6b4617..1fa2db8802e97 100644 --- a/ci/kokoro/windows/lib/vcpkg.ps1 +++ b/ci/kokoro/windows/lib/vcpkg.ps1 @@ -69,9 +69,9 @@ function Install-Vcpkg { $vcpkg_version = Get-Content -Path "${project_root}\ci\etc\vcpkg-version.txt" $vcpkg_url = "https://github.com/microsoft/vcpkg/archive/${vcpkg_version}.zip" - if ($vcpkg_version -match "[0-9]{4}.[0-9]{2}.[0-9]{2}" ) { - $vcpkg_url = "https://github.com/microsoft/vcpkg/archive/refs/tags/${vcpkg_version}.zip" - } +# if ($vcpkg_version -match "[0-9]{4}.[0-9]{2}.[0-9]{2}" ) { +# $vcpkg_url = "https://github.com/microsoft/vcpkg/archive/refs/tags/${vcpkg_version}.zip" +# } Write-Host "$(Get-Date -Format o) Downloading vcpkg archive from $vcpkg_url" # Download the right version of `vcpkg` From 1e13e4f653f9d3fee2bd16a747f06d184610b332 Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Sat, 31 Jan 2026 09:41:46 -0500 Subject: [PATCH 11/12] move ports env def --- ci/kokoro/windows/build.bat | 2 +- ci/kokoro/windows/build.ps1 | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/kokoro/windows/build.bat b/ci/kokoro/windows/build.bat index 02be4286d5f96..44fd7aa944dc8 100644 --- a/ci/kokoro/windows/build.bat +++ b/ci/kokoro/windows/build.bat @@ -21,7 +21,7 @@ REM Configure the environment to use MSVC %MSVC_VERSION% and then switch to Powe call "%ProgramFiles(x86)%\Microsoft Visual Studio\%MSVC_VERSION%\BuildTools\VC\Auxiliary\Build\vcvars64.bat" set "BAZEL_VC=%ProgramFiles(x86)%\Microsoft Visual Studio\%MSVC_VERSION%\BuildTools\VC" set "VCPKG_OVERLAY_TRIPLETS=%cd%\ci\kokoro\windows\triplets" -set "VCPKG_OVERLAY_PORTS=%cd%\ci\kokoro\windows\vcpkg-overlays" +@REM set "VCPKG_OVERLAY_PORTS=%cd%\ci\kokoro\windows\vcpkg-overlays" REM The remaining of the build script is implemented in PowerShell. @echo %date% %time% diff --git a/ci/kokoro/windows/build.ps1 b/ci/kokoro/windows/build.ps1 index 6a7b54bff1380..31b0c0d430053 100644 --- a/ci/kokoro/windows/build.ps1 +++ b/ci/kokoro/windows/build.ps1 @@ -86,6 +86,9 @@ if ($BuildName -eq "cmake-debug") { $BuildScript = "builds/quickstart-cmake.ps1" } +$env:VCPKG_OVERLAY_PORTS = "vcpkg-overlays" + + $ScriptLocation = Split-Path $PSCommandPath -Parent Write-Host -ForegroundColor Green "`n$(Get-Date -Format o) Running build script for $BuildName build" From 726fa5c9521580d8eb0fd429ff81569673151458 Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Sat, 31 Jan 2026 12:27:28 -0500 Subject: [PATCH 12/12] adjust overlay path in ps1 --- ci/kokoro/windows/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/kokoro/windows/build.ps1 b/ci/kokoro/windows/build.ps1 index 31b0c0d430053..955c1e94eb222 100644 --- a/ci/kokoro/windows/build.ps1 +++ b/ci/kokoro/windows/build.ps1 @@ -86,7 +86,7 @@ if ($BuildName -eq "cmake-debug") { $BuildScript = "builds/quickstart-cmake.ps1" } -$env:VCPKG_OVERLAY_PORTS = "vcpkg-overlays" +$env:VCPKG_OVERLAY_PORTS = "ci\kokoro\windows\vcpkg-overlays" $ScriptLocation = Split-Path $PSCommandPath -Parent