Skip to content

Commit 7f8e128

Browse files
committed
add overlay port to kokoro
1 parent ac6164f commit 7f8e128

4 files changed

Lines changed: 262 additions & 0 deletions

File tree

ci/kokoro/windows/build.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ REM Configure the environment to use MSVC %MSVC_VERSION% and then switch to Powe
2121
call "%ProgramFiles(x86)%\Microsoft Visual Studio\%MSVC_VERSION%\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
2222
set "BAZEL_VC=%ProgramFiles(x86)%\Microsoft Visual Studio\%MSVC_VERSION%\BuildTools\VC"
2323
set "VCPKG_OVERLAY_TRIPLETS=%cd%\ci\kokoro\windows\triplets"
24+
set "VCPKG_OVERLAY_PORTS=%cd%\ci\kokoro\windows\vcpkg-overlays"
2425

2526
REM The remaining of the build script is implemented in PowerShell.
2627
@echo %date% %time%
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/cmake/opentracing-cpp.cmake b/cmake/opentracing-cpp.cmake
2+
index f014ecd..fd8898a 100644
3+
--- a/cmake/opentracing-cpp.cmake
4+
+++ b/cmake/opentracing-cpp.cmake
5+
@@ -1,7 +1,11 @@
6+
# Copyright The OpenTelemetry Authors
7+
# SPDX-License-Identifier: Apache-2.0
8+
9+
-find_package(OpenTracing CONFIG QUIET)
10+
+find_package(OpenTracing CONFIG REQUIRED)
11+
+if(NOT TARGET OpenTracing::opentracing AND TARGET OpenTracing::opentracing-static)
12+
+ add_library(OpenTracing::opentracing ALIAS OpenTracing::opentracing-static)
13+
+endif()
14+
+
15+
set(OpenTracing_PROVIDER "find_package")
16+
17+
if(NOT OpenTracing_FOUND)
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
if (VCPKG_TARGET_IS_WINDOWS)
2+
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
3+
endif ()
4+
5+
vcpkg_from_github(
6+
OUT_SOURCE_PATH
7+
SOURCE_PATH
8+
REPO
9+
open-telemetry/opentelemetry-cpp
10+
REF
11+
"v${VERSION}"
12+
SHA512
13+
6dc0357d8b3410852d3f970f72b8bec59dba9d6c533ca600432102e65de161903bd9170d98cef7ff0af5191309577ffd2a69ccd004b840914a910a6a282204e4
14+
HEAD_REF
15+
main
16+
PATCHES
17+
fix-target_link.patch)
18+
19+
vcpkg_check_features(
20+
OUT_FEATURE_OPTIONS
21+
FEATURE_OPTIONS
22+
FEATURES
23+
etw
24+
WITH_ETW
25+
zipkin
26+
WITH_ZIPKIN
27+
prometheus
28+
WITH_PROMETHEUS
29+
elasticsearch
30+
WITH_ELASTICSEARCH
31+
otlp-file
32+
WITH_OTLP_FILE
33+
otlp-http
34+
WITH_OTLP_HTTP
35+
otlp-grpc
36+
WITH_OTLP_GRPC
37+
geneva
38+
WITH_GENEVA
39+
user-events
40+
WITH_USER_EVENTS
41+
opentracing
42+
WITH_OPENTRACING
43+
INVERTED_FEATURES
44+
user-events
45+
BUILD_TRACEPOINTS)
46+
47+
# opentelemetry-proto is a third party submodule and opentelemetry-cpp release
48+
# did not pack it.
49+
if (WITH_OTLP_FILE
50+
OR WITH_OTLP_GRPC
51+
OR WITH_OTLP_HTTP)
52+
set(OTEL_PROTO_VERSION "1.6.0")
53+
vcpkg_download_distfile(
54+
ARCHIVE
55+
URLS
56+
"https://github.com/open-telemetry/opentelemetry-proto/archive/v${OTEL_PROTO_VERSION}.tar.gz"
57+
FILENAME
58+
"opentelemetry-proto-${OTEL_PROTO_VERSION}.tar.gz"
59+
SHA512
60+
0e72e0c32d2d699d7a832a4c57a9dbe60e844d4c4e8d7b39eb45e4282cde89fccfeef893eae70b9d018643782090a7228c3ef60863b00747498e80f0cf1db8ae
61+
)
62+
63+
vcpkg_extract_source_archive(src ARCHIVE "${ARCHIVE}")
64+
file(REMOVE_RECURSE "${SOURCE_PATH}/third_party/opentelemetry-proto")
65+
file(COPY "${src}/."
66+
DESTINATION "${SOURCE_PATH}/third_party/opentelemetry-proto")
67+
# Create empty .git directory to prevent opentelemetry from cloning it
68+
# during build time
69+
file(MAKE_DIRECTORY "${SOURCE_PATH}/third_party/opentelemetry-proto/.git")
70+
list(
71+
APPEND
72+
FEATURE_OPTIONS
73+
"-DgRPC_CPP_PLUGIN_EXECUTABLE=${CURRENT_HOST_INSTALLED_DIR}/tools/grpc/grpc_cpp_plugin${VCPKG_HOST_EXECUTABLE_SUFFIX}"
74+
)
75+
endif ()
76+
list(APPEND FEATURE_OPTIONS -DCMAKE_CXX_STANDARD=17 -DWITH_STL=CXX17)
77+
78+
set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS "OFF")
79+
80+
if (WITH_GENEVA OR WITH_USER_EVENTS)
81+
# Geneva and user events exporters from opentelemetry-cpp-contrib are
82+
# tightly coupled with opentelemetry-cpp repo, so they should be ported as a
83+
# feature under opentelemetry-cpp.
84+
clone_opentelemetry_cpp_contrib(CONTRIB_SOURCE_PATH)
85+
86+
if (WITH_GENEVA)
87+
set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS
88+
"${CONTRIB_SOURCE_PATH}/exporters/geneva")
89+
if (VCPKG_TARGET_IS_WINDOWS)
90+
set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS
91+
"${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}\;${CONTRIB_SOURCE_PATH}/exporters/geneva-trace"
92+
)
93+
else ()
94+
set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS
95+
"${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}\;${CONTRIB_SOURCE_PATH}/exporters/fluentd"
96+
)
97+
endif ()
98+
endif ()
99+
100+
if (WITH_USER_EVENTS)
101+
if (WITH_GENEVA)
102+
set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS
103+
"${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}\;${CONTRIB_SOURCE_PATH}/exporters/user_events"
104+
)
105+
else ()
106+
set(OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS
107+
"${CONTRIB_SOURCE_PATH}/exporters/user_events")
108+
endif ()
109+
endif ()
110+
endif ()
111+
112+
vcpkg_cmake_configure(
113+
SOURCE_PATH
114+
"${SOURCE_PATH}"
115+
OPTIONS
116+
-DBUILD_TESTING=OFF
117+
-DWITH_EXAMPLES=OFF
118+
-DOPENTELEMETRY_INSTALL=ON
119+
-DWITH_BENCHMARK=OFF
120+
-DCMAKE_CXX_STANDARD=17
121+
-DWITH_STL=CXX17
122+
-DOPENTELEMETRY_EXTERNAL_COMPONENT_PATH=${OPENTELEMETRY_CPP_EXTERNAL_COMPONENTS}
123+
${FEATURE_OPTIONS}
124+
MAYBE_UNUSED_VARIABLES
125+
WITH_GENEVA
126+
WITH_USER_EVENTS
127+
BUILD_TRACEPOINTS
128+
gRPC_CPP_PLUGIN_EXECUTABLE)
129+
130+
vcpkg_cmake_install()
131+
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
132+
vcpkg_copy_pdbs()
133+
134+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
135+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
136+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
3+
"name": "opentelemetry-cpp",
4+
"version-semver": "1.23.0",
5+
"description": [
6+
"OpenTelemetry is a collection of tools, APIs, and SDKs.",
7+
"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."
8+
],
9+
"homepage": "https://github.com/open-telemetry/opentelemetry-cpp",
10+
"license": "Apache-2.0",
11+
"dependencies": [
12+
"abseil",
13+
"nlohmann-json",
14+
{
15+
"name": "vcpkg-cmake",
16+
"host": true
17+
},
18+
{
19+
"name": "vcpkg-cmake-config",
20+
"host": true
21+
}
22+
],
23+
"features": {
24+
"elasticsearch": {
25+
"description": "Whether to include the Elasticsearch Client in the SDK",
26+
"dependencies": [
27+
{
28+
"name": "curl",
29+
"default-features": false
30+
}
31+
]
32+
},
33+
"etw": {
34+
"description": "Whether to include the ETW Exporter in the SDK",
35+
"supports": "windows"
36+
},
37+
"geneva": {
38+
"description": "Whether to include the Geneva Exporter from the opentelemetry-cpp-contrib repository",
39+
"dependencies": [
40+
{
41+
"name": "opentelemetry-cpp",
42+
"features": [
43+
"etw"
44+
],
45+
"platform": "windows"
46+
},
47+
"opentelemetry-cpp-contrib-version"
48+
]
49+
},
50+
"opentracing": {
51+
"description": "Whether to include the Opentracing shim",
52+
"dependencies": [
53+
"opentracing"
54+
]
55+
},
56+
"otlp-file": {
57+
"description": "Whether to include the OpenTelemetry Protocol to File exporter in the SDK",
58+
"supports": "!uwp",
59+
"dependencies": [
60+
"protobuf"
61+
]
62+
},
63+
"otlp-grpc": {
64+
"description": "Whether to include the OTLP gRPC exporter in the SDK",
65+
"dependencies": [
66+
"grpc",
67+
{
68+
"name": "grpc",
69+
"host": true
70+
}
71+
]
72+
},
73+
"otlp-http": {
74+
"description": "Whether to include the OpenTelemetry Protocol over HTTP in the SDK",
75+
"dependencies": [
76+
"curl",
77+
"protobuf"
78+
]
79+
},
80+
"prometheus": {
81+
"description": "Whether to include the Prometheus Client in the SDK",
82+
"dependencies": [
83+
"prometheus-cpp"
84+
]
85+
},
86+
"user-events": {
87+
"description": "Whether to include the User Events Exporter from the opentelemetry-cpp-contrib repository",
88+
"supports": "linux",
89+
"dependencies": [
90+
"libeventheader-tracepoint",
91+
"libtracepoint",
92+
{
93+
"name": "opentelemetry-cpp",
94+
"features": [
95+
"otlp-http"
96+
]
97+
},
98+
"opentelemetry-cpp-contrib-version"
99+
]
100+
},
101+
"zipkin": {
102+
"description": "Whether to include the Zipkin exporter in the SDK",
103+
"dependencies": [
104+
"curl"
105+
]
106+
}
107+
}
108+
}

0 commit comments

Comments
 (0)