Skip to content

Commit

Permalink
Use otel_cc_library (currently just calls native.cc_library)
Browse files Browse the repository at this point in the history
  • Loading branch information
malkia committed Jul 1, 2024
1 parent 42a18ff commit 36995d0
Show file tree
Hide file tree
Showing 28 changed files with 75 additions and 74 deletions.
14 changes: 7 additions & 7 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ config_setting(
visibility = ["//visibility:public"],
)

cc_library(
otel_cc_library(
name = "windows_only",
visibility = ["//visibility:public"],
target_compatible_with = select({
Expand Down Expand Up @@ -55,7 +55,7 @@ config_setting(
# Which is then used to exclude (through dll_deps([])) the libs already linked in here.
# There are some gotchas, as ideally only libs that have dllexport symbols should be in there
# But it's impossible to know this in advance.
cc_library(
otel_cc_library(
name = "otel_sdk_deps",
visibility = ["//visibility:private"],
target_compatible_with = select({
Expand Down Expand Up @@ -90,14 +90,14 @@ cc_library(
name = "otel_sdk_all_deps_" + os,
# The crude '^//' ignores external repositories (e.g. @curl//, etc.) for which it's assumed we don't export dll symbols
# In addition we exclude some internal libraries, that may have to be relinked by tests (like //sdk/src/common:random and //sdk/src/common/platform:fork)
expression = "kind('cc_library',filter('^//',deps(//:otel_sdk_deps) except set(//:otel_sdk_deps //sdk/src/common:random //sdk/src/common/platform:fork //:windows_only " + exceptions + ")))",
expression = "kind('otel_cc_library',filter('^//',deps(//:otel_sdk_deps) except set(//:otel_sdk_deps //sdk/src/common:random //sdk/src/common/platform:fork //:windows_only " + exceptions + ")))",
scope = ["//:otel_sdk_deps"],
) for (os, exceptions) in [
("non_windows", ""),
("windows", "//exporters/etw:etw_exporter"),
]]

[cc_library(
[otel_cc_library(
name = otel_sdk_binary + "_restrict_compilation_mode",
target_compatible_with = select({
# Makes the build target compatible only with specific compilation mode, for example:
Expand All @@ -111,7 +111,7 @@ cc_library(
("otel_sdk_rd", ":reldeb"),
]]

cc_library(
otel_cc_library(
name = "api_sdk_includes",
# Almost all headers are included here, such that the compiler can notice the __declspec(dllexport) members.
visibility = ["//visibility:private"],
Expand Down Expand Up @@ -206,8 +206,8 @@ alias(
"otel_sdk_rd",
]]

# Present the import library above as cc_library so we can add headers to it, force defines, and make it public.
[cc_library(
# Present the import library above as otel_cc_library so we can add headers to it, force defines, and make it public.
[otel_cc_library(
name = otel_sdk_binary + "_dll",
implementation_deps = [
otel_sdk_binary + "_import", # The otel_sdk.dll, .lib and .pdb files
Expand Down
4 changes: 2 additions & 2 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ string_flag(
values = CPP_STDLIBS,
)

cc_library(
otel_cc_library(
name = "api",
hdrs = glob(["include/**/*.h"]),
defines = ["HAVE_ABSEIL"] + select({
Expand Down Expand Up @@ -49,7 +49,7 @@ cc_library(
],
)

cc_library(
otel_cc_library(
name = "headers",
hdrs = glob(["include/**/*.h"]),
strip_include_prefix = "include",
Expand Down
12 changes: 6 additions & 6 deletions api/test/singleton/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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 Down
2 changes: 1 addition & 1 deletion examples/common/foo_library/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ avoid_dll_lock()

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

cc_library(
otel_cc_library(
name = "common_foo_library",
srcs = [
"foo_library.cc",
Expand Down
2 changes: 1 addition & 1 deletion examples/common/logs_foo_library/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ avoid_dll_lock()

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

cc_library(
otel_cc_library(
name = "common_logs_foo_library",
srcs = [
"foo_library.cc",
Expand Down
2 changes: 1 addition & 1 deletion examples/common/metrics_foo_library/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ avoid_dll_lock()

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

cc_library(
otel_cc_library(
name = "common_metrics_foo_library",
srcs = [
"foo_library.cc",
Expand Down
6 changes: 3 additions & 3 deletions examples/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ cc_grpc_library(
deps = [":messages_cc_proto"],
)

# Ideally we should not need this proxy cc_library
# Ideally we should not need this proxy otel_cc_library
# But neither cc_proto_library nor cc_grpc_library allow for
# include_prefix, includes or strip_include_prefix right now.
cc_library(
otel_cc_library(
name = "messages_cc_grpc",
deps = [ "_messages_cc_grpc" ],
includes = ["protos"],
)

cc_library(
otel_cc_library(
name = "tracer_common",
srcs = ["tracer_common.h"],
tags = ["ostream"],
Expand Down
4 changes: 2 additions & 2 deletions exporters/elasticsearch/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ avoid_dll_lock()

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

cc_library(
otel_cc_library(
name = "es_log_record_exporter",
srcs = [
"src/es_log_record_exporter.cc",
Expand Down Expand Up @@ -54,7 +54,7 @@ cc_test(
]),
)

cc_library(
otel_cc_library(
name = "headers",
hdrs = glob(["include/**/*.h"]),
strip_include_prefix = "include",
Expand Down
4 changes: 2 additions & 2 deletions exporters/etw/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ avoid_dll_lock()

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

cc_library(
otel_cc_library(
name = "etw_exporter",
hdrs = glob([
"include/opentelemetry/exporters/etw/*.h",
Expand Down Expand Up @@ -96,7 +96,7 @@ otel_cc_benchmark(
]),
)

cc_library(
otel_cc_library(
name = "headers",
hdrs = glob(["include/**/*.h"]),
strip_include_prefix = "include",
Expand Down
6 changes: 3 additions & 3 deletions exporters/memory/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ avoid_dll_lock()

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

cc_library(
otel_cc_library(
name = "in_memory_span_data",
hdrs = [
"include/opentelemetry/exporters/memory/in_memory_data.h",
Expand Down Expand Up @@ -36,7 +36,7 @@ cc_test(
]),
)

cc_library(
otel_cc_library(
name = "in_memory_span_exporter",
srcs = [
"src/in_memory_span_exporter_factory.cc",
Expand Down Expand Up @@ -69,7 +69,7 @@ cc_test(
]),
)

cc_library(
otel_cc_library(
name = "headers",
hdrs = glob(["include/**/*.h"]),
strip_include_prefix = "include",
Expand Down
10 changes: 5 additions & 5 deletions exporters/ostream/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package(default_visibility = ["//visibility:public"])

avoid_dll_lock()

cc_library(
otel_cc_library(
name = "ostream_log_record_exporter",
srcs = [
"src/log_record_exporter.cc",
Expand Down Expand Up @@ -39,7 +39,7 @@ cc_test(
]),
)

cc_library(
otel_cc_library(
name = "ostream_metric_exporter",
srcs = [
"src/metric_exporter.cc",
Expand Down Expand Up @@ -73,7 +73,7 @@ cc_test(
]),
)

cc_library(
otel_cc_library(
name = "ostream_span_exporter",
srcs = [
"src/span_exporter.cc",
Expand All @@ -91,7 +91,7 @@ cc_library(
],
)

cc_library(
otel_cc_library(
name = "ostream_capture",
testonly = 1,
hdrs = [
Expand All @@ -117,7 +117,7 @@ cc_test(
]),
)

cc_library(
otel_cc_library(
name = "headers",
hdrs = glob(["include/**/*.h"]),
strip_include_prefix = "include",
Expand Down
Loading

0 comments on commit 36995d0

Please sign in to comment.