Skip to content

Commit

Permalink
Merge vs17.8
Browse files Browse the repository at this point in the history
Suppress package-compat warnings related to #9330.

Co-authored-by: Mariana Dematte <magarces@microsoft.com>
Co-authored-by: Gang Wang <v-gaw@microsoft.com>
  • Loading branch information
3 people committed Oct 25, 2023
2 parents 3a2f9ba + 195e7f5 commit 04fde49
Show file tree
Hide file tree
Showing 52 changed files with 833 additions and 505 deletions.
2 changes: 1 addition & 1 deletion eng/dependabot/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageVersion Include="LargeAddressAware" Version="1.0.5" />
<PackageVersion Update="LargeAddressAware" Condition="'$(LargeAddressAwareVersion)' != ''" Version="$(LargeAddressAwareVersion)" />

<PackageVersion Include="Microsoft.BuildXL.Processes" Version="0.1.0-20230727.4.2" />
<PackageVersion Include="Microsoft.BuildXL.Processes" Version="0.1.0-20230929.2" />
<PackageVersion Update="Microsoft.BuildXL.Processes" Condition="'$(BuildXLProcessesVersion)' != ''" Version="$(BuildXLProcessesVersion)" />

<PackageVersion Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="3.2.2146" PrivateAssets="All" />
Expand Down
2 changes: 1 addition & 1 deletion src/Build.UnitTests/BackEnd/TaskHostTaskComplete_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Collections.Generic;
using Microsoft.Build.BackEnd;
using Microsoft.Build.Framework;
using Microsoft.Build.Framework.FileAccess;
using Microsoft.Build.Experimental.FileAccess;
using Microsoft.Build.Shared;
using Microsoft.Build.Utilities;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using BuildXL.Processes;
using BuildXL.Utilities.Core;
using Microsoft.Build.Exceptions;
using Microsoft.Build.Experimental.FileAccess;
using Microsoft.Build.FileAccesses;
using Microsoft.Build.Internal;
using Microsoft.Build.Shared;
Expand Down Expand Up @@ -160,20 +161,20 @@ public override void HandleDebugMessage(DebugData debugData)
}

