Merged PR 751951: Clean LogGen reference

This pr cleans the reference of LogGen. BuildXLSdk will not add BuildXL.Tracing reference for generateLog.
Add an arg to control AriaCommon reference for LogGen. LogGen don't need AriaCommon if generate local only logger.
This commit is contained in:
Qi Wang 2023-11-16 23:30:58 +00:00
Родитель 6615870ab8
Коммит 36b72c7965
38 изменённых файлов: 33 добавлений и 64 удалений

Просмотреть файл

@ -56,6 +56,9 @@ export interface Arguments extends Managed.Arguments {
/** Whether to run LogGen. */
generateLogs?: boolean;
/** Whether to exclude BuildXL.Tracing reference for LogGen. */
excludeTracing?: boolean;
/** Whether to generate logs during the compilation process. */
generateLogsInProc?: boolean;
@ -703,8 +706,8 @@ function processArguments(args: Arguments, targetType: Csc.TargetType) : Argumen
...(isDotNetCoreOrStandard ? [] : [
NetFx.System.Threading.Tasks.dll,
]),
...(args.generateLogs || args.generateLogsInProc ? [
importFrom("BuildXL.Utilities.Instrumentation").Tracing.dll
...((args.generateLogs || args.generateLogsInProc) && !args.excludeTracing ? [
importFrom("BuildXL.Utilities.Instrumentation").Tracing.dll,
] : []),
]),
],
@ -764,10 +767,10 @@ function processArguments(args: Arguments, targetType: Csc.TargetType) : Argumen
...Managed.Helpers.computeCompileClosure(framework, framework.standardReferences),
] : [
importFrom("BuildXL.Utilities").Utilities.Core.dll.compile,
importFrom("BuildXL.Utilities.Instrumentation").Tracing.dll.compile,
...addIf(!args.excludeTracing, importFrom("BuildXL.Utilities.Instrumentation").Tracing.dll.compile),
...Managed.Helpers.computeCompileClosure(framework, framework.standardReferences),
];
if (args.generateLogs) {
// $TODO: We have some ugglyness here in that there is not a good way to do a 'under' path check from the sdk
// without the caller passing in the path. BuildXL.Tracing doesn't follow the proper loggen pattern either with

Просмотреть файл

@ -7,7 +7,6 @@ using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.IO;
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Configuration;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -29,7 +29,7 @@ namespace BuildXL.ConsoleRedirector.Tracing
/// </summary>
[GeneratedEvent(
(ushort)LogEventId.LogToConsole,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Informational,
EventTask = (ushort)Tasks.Unclassified,
Message = "{text}")]

Просмотреть файл

@ -662,7 +662,7 @@ namespace NugetPackages {
// NOTE: utilitiesCore, native, processes, and processesLinux have a restricted set of dependencies.
// Do not modify its set of allowed dependencies without first consulting with the BuildXL team.
const utilitiesCore = Nuget.packAssembliesAndAssertDependencies(utilitiesCoreSpecification, packageSpecifications, packageBranding, /* inferInternalDependencies */ true, /* dependencyScope */ []);
const native = Nuget.packAssembliesAndAssertDependencies(nativeSpecification, packageSpecifications, packageBranding, /* inferInternalDependencies */ false,/* dependencyScope */ [buildXLUtilitiesCoreIdentity]);
const native = Nuget.packAssembliesAndAssertDependencies(nativeSpecification, packageSpecifications, packageBranding, /* inferInternalDependencies */ true,/* dependencyScope */ [buildXLUtilitiesCoreIdentity]);
const pips = Nuget.packAssemblies(pipsSpecification, packageSpecifications, packageBranding, /* inferInternalDependencies */ false);
const processes = Nuget.packAssembliesAndAssertDependencies(processesSpecification, packageSpecifications, packageBranding, /* inferInternalDependencies */ false, /* dependencyScope */ [buildXLUtilitiesCoreIdentity, buildXLNativeIdentity]);
const processesLinux = Nuget.packAssembliesAndAssertDependencies(processesLinuxSpecification, packageSpecifications, packageBranding, /* inferInternalDependencies */ false, /* dependencyScope */ [buildXLUtilitiesCoreIdentity, buildXLNativeIdentity]);

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
using LogEventId = BuildXL.Processes.Tracing.LogEventId;

Просмотреть файл

@ -1,6 +1,5 @@
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -3,7 +3,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
// Suppress missing XML comments on publicly visible types or members

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT License.
using System.Diagnostics.CodeAnalysis;
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;
@ -27,7 +26,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.ScriptDebugLog,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Informational,
EventTask = (ushort)Tasks.Parser,
Message = "{message}",
@ -36,7 +35,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.PackageDescriptorsIsNotArrayLiteral,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = "Package descriptors in '{packageDescriptorPath}' does not evaluate to an array literal.",
@ -45,7 +44,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.PackageDescriptorIsNotObjectLiteral,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = "Package descriptor '{number}' in '{packageDescriptorPath}' does not evaluate to an object literal.",
@ -54,7 +53,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.PackageMainFileIsNotInTheSameDirectoryAsPackageConfiguration,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = "Package main file '{packageMainFile}' is not in the same directory as package configuration '{packageConfiguration}'.",
@ -63,7 +62,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.FailAddingPackageDueToPackageOwningAllProjectsExists,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = "Failed adding package '{addedPackage}' in '{packageConfigPath}' because a package, '{packageOwningAll}', that owns all projects exists. When defining multiple packages in a single package configuration file, none of them may implicitly own all projects (by omitting to specify the 'projects' field).",
@ -72,7 +71,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.FailAddingPackageBecauseItWantsToOwnAllProjectsButSomeAreOwnedByOtherPackages,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = "Failed adding package '{addedPackage}' in '{packageConfigPath}' because the package wants to own all projects, but some of them are owned by other existing packages. When defining multiple packages in a single package configuration file, none of them may implicitly own all projects (by omitting to specify the 'projects' field).",
@ -81,7 +80,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.FailAddingPackageBecauseItsProjectIsOwnedByAnotherPackage,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = "Failed adding package '{addedPackage}' in '{packageConfigPath}' because its project '{projectPath}' is owned by another package '{anotherPackage}'.",
@ -90,7 +89,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.ConversionException,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = EventConstants.LabeledProvenancePrefix + "{exceptionMessage}.",
@ -99,7 +98,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.UnexpectedResolverException,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = EventConstants.LabeledProvenancePrefix + "Unexpected exception: {exceptionMessage}.",
@ -108,7 +107,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.MissingField,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = "Missing field in configuration file '{fileModulePath}': {fieldName}.",
@ -117,7 +116,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.InvalidPackageNameDueToUsingConfigPackage,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = EventConstants.LabeledProvenancePrefix + "Invalid package name {name} (case insensitive) because the name is reserved.",
@ -126,7 +125,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.SourceResolverPackageFileNotWithinConfiguration,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = EventConstants.LabeledProvenancePrefix + "Specified package file '{packagePath}' is not within the configuration directory '{configFilePath}'.",
@ -135,7 +134,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.SourceResolverPackageFilesDoNotExist,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = EventConstants.LabeledProvenancePrefix + "Specified package (configuration) file '{packageConfigPath}' does not exist.",
@ -144,7 +143,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.SourceResolverModuleFilesDoNotExistVerbose,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Verbose,
EventTask = (ushort)Tasks.Parser,
Message = EventConstants.LabeledProvenancePrefix + "Specified module (configuration) file '{moduleConfigPath}' does not exist.",
@ -153,7 +152,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.SourceResolverRootDirForPackagesDoesNotExist,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = "{locationInfo}Directory specified for the SourceResolver.root property ('{rootDirPath}') does not exist.",
@ -162,7 +161,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.SourceResolverFailEvaluateUnregisteredFileModule,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = "Failed evaluating file module '{fileModulePath}' because it is unregistered; the file module may have not been parsed.",
@ -171,7 +170,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.SourceResolverConfigurationIsNotObjectLiteral,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = EventConstants.LabeledProvenancePrefix + "Configuration in '{configPath}' does not evaluate to an object literal.",
@ -346,7 +345,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.ModuleProjectFileDoesNotExist,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Verbose,
EventTask = (ushort)Tasks.Parser,
Message = EventConstants.LabeledProvenancePrefix + "Specified project file '{projectPath}' in package file '{modulePath}' does not exist.",

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT License.
using BuildXL.FrontEnd.Script.Constants;
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;
@ -52,7 +51,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
/// </summary>
[GeneratedEvent(
(ushort)LogEventId.QualifierCannotBeCoarcedToQualifierSpace,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = EventConstants.LabeledProvenancePrefix + "Qualifier '{qualifierName}' cannot be coerced to '{qualifierSpace}'",
@ -61,7 +60,7 @@ namespace BuildXL.FrontEnd.Script.Tracing
[GeneratedEvent(
(ushort)LogEventId.QualifierCannotBeCoarcedToQualifierSpaceWithProvenance,
EventGenerators = BuildXL.Tracing.EventGenerators.LocalOnly,
EventGenerators = EventGenerators.LocalOnly,
EventLevel = Level.Error,
EventTask = (ushort)Tasks.Parser,
Message = EventConstants.LabeledProvenancePrefix + "Qualifier '{qualifierName}' cannot be coerced to '{qualifierSpace}' when referencing '{referencedLocation.File}({referencedLocation.Line},{referencedLocation.Position})'.",

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT License.
using BuildXL.FrontEnd.Script.Constants;
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT License.
using System.Diagnostics.Tracing;
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Core;
using BuildXL.Utilities.Instrumentation.Common;

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT License.
using System.Collections.Generic;
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -61,6 +61,7 @@ namespace Native {
assemblyName: "BuildXL.Native",
sources: globR(d`.`, "*.cs"),
generateLogs: true,
excludeTracing: true,
addNotNullAttributeFile: true,
references: [
// IMPORTANT!!! Do not add non-bxl dependencies or any bxl projects with external dependencies into this project

Просмотреть файл

@ -1,8 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591
#nullable enable

Просмотреть файл

@ -1,9 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using BuildXL.Tracing;
using BuildXL.Utilities.Instrumentation.Common;
#pragma warning disable 1591

Просмотреть файл

@ -1,9 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using BuildXL.Utilities.Instrumentation.Common;
namespace BuildXL.Tracing
namespace BuildXL.Utilities.Instrumentation.Common
{
/// <summary>
/// Standard settings for BuildXL event generators

Просмотреть файл

@ -4,6 +4,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.ContractsLight;
using System.Diagnostics.Tracing;
using System.Linq;