зеркало из https://github.com/microsoft/BuildXL.git
[.NET Core] Use native C++ SDK to talk to Aria (#558)
This commit is contained in:
Родитель
89b39394ec
Коммит
404ac852f4
|
@ -2,6 +2,6 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
module({
|
||||
name: "Aria.Cpp.SDK.osx-x64",
|
||||
name: "Aria.Cpp.SDK",
|
||||
nameResolutionSemantics: NameResolutionSemantics.implicitProjectReferences,
|
||||
});
|
|
@ -49,50 +49,36 @@ void DisposeAriaLogger(const AriaLogger *logger)
|
|||
}
|
||||
}
|
||||
|
||||
EventProperties *CreateEvent(const char *name)
|
||||
void LogEvent(const AriaLogger *logger,
|
||||
const char *eventName,
|
||||
int eventPropertiesLength,
|
||||
const AriaEventProperty *eventProperties)
|
||||
{
|
||||
return new EventProperties(name);
|
||||
}
|
||||
|
||||
void DisposeEvent(EventProperties *event)
|
||||
{
|
||||
if (event != nullptr)
|
||||
if (logger != nullptr)
|
||||
{
|
||||
delete event;
|
||||
event = nullptr;
|
||||
}
|
||||
}
|
||||
EventProperties props(eventName);
|
||||
for (int i = 0; i < eventPropertiesLength; i++)
|
||||
{
|
||||
const char *propName = eventProperties[i].name;
|
||||
const char *propValue = eventProperties[i].value;
|
||||
int64_t piiOrValue = eventProperties[i].piiOrLongValue;
|
||||
|
||||
void SetStringProperty(EventProperties *event, const char *name, const char *value)
|
||||
{
|
||||
if (event != nullptr)
|
||||
{
|
||||
event->SetProperty(name, value);
|
||||
}
|
||||
}
|
||||
if (propValue == nullptr)
|
||||
{
|
||||
props.SetProperty(propName, piiOrValue);
|
||||
}
|
||||
else if (piiOrValue == (int)PiiKind::PiiKind_None)
|
||||
{
|
||||
props.SetProperty(propName, propValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
props.SetProperty(propName, propValue, static_cast<PiiKind>(piiOrValue));
|
||||
}
|
||||
}
|
||||
|
||||
void SetStringPropertyWithPiiKind(EventProperties *event, const char *name, const char *value, int kind)
|
||||
{
|
||||
if (event != nullptr)
|
||||
{
|
||||
event->SetProperty(name, value, static_cast<PiiKind>(kind));
|
||||
}
|
||||
}
|
||||
|
||||
void SetInt64Property(EventProperties *event, const char *name, const int64_t value)
|
||||
{
|
||||
if (event != nullptr)
|
||||
{
|
||||
event->SetProperty(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
void LogEvent(const AriaLogger *logger, const EventProperties *event)
|
||||
{
|
||||
if (logger != nullptr && event != nullptr)
|
||||
{
|
||||
ILogger *log = logger->GetLogger();
|
||||
log->LogEvent(*event);
|
||||
log->LogEvent(props);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,18 +34,22 @@ public:
|
|||
ILogger *GetLogger() const;
|
||||
};
|
||||
|
||||
struct AriaEventProperty
|
||||
{
|
||||
const char *name;
|
||||
const char *value;
|
||||
int64_t piiOrLongValue;
|
||||
};
|
||||
|
||||
extern "C"
|
||||
{
|
||||
extern __cdecl AriaLogger* CreateAriaLogger(const char *, const char *);
|
||||
extern __cdecl void DisposeAriaLogger(const AriaLogger *);
|
||||
extern __cdecl void LogEvent(const AriaLogger *logger,
|
||||
const char *eventName,
|
||||
int eventPropertiesLength,
|
||||
const AriaEventProperty *eventProperties);
|
||||
|
||||
extern __cdecl EventProperties *CreateEvent(const char *);
|
||||
extern __cdecl void DisposeEvent(EventProperties *);
|
||||
|
||||
extern __cdecl void SetStringProperty(EventProperties *, const char *, const char *);
|
||||
extern __cdecl void SetStringPropertyWithPiiKind(EventProperties *, const char *, const char *, int);
|
||||
extern __cdecl void SetInt64Property(EventProperties *, const char *, const int64_t);
|
||||
extern __cdecl void LogEvent(const AriaLogger *, const EventProperties *);
|
||||
}
|
||||
|
||||
#pragma GCC visibility pop
|
||||
|
|
|
@ -81,15 +81,15 @@ namespace Sandbox {
|
|||
files: globR(d`Sandbox/Sandbox.xcodeproj`, "*")
|
||||
});
|
||||
|
||||
const ariaPkg = importFrom("Aria.Cpp.SDK.osx-x64");
|
||||
const ariaPkg = importFrom("Aria.Cpp.SDK");
|
||||
const ariaXcconfig = Transformer.writeData({
|
||||
outputPath: p`${Context.getNewOutputDirectory("xcconfig")}/Aria.xcconfig`,
|
||||
contents: {
|
||||
separator: "\n",
|
||||
contents: [
|
||||
"GCC_PREPROCESSOR_DEFINITIONS = MICROSOFT_INTERNAL",
|
||||
{ separator: "", contents: ["LIBRARY_SEARCH_PATHS = $(inherited) \"", ariaPkg.Contents.all.root, "/tools"]},
|
||||
{ separator: "", contents: ["HEADER_SEARCH_PATHS = $(inherited) \"", ariaPkg.Contents.all.root, "/tools/include"]},
|
||||
{ separator: "", contents: ["LIBRARY_SEARCH_PATHS = $(inherited) \"", ariaPkg.Contents.all.root, "/osx-x64/tools"]},
|
||||
{ separator: "", contents: ["HEADER_SEARCH_PATHS = $(inherited) \"", ariaPkg.Contents.all.root, "/osx-x64/tools/include"]},
|
||||
"OTHER_LDFLAGS = $(inherited) -laria_osx_objc_cpp"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
import * as BuildXLSdk from "Sdk.BuildXL";
|
||||
import * as Managed from "Sdk.Managed";
|
||||
import * as Deployment from "Sdk.Deployment";
|
||||
import * as Native from "Sdk.Native";
|
||||
import {Transformer} from "Sdk.Transformers";
|
||||
|
||||
namespace AriaNative {
|
||||
|
||||
export declare const qualifier: {
|
||||
configuration: "debug" | "release";
|
||||
};
|
||||
|
||||
const needNativeAria = Context.getCurrentHost().os === "win" && BuildXLSdk.Flags.isMicrosoftInternal;
|
||||
|
||||
const platform: "x86" | "x64" = "x64";
|
||||
const AriaPkg = importFrom("Aria.Cpp.SDK").withQualifier({targetFramework: "netcoreapp3.0"}).pkg;
|
||||
const WindowsSdk = importFrom("WindowsSdk").withQualifier({platform: platform});
|
||||
const VisualCpp = importFrom("VisualCpp").withQualifier({platform: platform});
|
||||
|
||||
const ariaWinIncludeDir = Transformer.sealDirectory(
|
||||
d`${AriaPkg.contents.root}/win-x64/tools/include`,
|
||||
globR(d`${AriaPkg.contents.root}/win-x64/tools/include`));
|
||||
|
||||
const native = importFrom("Sdk.Native").withQualifier({platform: platform, configuration: qualifier.configuration});
|
||||
|
||||
export const clRunnerDefaultValue = native.Templates.nativeBuildersClRunnerTemplate.merge({
|
||||
preprocessorSymbols: [],
|
||||
treatWarningAsError: false,
|
||||
warningLevel: native.Cl.ClWarningLevel.level4,
|
||||
disableSpecificWarnings: [
|
||||
4668, // not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
|
||||
4514, // unreferenced inline function has been removed
|
||||
],
|
||||
runtimeTypeInfo: false,
|
||||
});
|
||||
|
||||
export const innerTemplates = native.Templates.defaultNativeBinaryInnerTemplates.merge({clRunner: clRunnerDefaultValue});
|
||||
|
||||
export const nativeDllBuilderDefaultValue = {
|
||||
innerTemplates: innerTemplates,
|
||||
platform: platform,
|
||||
linkTimeCodeGeneration: qualifier.configuration === "release" ? native.Link.LinkTimeCodeGenerationOption.use : undefined,
|
||||
};
|
||||
|
||||
@@public
|
||||
export const dll = !needNativeAria ? undefined : native.Dll.build(nativeDllBuilderDefaultValue.merge<Native.Dll.Arguments>({
|
||||
outputFileName: a`BuildXLAria.dll`,
|
||||
preprocessorSymbols: [
|
||||
...addIf(BuildXLSdk.Flags.isMicrosoftInternal,
|
||||
{name: "MICROSOFT_INTERNAL"}
|
||||
)
|
||||
],
|
||||
|
||||
sources: [
|
||||
f`lib/AriaLogger.cpp`
|
||||
],
|
||||
|
||||
includes: [
|
||||
f`lib/AriaLogger.hpp`,
|
||||
ariaWinIncludeDir,
|
||||
WindowsSdk.UM.include,
|
||||
WindowsSdk.Shared.include,
|
||||
WindowsSdk.Ucrt.include,
|
||||
VisualCpp.include,
|
||||
],
|
||||
|
||||
exports: [
|
||||
{name: "DllMain"},
|
||||
{name: "CreateAriaLogger"},
|
||||
{name: "DisposeAriaLogger"},
|
||||
{name: "LogEvent"},
|
||||
],
|
||||
|
||||
libraries: [
|
||||
AriaPkg.contents,
|
||||
f`${AriaPkg.contents.root}/win-x64/tools/${qualifier.configuration}/ClientTelemetry.lib`,
|
||||
VisualCpp.lib,
|
||||
WindowsSdk.Ucrt.lib,
|
||||
...WindowsSdk.UM.standardLibs,
|
||||
],
|
||||
}));
|
||||
|
||||
@@public
|
||||
export const deployment: Deployment.Definition = !needNativeAria ? undefined : {
|
||||
contents: [
|
||||
{
|
||||
subfolder: PathAtom.create(platform),
|
||||
contents: [
|
||||
dll.binaryFile,
|
||||
dll.debugFile,
|
||||
f`${AriaPkg.contents.root}/win-x64/tools/${qualifier.configuration}/ClientTelemetry.lib`,
|
||||
f`${AriaPkg.contents.root}/win-x64/tools/${qualifier.configuration}/ClientTelemetry.dll`,
|
||||
f`${AriaPkg.contents.root}/win-x64/tools/${qualifier.configuration}/ClientTelemetry.pdb`,
|
||||
]
|
||||
}
|
||||
],
|
||||
};
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#include "AriaLogger.hpp"
|
||||
|
||||
#ifdef MICROSOFT_INTERNAL // Only needed for internal builds
|
||||
|
||||
LOGMANAGER_INSTANCE
|
||||
|
||||
//// Aria logger class definition
|
||||
|
||||
AriaLogger::AriaLogger(const char* token, const char *dbPath)
|
||||
{
|
||||
token_ = token;
|
||||
dbPath_ = dbPath;
|
||||
|
||||
auto& config = LogManager::GetLogConfiguration();
|
||||
config[CFG_INT_MAX_TEARDOWN_TIME] = 15;
|
||||
// config[CFG_STR_CACHE_FILE_PATH] = dbPath; // not necessary
|
||||
|
||||
logger_ = LogManager::Initialize(token);
|
||||
LogManager::SetTransmitProfile(TransmitProfile_NearRealTime);
|
||||
}
|
||||
|
||||
AriaLogger::~AriaLogger()
|
||||
{
|
||||
LogManager::FlushAndTeardown();
|
||||
}
|
||||
|
||||
ILogger *AriaLogger::GetLogger() const
|
||||
{
|
||||
return logger_;
|
||||
};
|
||||
|
||||
//// External Interface
|
||||
|
||||
AriaLogger* WINAPI CreateAriaLogger(const char *token, const char *dbPath)
|
||||
{
|
||||
AriaLogger *arl = new AriaLogger(token, dbPath);
|
||||
return arl;
|
||||
}
|
||||
|
||||
void WINAPI DisposeAriaLogger(const AriaLogger *logger)
|
||||
{
|
||||
if (logger != nullptr)
|
||||
{
|
||||
delete logger;
|
||||
}
|
||||
}
|
||||
|
||||
void WINAPI LogEvent(const AriaLogger *logger, const char *eventName, int eventPropertiesLength, const AriaEventProperty *eventProperties)
|
||||
{
|
||||
if (logger != nullptr)
|
||||
{
|
||||
EventProperties props;
|
||||
props.SetName(eventName);
|
||||
for (int i = 0; i < eventPropertiesLength; i++)
|
||||
{
|
||||
const char *propName = eventProperties[i].name;
|
||||
const char *propValue = eventProperties[i].value;
|
||||
int64_t piiOrValue = eventProperties[i].piiOrLongValue;
|
||||
|
||||
if (propValue == nullptr)
|
||||
{
|
||||
props.SetProperty(propName, piiOrValue);
|
||||
}
|
||||
else if (piiOrValue == (int)PiiKind::PiiKind_None)
|
||||
{
|
||||
props.SetProperty(propName, propValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
props.SetProperty(propName, propValue, static_cast<PiiKind>(piiOrValue));
|
||||
}
|
||||
}
|
||||
|
||||
ILogger *log = logger->GetLogger();
|
||||
log->LogEvent(props);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,50 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#ifndef AriaLogger_
|
||||
#define AriaLogger_
|
||||
|
||||
#ifdef MICROSOFT_INTERNAL // Only needed for internal builds
|
||||
|
||||
#include "LogManager.hpp"
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
using namespace MAT;
|
||||
|
||||
class AriaLogger
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
std::string token_;
|
||||
std::string dbPath_;
|
||||
|
||||
ILogger *logger_;
|
||||
|
||||
public:
|
||||
|
||||
AriaLogger() = delete;
|
||||
AriaLogger(const char* token, const char *dbPath);
|
||||
|
||||
~AriaLogger();
|
||||
|
||||
ILogger *GetLogger() const;
|
||||
};
|
||||
|
||||
struct AriaEventProperty
|
||||
{
|
||||
const char *name;
|
||||
const char *value;
|
||||
int64_t piiOrLongValue;
|
||||
};
|
||||
|
||||
int WINAPI Get42();
|
||||
|
||||
AriaLogger* WINAPI CreateAriaLogger(const char *, const char *);
|
||||
void WINAPI DisposeAriaLogger(const AriaLogger *);
|
||||
|
||||
void WINAPI LogEvent(const AriaLogger *logger, const char *eventName, int eventPropertiesLength, const AriaEventProperty *eventProperties);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -3,6 +3,7 @@
|
|||
#if FEATURE_ARIA_TELEMETRY
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !FEATURE_CORECLR
|
||||
using Microsoft.Applications.Telemetry;
|
||||
using Microsoft.Applications.Telemetry.Desktop;
|
||||
|
@ -17,6 +18,9 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
/// </summary>
|
||||
public enum PiiType
|
||||
{
|
||||
/// <nodoc />
|
||||
None = 0,
|
||||
|
||||
/// <nodoc />
|
||||
Identity = 10,
|
||||
}
|
||||
|
@ -36,10 +40,9 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
#if !FEATURE_CORECLR
|
||||
private EventProperties m_eventProperties;
|
||||
#else
|
||||
#if PLATFORM_OSX
|
||||
private IntPtr m_eventProperties;
|
||||
#endif
|
||||
private List<AriaNative.EventProperty> m_eventProperties;
|
||||
#endif
|
||||
private readonly string m_eventName;
|
||||
private readonly string m_targetFramework;
|
||||
private readonly string m_targetRuntime;
|
||||
|
||||
|
@ -51,15 +54,14 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
/// <param name="targetRuntime">TThe target runtime to create the Aria logging facilities for</param>
|
||||
public AriaEvent(string name, string targetFramework, string targetRuntime)
|
||||
{
|
||||
m_eventName = name;
|
||||
m_targetFramework = targetFramework;
|
||||
m_targetRuntime = targetRuntime;
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
m_eventProperties = new EventProperties(name);
|
||||
#else
|
||||
#if PLATFORM_OSX
|
||||
m_eventProperties = AriaMacOS.CreateEvent(name);
|
||||
#endif
|
||||
m_eventProperties = new List<AriaNative.EventProperty>();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -73,9 +75,12 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
#if !FEATURE_CORECLR
|
||||
m_eventProperties.SetProperty(name, value);
|
||||
#else
|
||||
#if PLATFORM_OSX
|
||||
AriaMacOS.SetStringProperty(m_eventProperties, name, value);
|
||||
#endif
|
||||
m_eventProperties.Add(new AriaNative.EventProperty()
|
||||
{
|
||||
Name = name,
|
||||
Value = value ?? string.Empty,
|
||||
PiiOrValue = (long)PiiType.None
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -90,9 +95,12 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
#if !FEATURE_CORECLR
|
||||
m_eventProperties.SetProperty(name, value, ConvertPiiType(type));
|
||||
#else
|
||||
#if PLATFORM_OSX
|
||||
AriaMacOS.SetStringPropertyWithPiiKind(m_eventProperties, name, value, (int) type);
|
||||
#endif
|
||||
m_eventProperties.Add(new AriaNative.EventProperty()
|
||||
{
|
||||
Name = name,
|
||||
Value = value ?? string.Empty,
|
||||
PiiOrValue = (long)type
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -106,9 +114,12 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
#if !FEATURE_CORECLR
|
||||
m_eventProperties.SetProperty(name, value);
|
||||
#else
|
||||
#if PLATFORM_OSX
|
||||
AriaMacOS.SetInt64Property(m_eventProperties, name, value);
|
||||
#endif
|
||||
m_eventProperties.Add(new AriaNative.EventProperty()
|
||||
{
|
||||
Name = name,
|
||||
Value = null,
|
||||
PiiOrValue = value
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -120,13 +131,8 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
#if !FEATURE_CORECLR
|
||||
LogManager.GetLogger().LogEvent(m_eventProperties);
|
||||
#else
|
||||
#if PLATFORM_OSX
|
||||
AriaMacOS.LogEvent(AriaV2StaticState.s_AriaLogger, m_eventProperties);
|
||||
|
||||
// Free the native Aria event
|
||||
AriaMacOS.DisposeEvent(m_eventProperties);
|
||||
m_eventProperties = IntPtr.Zero;
|
||||
#endif
|
||||
AriaNative.LogEvent(AriaV2StaticState.s_AriaLogger, m_eventName, m_eventProperties.ToArray());
|
||||
m_eventProperties = null;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#if FEATURE_ARIA_TELEMETRY
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace BuildXL.Utilities.Instrumentation.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This class offers interop calls for remote telemetry stream reporting via the Aria C++ SDK on macOS
|
||||
/// </summary>
|
||||
public static class AriaMacOS
|
||||
{
|
||||
private const string AriaLibMacOS = "libBuildXLAria";
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibMacOS)]
|
||||
public static extern IntPtr CreateAriaLogger(string token, string db);
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibMacOS)]
|
||||
static public extern void DisposeAriaLogger(IntPtr logger);
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibMacOS)]
|
||||
static public extern IntPtr CreateEvent(string name);
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibMacOS)]
|
||||
static public extern void DisposeEvent(IntPtr event_);
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibMacOS)]
|
||||
static public extern void SetStringProperty(IntPtr event_, string name, string value);
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibMacOS)]
|
||||
static public extern void SetStringPropertyWithPiiKind(IntPtr event_, string name, string value, int pii);
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibMacOS)]
|
||||
static public extern void SetInt64Property(IntPtr event_, string name, long value);
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibMacOS)]
|
||||
static public extern void LogEvent(IntPtr logger, IntPtr event_);
|
||||
}
|
||||
}
|
||||
#endif //FEATURE_ARIA_TELEMETRY
|
|
@ -0,0 +1,63 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BuildXL.Utilities.Instrumentation.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This class offers interop calls for remote telemetry stream reporting via the Aria C++ SDK
|
||||
/// </summary>
|
||||
public static class AriaNative
|
||||
{
|
||||
#if PLATFORM_OSX
|
||||
private const string AriaLibName = "libBuildXLAria";
|
||||
#else
|
||||
private const string AriaLibName = "x64\\BuildXLAria";
|
||||
#endif
|
||||
|
||||
/// <nodoc />
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct EventProperty
|
||||
{
|
||||
/// <nodoc />
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string Name;
|
||||
|
||||
/// <nodoc />
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string Value;
|
||||
|
||||
/// <nodoc />
|
||||
public long PiiOrValue;
|
||||
}
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibName)]
|
||||
public static extern int Get42();
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibName)]
|
||||
public static extern IntPtr CreateAriaLogger(
|
||||
[MarshalAs(UnmanagedType.LPStr)] string token,
|
||||
[MarshalAs(UnmanagedType.LPStr)] string db);
|
||||
|
||||
/// <nodoc />
|
||||
[DllImport(AriaLibName)]
|
||||
static public extern void DisposeAriaLogger(IntPtr logger);
|
||||
|
||||
/// <nodoc />
|
||||
public static void LogEvent(IntPtr logger, string eventName, EventProperty[] eventProperties)
|
||||
{
|
||||
ExternLogEvent(logger, eventName, eventProperties.Length, eventProperties);
|
||||
}
|
||||
|
||||
[DllImport(AriaLibName, EntryPoint = "LogEvent")]
|
||||
private static extern void ExternLogEvent(
|
||||
IntPtr logger,
|
||||
[MarshalAs(UnmanagedType.LPStr)] string eventName,
|
||||
int eventPropertiesLength,
|
||||
[MarshalAs(UnmanagedType.LPArray)] EventProperty[] eventProperties);
|
||||
}
|
||||
}
|
|
@ -6,11 +6,9 @@ using System.Diagnostics.ContractsLight;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#if PLATFORM_OSX
|
||||
using System.IO;
|
||||
#endif
|
||||
|
||||
// TODO: use AriaNative for full framework builds as well
|
||||
#if FEATURE_ARIA_TELEMETRY
|
||||
#if !FEATURE_CORECLR
|
||||
using Microsoft.Applications.Telemetry;
|
||||
|
@ -36,11 +34,9 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
|
||||
#if FEATURE_ARIA_TELEMETRY
|
||||
#if FEATURE_CORECLR
|
||||
#if PLATFORM_OSX
|
||||
internal static IntPtr s_AriaLogger;
|
||||
private static readonly string s_ariaTelemetryDBName = "Aria.db";
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
@ -85,7 +81,6 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
|
||||
LogManager.Initialize(tenantToken, configuration);
|
||||
#else
|
||||
#if PLATFORM_OSX
|
||||
Contract.Requires(s_ariaTelemetryDBLocation != null);
|
||||
if (s_ariaTelemetryDBLocation.Length > 0 && !Directory.Exists(s_ariaTelemetryDBLocation))
|
||||
{
|
||||
|
@ -94,8 +89,7 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
|
||||
// s_ariaTelemetryDBLocation is defaulting to an empty string when not passed when enabling telemetry, in that case
|
||||
// this causes the DB to be created in the current working directory of the process
|
||||
s_AriaLogger = AriaMacOS.CreateAriaLogger(tenantToken, System.IO.Path.Combine(s_ariaTelemetryDBLocation, s_ariaTelemetryDBName));
|
||||
#endif
|
||||
s_AriaLogger = AriaNative.CreateAriaLogger(tenantToken, System.IO.Path.Combine(s_ariaTelemetryDBLocation, s_ariaTelemetryDBName));
|
||||
#endif
|
||||
#endif
|
||||
s_hasBeenInitialized = true;
|
||||
|
@ -134,11 +128,9 @@ namespace BuildXL.Utilities.Instrumentation.Common
|
|||
#if !FEATURE_CORECLR
|
||||
LogManager.FlushAndTearDown();
|
||||
#else
|
||||
#if PLATFORM_OSX
|
||||
AriaMacOS.DisposeAriaLogger(s_AriaLogger);
|
||||
AriaNative.DisposeAriaLogger(s_AriaLogger);
|
||||
s_AriaLogger = IntPtr.Zero;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
shutDownResult = ShutDownResult.Success;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
import * as BuildXLSdk from "Sdk.BuildXL";
|
||||
import * as Managed from "Sdk.Managed";
|
||||
import * as MacServices from "BuildXL.Sandbox.MacOS";
|
||||
|
||||
namespace Common {
|
||||
|
@ -21,6 +22,9 @@ namespace Common {
|
|||
...addIfLazy(MacServices.Deployment.macBinaryUsage !== "none" && qualifier.targetRuntime === "osx-x64", () => [
|
||||
MacServices.Deployment.ariaLibrary
|
||||
]),
|
||||
...addIfLazy(qualifier.targetRuntime === "win-x64", () => [
|
||||
AriaNative.deployment
|
||||
]),
|
||||
],
|
||||
internalsVisibleTo: [
|
||||
"IntegrationTest.BuildXL.Scheduler",
|
||||
|
|
|
@ -15,8 +15,8 @@ export const pkgs = isMicrosoftInternal ? [
|
|||
{ id: "Microsoft.Applications.Telemetry.Desktop", version: "1.1.152" },
|
||||
|
||||
// Runtime dependencies used for macOS deployments
|
||||
{ id: "runtime.osx-x64.BuildXL", version: "1.94.99" },
|
||||
{ id: "Aria.Cpp.SDK.osx-x64", version: "8.5.4" },
|
||||
{ id: "runtime.osx-x64.BuildXL", version: "1.95.99" },
|
||||
{ id: "Aria.Cpp.SDK", version: "8.5.6" },
|
||||
|
||||
{ id: "CB.QTest", version: "19.6.25.1151" },
|
||||
{ id: "CloudBuild.VmCommandProxy", version: "19.6.30.150829" },
|
||||
|
|
Загрузка…
Ссылка в новой задаче