public override void HandleFileAccess(FileAccessData fileAccessData) => _fileAccessManager.ReportFileAccess(
new Framework.FileAccess.FileAccessData(
(Framework.FileAccess.ReportedFileOperation)fileAccessData.Operation,
(Framework.FileAccess.RequestedAccess)fileAccessData.RequestedAccess,
new Experimental.FileAccess.FileAccessData(
(Experimental.FileAccess.ReportedFileOperation)fileAccessData.Operation,
(Experimental.FileAccess.RequestedAccess)fileAccessData.RequestedAccess,
fileAccessData.ProcessId,
fileAccessData.Error,
(Framework.FileAccess.DesiredAccess)fileAccessData.DesiredAccess,
(Framework.FileAccess.FlagsAndAttributes)fileAccessData.FlagsAndAttributes,
(Experimental.FileAccess.DesiredAccess)fileAccessData.DesiredAccess,
(Experimental.FileAccess.FlagsAndAttributes)fileAccessData.FlagsAndAttributes,
fileAccessData.Path,
fileAccessData.ProcessArgs,
fileAccessData.IsAnAugmentedFileAccess),
_nodeId);

public override void HandleProcessData(ProcessData processData) => _fileAccessManager.ReportProcess(
new Framework.FileAccess.ProcessData(
new Experimental.FileAccess.ProcessData(
processData.ProcessName,
processData.ProcessId,
processData.ParentProcessId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Threading;
using Microsoft.Build.BackEnd;
using Microsoft.Build.Execution;
using Microsoft.Build.Framework.FileAccess;
using Microsoft.Build.Experimental.FileAccess;
using Microsoft.Build.Shared;

namespace Microsoft.Build.FileAccesses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.Build.BackEnd;
using Microsoft.Build.Framework.FileAccess;
using Microsoft.Build.Experimental.FileAccess;

namespace Microsoft.Build.FileAccesses
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System;
using System.Threading;
using Microsoft.Build.BackEnd;
using Microsoft.Build.Framework.FileAccess;
using Microsoft.Build.Experimental.FileAccess;

namespace Microsoft.Build.FileAccesses
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System;
using System.Threading;
using Microsoft.Build.BackEnd;
using Microsoft.Build.Framework.FileAccess;
using Microsoft.Build.Experimental.FileAccess;
using Microsoft.Build.Shared;

namespace Microsoft.Build.FileAccesses
Expand Down
2 changes: 1 addition & 1 deletion src/Build/BackEnd/Components/FileAccesses/ProcessReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.Build.BackEnd;
using Microsoft.Build.Framework.FileAccess;
using Microsoft.Build.Experimental.FileAccess;

namespace Microsoft.Build.FileAccesses
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Build.Execution;
using Microsoft.Build.Framework.FileAccess;
using Microsoft.Build.Experimental.FileAccess;

namespace Microsoft.Build.Experimental.ProjectCache
{
Expand Down
13 changes: 8 additions & 5 deletions src/Build/BackEnd/Components/RequestBuilder/TaskHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using Microsoft.Build.Execution;
using Microsoft.Build.FileAccesses;
using Microsoft.Build.Framework;
using Microsoft.Build.Framework.FileAccess;
using Microsoft.Build.Experimental.FileAccess;
using Microsoft.Build.Shared;
using ElementLocation = Microsoft.Build.Construction.ElementLocation;
using TaskItem = Microsoft.Build.Execution.ProjectItemInstance.TaskItem;
Expand Down Expand Up @@ -939,17 +939,20 @@ public override bool LogsMessagesOfImportance(MessageImportance importance)
/// <inheritdoc/>
public override bool IsTaskInputLoggingEnabled => _taskHost._host.BuildParameters.LogTaskInputs;

/// <inheritdoc/>
public override void ReportFileAccess(FileAccessData fileAccessData)
{
#if FEATURE_REPORTFILEACCESSES
/// <summary>
/// Reports a file access from a task.
/// </summary>
/// <param name="fileAccessData">The file access to report.</param>
public void ReportFileAccess(FileAccessData fileAccessData)
{
IBuildComponentHost buildComponentHost = _taskHost._host;
if (buildComponentHost.BuildParameters.ReportFileAccesses)
{
((IFileAccessManager)buildComponentHost.GetComponent(BuildComponentType.FileAccessManager)).ReportFileAccess(fileAccessData, buildComponentHost.BuildParameters.NodeId);
}
#endif
}
#endif
}

public EngineServices EngineServices { get; }
Expand Down
57 changes: 57 additions & 0 deletions src/Build/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- Suppressions for api differences between main and vs17.8 when merging vs17.8 into main -->
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.ProjectCache.ProjectCachePluginBase.HandleFileAccess(Microsoft.Build.Experimental.ProjectCache.FileAccessContext,Microsoft.Build.Framework.FileAccess.FileAccessData)</Target>
<Left>lib/net472/Microsoft.Build.dll</Left>
<Right>lib/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.ProjectCache.ProjectCachePluginBase.HandleProcess(Microsoft.Build.Experimental.ProjectCache.FileAccessContext,Microsoft.Build.Framework.FileAccess.ProcessData)</Target>
<Left>lib/net472/Microsoft.Build.dll</Left>
<Right>lib/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.ProjectCache.ProjectCachePluginBase.HandleFileAccess(Microsoft.Build.Experimental.ProjectCache.FileAccessContext,Microsoft.Build.Framework.FileAccess.FileAccessData)</Target>
<Left>lib/net8.0/Microsoft.Build.dll</Left>
<Right>lib/net8.0/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.ProjectCache.ProjectCachePluginBase.HandleProcess(Microsoft.Build.Experimental.ProjectCache.FileAccessContext,Microsoft.Build.Framework.FileAccess.ProcessData)</Target>
<Left>lib/net8.0/Microsoft.Build.dll</Left>
<Right>lib/net8.0/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.ProjectCache.ProjectCachePluginBase.HandleFileAccess(Microsoft.Build.Experimental.ProjectCache.FileAccessContext,Microsoft.Build.Framework.FileAccess.FileAccessData)</Target>
<Left>ref/net472/Microsoft.Build.dll</Left>
<Right>ref/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.ProjectCache.ProjectCachePluginBase.HandleProcess(Microsoft.Build.Experimental.ProjectCache.FileAccessContext,Microsoft.Build.Framework.FileAccess.ProcessData)</Target>
<Left>ref/net472/Microsoft.Build.dll</Left>
<Right>ref/net472/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.ProjectCache.ProjectCachePluginBase.HandleFileAccess(Microsoft.Build.Experimental.ProjectCache.FileAccessContext,Microsoft.Build.Framework.FileAccess.FileAccessData)</Target>
<Left>ref/net8.0/Microsoft.Build.dll</Left>
<Right>ref/net8.0/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.Build.Experimental.ProjectCache.ProjectCachePluginBase.HandleProcess(Microsoft.Build.Experimental.ProjectCache.FileAccessContext,Microsoft.Build.Framework.FileAccess.ProcessData)</Target>
<Left>ref/net8.0/Microsoft.Build.dll</Left>
<Right>ref/net8.0/Microsoft.Build.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System;

namespace Microsoft.Build.Framework.FileAccess
namespace Microsoft.Build.Experimental.FileAccess
{
/*
* Implementation note: This is a copy of BuildXL.Processes.DesiredAccess.
Expand Down
125 changes: 125 additions & 0 deletions src/Build/FileAccess/FileAccessData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;

using Microsoft.Build.BackEnd;

namespace Microsoft.Build.Experimental.FileAccess
{
/// <summary>
/// File access data.
/// </summary>
[CLSCompliant(false)]
public struct FileAccessData
: ITranslatable
{
private ReportedFileOperation _operation;
private RequestedAccess _requestedAccess;
private uint _processId;
private uint _error;
private DesiredAccess _desiredAccess;
private FlagsAndAttributes _flagsAndAttributes;
private string _path;
private string? _processArgs;
private bool _isAnAugmentedFileAccess;

public FileAccessData(
ReportedFileOperation operation,
RequestedAccess requestedAccess,
uint processId,
uint error,
DesiredAccess desiredAccess,
FlagsAndAttributes flagsAndAttributes,
string path,
string? processArgs,
bool isAnAugmentedFileAccess)
{
_operation = operation;
_requestedAccess = requestedAccess;
_processId = processId;
_error = error;
_desiredAccess = desiredAccess;
_flagsAndAttributes = flagsAndAttributes;
_path = path;
_processArgs = processArgs;
_isAnAugmentedFileAccess = isAnAugmentedFileAccess;
}

/// <summary>The operation that performed the file access.</summary>
public ReportedFileOperation Operation
{
readonly get => _operation;
private set => _operation = value;
}

/// <summary>The requested access.</summary>
public RequestedAccess RequestedAccess
{
get => _requestedAccess;
private set => _requestedAccess = value;
}

/// <summary>The process id.</summary>
public uint ProcessId
{
readonly get => _processId;
private set => _processId = value;
}

/// <summary>The error code of the operation.</summary>
public uint Error
{
readonly get => _error;
private set => _error = value;
}

/// <summary>The desired access.</summary>
public DesiredAccess DesiredAccess
{
readonly get => _desiredAccess;
private set => _desiredAccess = value;
}

/// <summary>The file flags and attributes.</summary>
public FlagsAndAttributes FlagsAndAttributes
{
readonly get => _flagsAndAttributes;
private set => _flagsAndAttributes = value;
}

/// <summary>The path being accessed.</summary>
public string Path
{
readonly get => _path;
private set => _path = value;
}

/// <summary>The process arguments.</summary>
public string? ProcessArgs
{
readonly get => _processArgs;
private set => _processArgs = value;
}

/// <summary>Whether the file access is augmented.</summary>
public bool IsAnAugmentedFileAccess
{
readonly get => _isAnAugmentedFileAccess;
private set => _isAnAugmentedFileAccess = value;
}

void ITranslatable.Translate(ITranslator translator)
{
translator.TranslateEnum(ref _operation, (int)_operation);
translator.TranslateEnum(ref _requestedAccess, (int)_requestedAccess);
translator.Translate(ref _processId);
translator.Translate(ref _error);
translator.TranslateEnum(ref _desiredAccess, (int)_desiredAccess);
translator.TranslateEnum(ref _flagsAndAttributes, (int)_flagsAndAttributes);
translator.Translate(ref _path);
translator.Translate(ref _processArgs);
translator.Translate(ref _isAnAugmentedFileAccess);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System;

namespace Microsoft.Build.Framework.FileAccess
namespace Microsoft.Build.Experimental.FileAccess
{
/*
* Implementation note: This is a copy of BuildXL.Processes.FlagsAndAttributes.
Expand Down
Loading

0 comments on commit 04fde49

Please sign in to comment.