Skip to content

Commit ea52218

Browse files
[BUILD] Fix curl header target location, otlp test deps, and visibility
Three mechanical Bazel wiring fixes to make PR open-telemetry#4634 build: 1. Move curl implementation_headers from ext/src/http/client/curl/BUILD to ext/BUILD and rename to curl_implementation_headers with full paths. Bazel was looking for bare filenames in the wrong package. 2. Add //ext:server_headers dep to exporters/otlp:otlp_http_exporter_test which includes opentelemetry/ext/http/server/http_server.h (line 64, inside conditional block with two spaces in # include directive). 3. Add //exporters/otlp:__pkg__ to server_headers visibility list so the test dependency (fix open-telemetry#2) doesn't fail visibility checks. Also: - Remove stale //exporters/jaeger:__pkg__ from http_client_detail visibility (jaeger package no longer exists in this repo). - Sort hdrs, visibility, and deps lists alphabetically per buildifier. - Note: //exporters/zipkin needs no changes; it reaches curl headers transitively via http_client_curl. Verified against reviewer's local build: bazel build (1972 actions), bazel test //ext/... //exporters/... (40/40 pass), buildifier (0 findings).
1 parent ae3fecd commit ea52218

5 files changed

Lines changed: 34 additions & 37 deletions

File tree

‎exporters/otlp/BUILD‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ cc_test(
810810
deps = [
811811
":otlp_http_exporter",
812812
"//api",
813+
"//ext:server_headers",
813814
"//sdk/src/metrics",
814815
"//test_common/src/http/client/nosend:http_client_nosend",
815816
"@com_google_googletest//:gtest_main",

‎ext/BUILD‎

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ package(default_visibility = ["//visibility:public"])
99
cc_library(
1010
name = "headers",
1111
hdrs = [
12+
"include/opentelemetry/ext/http/client/curl/http_client_factory_curl.h",
1213
"include/opentelemetry/ext/http/client/http_client.h",
1314
"include/opentelemetry/ext/http/client/http_client_factory.h",
14-
"include/opentelemetry/ext/http/client/curl/http_client_factory_curl.h",
1515
"include/opentelemetry/ext/http/common/url_parser.h",
1616
],
1717
strip_include_prefix = "include",
@@ -20,6 +20,28 @@ cc_library(
2020
],
2121
)
2222

23+
# Internal: curl implementation headers
24+
# Used by: the curl client itself, its tests, and the w3c test server
25+
# These are implementation details and are not installed by CMake
26+
cc_library(
27+
name = "curl_implementation_headers",
28+
hdrs = [
29+
"include/opentelemetry/ext/http/client/curl/http_client_curl.h",
30+
"include/opentelemetry/ext/http/client/curl/http_operation_curl.h",
31+
"include/opentelemetry/ext/http/client/curl/http_time_util.h",
32+
],
33+
strip_include_prefix = "include",
34+
visibility = [
35+
"//ext/src/http/client/curl:__pkg__",
36+
"//ext/test/http:__pkg__",
37+
"//ext/test/w3c_tracecontext_http_test_server:__pkg__",
38+
],
39+
deps = [
40+
":headers",
41+
"@curl",
42+
],
43+
)
44+
2345
# Internal: Detail headers for factory implementations
2446
# Used by: exporters/otlp, exporters/elasticsearch, exporters/zipkin
2547
# Breaking change in v2.0.0: moved from public to internal target
@@ -30,11 +52,10 @@ cc_library(
3052
],
3153
strip_include_prefix = "include",
3254
visibility = [
33-
"//ext/src/http/client/curl:__pkg__",
3455
"//exporters/elasticsearch:__pkg__",
35-
"//exporters/jaeger:__pkg__",
3656
"//exporters/otlp:__pkg__",
3757
"//exporters/zipkin:__pkg__",
58+
"//ext/src/http/client/curl:__pkg__",
3859
],
3960
deps = [
4061
":headers",
@@ -50,16 +71,17 @@ cc_library(
5071
"include/opentelemetry/ext/http/server/http_server.h",
5172
"include/opentelemetry/ext/http/server/socket_tools.h",
5273
],
74+
linkopts = select({
75+
"//bazel:windows": ["-DEFAULTLIB:Ws2_32.lib"],
76+
"//conditions:default": [],
77+
}),
5378
strip_include_prefix = "include",
5479
visibility = [
80+
"//examples/http:__pkg__",
81+
"//exporters/otlp:__pkg__",
5582
"//ext/test/http:__pkg__",
5683
"//ext/test/w3c_tracecontext_http_test_server:__pkg__",
57-
"//examples/http:__pkg__",
5884
],
59-
linkopts = select({
60-
"//bazel:windows": ["-DEFAULTLIB:Ws2_32.lib"],
61-
"//conditions:default": [],
62-
}),
6385
deps = [
6486
"//api",
6587
],

‎ext/src/http/client/curl/BUILD‎

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,6 @@ load("@rules_cc//cc:cc_library.bzl", "cc_library")
55

66
package(default_visibility = ["//visibility:public"])
77

8-
# Internal implementation headers for curl HTTP client
9-
# Used by: curl client implementation, internal tests, w3c test server
10-
# These are implementation details that should not be depended on by external code
11-
cc_library(
12-
name = "implementation_headers",
13-
hdrs = [
14-
"http_client_curl.h",
15-
"http_operation_curl.h",
16-
"http_time_util.h",
17-
],
18-
strip_include_prefix = ".",
19-
visibility = [
20-
":__pkg__",
21-
"//ext/src/http/client/curl:__pkg__",
22-
"//ext/test/http:__pkg__",
23-
"//ext/test/w3c_tracecontext_http_test_server:__pkg__",
24-
],
25-
linkopts = select({
26-
"//bazel:windows": ["-DEFAULTLIB:Ws2_32.lib"],
27-
"//conditions:default": [],
28-
}),
29-
deps = [
30-
"//ext:headers",
31-
"@curl//:curl",
32-
],
33-
)
34-
358
cc_library(
369
name = "http_client_curl",
3710
srcs = [
@@ -57,6 +30,7 @@ cc_library(
5730
linkstatic = True,
5831
deps = [
5932
"//api",
33+
"//ext:curl_implementation_headers",
6034
"//ext:headers",
6135
"//sdk:headers",
6236
"//sdk/src/common:random",

‎ext/test/http/BUILD‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ cc_test(
2424
defines = ["ENABLE_OTLP_RETRY_PREVIEW"],
2525
tags = ["test"],
2626
deps = [
27+
"//ext:curl_implementation_headers",
2728
"//ext:headers",
2829
"//ext:server_headers",
2930
"//ext/src/http/client/curl:http_client_curl",
30-
"//ext/src/http/client/curl:implementation_headers",
3131
"//sdk/src/trace",
3232
"@com_google_googletest//:gtest_main",
3333
"@curl",

‎ext/test/w3c_tracecontext_http_test_server/BUILD‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ cc_binary(
1919
deps = [
2020
"//api",
2121
"//exporters/ostream:ostream_span_exporter",
22+
"//ext:curl_implementation_headers",
2223
"//ext:headers",
2324
"//ext:server_headers",
2425
"//ext/src/http/client/curl:http_client_curl",
25-
"//ext/src/http/client/curl:implementation_headers",
2626
"//sdk/src/trace",
2727
"@curl",
2828
"@github_nlohmann_json//:json",

0 commit comments

Comments
 (0)