From 7c6b9dbcaf43af9a281029121392aef31445b770 Mon Sep 17 00:00:00 2001 From: Carbo Kuo Date: Tue, 6 Aug 2024 13:43:02 -0400 Subject: [PATCH] [BUILD] Add abi_version_no bazel flag. (#3020) --- api/BUILD | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/api/BUILD b/api/BUILD index fdfe3ca146..dfc7d3c645 100644 --- a/api/BUILD +++ b/api/BUILD @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag") +load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "int_flag", "string_flag") package(default_visibility = ["//visibility:public"]) @@ -35,6 +35,9 @@ cc_library( ":set_cxx_stdlib_2020": ["OPENTELEMETRY_STL_VERSION=2020"], ":set_cxx_stdlib_2023": ["OPENTELEMETRY_STL_VERSION=2023"], "//conditions:default": [], + }) + select({ + ":abi_version_no_1": ["OPENTELEMETRY_ABI_VERSION_NO=1"], + ":abi_version_no_2": ["OPENTELEMETRY_ABI_VERSION_NO=2"], }), strip_include_prefix = "include", tags = ["api"], @@ -61,3 +64,18 @@ bool_flag( build_setting_default = False, deprecation = "The value of this flag is ignored. Bazel builds always depend on Abseil for its pre-adopted `std::` types. You should remove this flag from your build command.", ) + +int_flag( + name = "abi_version_no", + build_setting_default = 1, +) + +config_setting( + name = "abi_version_no_1", + flag_values = {":abi_version_no": "1"}, +) + +config_setting( + name = "abi_version_no_2", + flag_values = {":abi_version_no": "2"}, +)