OpenTelemetry ApiView fix (#3784)

This commit is contained in:
Anton Kolesnyk 2022-06-30 14:19:11 -07:00 committed by GitHub
parent dc04b2410e
commit ee36dd3abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 0 deletions

View File

@ -50,4 +50,9 @@ foreach ($incDir in $AllLibIncDirs) {
$CmdLine += " -I " + $incDir
}
# Define an _azure_APIVIEW macro so that the public headers that depend on 3rd party headers apply a work around
# for declaring 3rd party dependencies in a minimalistic way that is sufficient for the ApiView generation.
# Otherwise, ApiView would've been including 3rd party types for review, which is not what we want.
$CmdLine += " -D_azure_APIVIEW"
$CmdLine

View File

@ -40,6 +40,7 @@ if (BUILD_AZURE_CORE_TRACING_OPENTELEMETRY)
set(
AZURE_CORE_OPENTELEMETRY_HEADER
inc/azure/core/tracing/opentelemetry/internal/apiview.hpp
inc/azure/core/tracing/opentelemetry/opentelemetry.hpp
src/opentelemetry_private.hpp
)

View File

@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
#pragma once
// This file is supposed to be included only when generating files for ApiView.
// All the declarations here are only sufficient for the ApiView generation to not fail.
namespace opentelemetry {
namespace nostd {
template <typename> struct shared_ptr
{
};
} // namespace nostd
namespace trace {
struct TracerProvider;
struct Provider
{
static nostd::shared_ptr<TracerProvider> GetTracerProvider();
};
} // namespace trace
} // namespace opentelemetry

View File

@ -4,6 +4,10 @@
#pragma once
#include <azure/core/tracing/tracing.hpp>
#if defined(_azure_APIVIEW)
#include "azure/core/tracing/opentelemetry/internal/apiview.hpp"
#else
#if defined(_MSC_VER)
// The OpenTelemetry headers generate a couple of warnings on MSVC in the OTel 1.2 package, suppress
// the warnings across the includes.
@ -17,6 +21,7 @@
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif
namespace Azure { namespace Core { namespace Tracing { namespace OpenTelemetry {