Skip to content

Commit

Permalink
switch all cc_ build rules to otel_cc_ ones
Browse files Browse the repository at this point in the history
  • Loading branch information
malkia committed Jul 2, 2024
1 parent 99fb2da commit b6d8202
Show file tree
Hide file tree
Showing 64 changed files with 270 additions and 215 deletions.
18 changes: 9 additions & 9 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ load("@bazel_skylib//rules:run_binary.bzl", "run_binary")
load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files", pkg_strip_prefix = "strip_prefix")
load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
load("dll_deps.bzl", "force_compilation_mode")
load("//bazel:otel_cc_library.bzl", "otel_cc_library")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

bool_flag(
name = "with_dll",
Expand Down Expand Up @@ -128,7 +128,7 @@ otel_cc_library(
)

# Conveniently place all Open Telemetry C++ dependencies required to build otel_sdk
[cc_shared_library(
[otel_cc_shared_library(
name = otel_sdk_binary,
# Force generation of .pdb file for for opt builds
features = [
Expand All @@ -143,10 +143,10 @@ otel_cc_library(
"//conditions:default": ["@platforms//:incompatible"],
}),
# TODO: Add more missing headers to api_sdk_includes above and we'll no longer need /WHOLEARCHIVE
user_link_flags = select({
"@@platforms//os:windows": ["/WHOLEARCHIVE"],
"//conditions:default": ["--whole-archive"],
}),
# user_link_flags = select({
# "@@platforms//os:windows": ["/WHOLEARCHIVE"],
# "//conditions:default": ["--whole-archive"],
# }),
visibility = ["//visibility:private"],
deps = [
otel_sdk_binary + "_restrict_compilation_mode",
Expand Down Expand Up @@ -194,7 +194,7 @@ alias(
]]

# Import the otel_sdk.dll, and the two exposed otel_sdk.lib and otel_sdk.pdb files as one target
[cc_import(
[otel_cc_import(
name = otel_sdk_binary + "_import",
data = [otel_sdk_binary + "_pdb_file"],
interface_library = otel_sdk_binary + "_lib_file",
Expand Down Expand Up @@ -245,7 +245,7 @@ alias(
visibility = ["//visibility:public"],
)

cc_test(
otel_cc_test(
name = "dll_test",
srcs = ["dll_test.cc"],
deps = ["dll"],
Expand Down Expand Up @@ -400,7 +400,7 @@ write_source_file(
tags = ["manual"],
)

[cc_binary(
[otel_cc_binary(
name = "dll_deps_update_binary_" + os,
srcs = ["dll_deps_update.cc"],
data = ["otel_sdk_all_deps_" + os],
Expand Down
2 changes: 1 addition & 1 deletion api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")
load("//bazel:otel_cc_library.bzl", "otel_cc_library")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

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

Expand Down
3 changes: 2 additions & 1 deletion api/test/baggage/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("//:dll_deps.bzl", "dll_deps", "avoid_dll_lock")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

cc_test(
otel_cc_test(
name = "baggage_test",
srcs = [
"baggage_test.cc",
Expand Down
3 changes: 2 additions & 1 deletion api/test/baggage/propagation/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("//:dll_deps.bzl", "dll_deps", "avoid_dll_lock")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

cc_test(
otel_cc_test(
name = "baggage_propagator_test",
srcs = [
"baggage_propagator_test.cc",
Expand Down
5 changes: 3 additions & 2 deletions api/test/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("//:dll_deps.bzl", "dll_deps", "avoid_dll_lock")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

Expand All @@ -17,7 +18,7 @@ otel_cc_benchmark(
deps = dll_deps(["//api"]),
)

cc_test(
otel_cc_test(
name = "kv_properties_test",
srcs = [
"kv_properties_test.cc",
Expand All @@ -32,7 +33,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "string_util_test",
srcs = [
"string_util_test.cc",
Expand Down
5 changes: 3 additions & 2 deletions api/test/context/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("//:dll_deps.bzl", "dll_deps", "avoid_dll_lock")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

cc_test(
otel_cc_test(
name = "context_test",
srcs = [
"context_test.cc",
Expand All @@ -21,7 +22,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "runtime_context_test",
srcs = [
"runtime_context_test.cc",
Expand Down
3 changes: 2 additions & 1 deletion api/test/context/propagation/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")
load("//:dll_deps.bzl", "dll_deps", "avoid_dll_lock")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

cc_test(
otel_cc_test(
name = "composite_propagator_test",
srcs = [
"composite_propagator_test.cc",
Expand Down
5 changes: 3 additions & 2 deletions api/test/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# SPDX-License-Identifier: Apache-2.0

load("//:dll_deps.bzl", "dll_deps", "avoid_dll_lock")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

cc_test(
otel_cc_test(
name = "timestamp_test",
srcs = [
"timestamp_test.cc",
Expand All @@ -20,7 +21,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "version_test",
srcs = [
"version_test.cc",
Expand Down
5 changes: 3 additions & 2 deletions api/test/logs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# SPDX-License-Identifier: Apache-2.0

load("//:dll_deps.bzl", "dll_deps", "avoid_dll_lock")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

cc_test(
otel_cc_test(
name = "provider_test",
srcs = [
"provider_test.cc",
Expand All @@ -21,7 +22,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "logger_test",
srcs = [
"logger_test.cc",
Expand Down
5 changes: 3 additions & 2 deletions api/test/metrics/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# SPDX-License-Identifier: Apache-2.0

load("//:dll_deps.bzl", "dll_deps", "avoid_dll_lock")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

cc_test(
otel_cc_test(
name = "noop_sync_instrument_test",
srcs = [
"noop_sync_instrument_test.cc",
Expand All @@ -20,7 +21,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "meter_provider_test",
srcs = [
"meter_provider_test.cc",
Expand Down
15 changes: 8 additions & 7 deletions api/test/nostd/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# SPDX-License-Identifier: Apache-2.0

load("//:dll_deps.bzl", "dll_deps", "avoid_dll_lock")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

cc_test(
otel_cc_test(
name = "function_ref_test",
srcs = [
"function_ref_test.cc",
Expand All @@ -20,7 +21,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "string_view_test",
srcs = [
"string_view_test.cc",
Expand All @@ -35,7 +36,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "variant_test",
srcs = [
"variant_test.cc",
Expand All @@ -50,7 +51,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "unique_ptr_test",
srcs = [
"unique_ptr_test.cc",
Expand All @@ -65,7 +66,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "utility_test",
srcs = [
"utility_test.cc",
Expand All @@ -80,7 +81,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "span_test",
srcs = [
"span_test.cc",
Expand All @@ -95,7 +96,7 @@ cc_test(
]),
)

cc_test(
otel_cc_test(
name = "shared_ptr_test",
srcs = [
"shared_ptr_test.cc",
Expand Down
3 changes: 2 additions & 1 deletion api/test/plugin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# SPDX-License-Identifier: Apache-2.0

load("//:dll_deps.bzl", "dll_deps", "avoid_dll_lock")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

cc_test(
otel_cc_test(
name = "dynamic_load_test",
srcs = [
"dynamic_load_test.cc",
Expand Down
24 changes: 12 additions & 12 deletions api/test/singleton/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

load("//:dll_deps.bzl", "avoid_dll_lock", "dll_deps")
# load("//bazel:otel_cc_library.bzl", "otel_cc_library")
load("//bazel:otel_cc.bzl", "otel_cc_library", "otel_cc_binary", "otel_cc_test", "otel_cc_import", "otel_cc_shared_library")

avoid_dll_lock()

Expand All @@ -22,7 +22,7 @@ HIDDEN_NOWIN_COPTS = [
"-fvisibility=hidden",
]

cc_library(
otel_cc_library(
name = "component_a",
srcs = [
"component_a.cc",
Expand All @@ -36,7 +36,7 @@ cc_library(
]),
)

cc_library(
otel_cc_library(
name = "component_b",
srcs = [
"component_b.cc",
Expand All @@ -50,7 +50,7 @@ cc_library(
]),
)

cc_library(
otel_cc_library(
name = "component_c",
srcs = [
"component_c.cc",
Expand All @@ -68,7 +68,7 @@ cc_library(
]),
)

cc_library(
otel_cc_library(
name = "component_d",
srcs = [
"component_d.cc",
Expand All @@ -86,7 +86,7 @@ cc_library(
]),
)

cc_library(
otel_cc_library(
name = "component_e",
srcs = [
"component_e.cc",
Expand All @@ -104,7 +104,7 @@ cc_library(
]),
)

cc_library(
otel_cc_library(
name = "component_f",
srcs = [
"component_f.cc",
Expand All @@ -122,8 +122,8 @@ cc_library(
]),
)

# no cc_shared_library in bazel 4.2
cc_binary(
# no otel_cc_shared_library in bazel 4.2
otel_cc_binary(
name = "component_g",
srcs = [
"component_g.cc",
Expand All @@ -138,8 +138,8 @@ cc_binary(
]),
)

# no cc_shared_library in bazel 4.2
cc_binary(
# no otel_cc_shared_library in bazel 4.2
otel_cc_binary(
name = "component_h",
srcs = [
"component_h.cc",
Expand Down Expand Up @@ -167,7 +167,7 @@ cc_binary(
# bazel test //api/test/singleton:singleton_test
#

cc_test(
otel_cc_test(
name = "singleton_test",
srcs = [
"singleton_test.cc",
Expand Down
Loading

0 comments on commit b6d8202

Please sign in to comment.