Skip to content

Commit

Permalink
Tentative cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Mar 26, 2024
1 parent fe80b67 commit 9273459
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 18 deletions.
56 changes: 40 additions & 16 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,29 @@ load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")

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

bool_flag(
name = "with_abseil",
build_setting_default = False,
)
#
# Important note
# the boolean flag "with_abseil" is no longer supported,
# because with_abseil is no longer optional.
#
# Unlike CMake, the bazel build has no option to only select a few exporters,
# so it builds all the exporters available.
#
# The OTLP exporter depends on protobuf,
# and protobuf has a mandatory dependency on abseil starting
# with protobuf 3.22
#
# See in CMake:
# "Protobuf 3.22 or upper require abseil-cpp(Recommended version: 20230125 or upper)"
#
# Since building with abseil is mandatory with bazel,
# the bazel option "with_abseil" is now removed.
#

## bool_flag(
## name = "with_abseil",
## build_setting_default = False,
## )

CPP_STDLIBS = [
"none",
Expand Down Expand Up @@ -46,20 +65,25 @@ cc_library(
}),
strip_include_prefix = "include",
tags = ["api"],
deps = select({
":with_external_abseil": [
"@com_google_absl//absl/base",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:variant",
],
"//conditions:default": [],
}),
deps = [
"@com_google_absl//absl/base",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:variant",
],
## deps = select({
## ":with_external_abseil": [
## "@com_google_absl//absl/base",
## "@com_google_absl//absl/strings",
## "@com_google_absl//absl/types:variant",
## ],
## "//conditions:default": [],
## }),
)

config_setting(
name = "with_external_abseil",
flag_values = {":with_abseil": "true"},
)
## config_setting(
## name = "with_external_abseil",
## flag_values = {":with_abseil": "true"},
## )

[config_setting(
name = "set_cxx_stdlib_%s" % v,
Expand Down
5 changes: 3 additions & 2 deletions api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ if(WITH_NO_DEPRECATED_CODE)
endif()

if(WITH_ABSEIL)
target_compile_definitions(opentelemetry_api INTERFACE OPENTELEMETRY_HAVE_ABSEIL)
target_compile_definitions(opentelemetry_api
INTERFACE OPENTELEMETRY_HAVE_ABSEIL)
target_link_libraries(
opentelemetry_api INTERFACE absl::bad_variant_access absl::any absl::base
absl::bits absl::city)
list(APPEND TARGET_DEPS "absl_bad_variant_access" "absl_any absl_base"
list(APPEND TARGET_DEPS "absl_bad_variant_access" "absl_any" "absl_base"
"absl_bits" "absl_city")
endif()

Expand Down

0 comments on commit 9273459

Please sign in to comment.