Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,7 @@ dotnet_naming_style.camel_case_underscore.capitalization = camel_case
dotnet_diagnostic.SA1101.severity = none

# We prefer underscore prefixes for private fields
dotnet_diagnostic.SA1309.severity = none
dotnet_diagnostic.SA1309.severity = none

# Code Style rules (IDE*)
dotnet_diagnostic.IDE0005.severity = warning # Remove unnecessary import
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

<!-- Enabled the built-in analyzers -->
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<NoWarn>$(NoWarn);SA0001</NoWarn>

Expand Down
3 changes: 2 additions & 1 deletion src/BuildPrediction/Polyfills.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NET472

using System;

#if NET472
namespace Microsoft.Build.Prediction
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/BuildPrediction/Predictors/CopyTask/FileExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ internal static class FileExpression
/// <summary>
/// Evaluates file expressions, which are MSBuild expressions that
/// evaluate to a list of files (e.g. @(Compile -> '%(filename)') or %(None.filename)).
/// </summary>
/// <param name="expression">An unprocessed string for a single expression.</param>
/// <param name="project">The project where the expression exists.</param>
/// <param name="task">The task where the expression exists.</param>
/// <param name="isBatched">Indicates whether the expression is batched.</param>
/// <returns>the set of all files in the evaluated expression.</returns>
public static List<string> EvaluateExpression(
string expression,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void PredictInputsAndOutputs(

/// <summary>
/// Determines the value of _UseBuildDependencyFile by emulating the behavior from the _ComputeUseBuildDependencyFile target (and the _ComputePackageReferencePublish target).
/// </remarks>
/// </summary>
internal static bool ShouldUseBuildDependencyFile(ProjectInstance projectInstance)
{
bool hasExcludeFromPublishPackageReference = false;
Expand Down
10 changes: 4 additions & 6 deletions src/BuildPrediction/Predictors/MasmItemsPredictor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Microsoft.Build.Execution;

namespace Microsoft.Build.Prediction.Predictors
Expand All @@ -17,7 +15,7 @@ namespace Microsoft.Build.Prediction.Predictors
///
/// While not as widely used, the masm.props/masm.targets are distributed with Visual Studio C/C++ SDK:
/// - $(VCTargetsPath)\BuildCustomizations\masm.props
/// - $(VCTargetsPath)\BuildCustomizations\masm.targets
/// - $(VCTargetsPath)\BuildCustomizations\masm.targets.
/// </remarks>
/// <seealso cref="Microsoft.Build.Prediction.IProjectPredictor" />
public class MasmItemsPredictor : IProjectPredictor
Expand All @@ -28,7 +26,7 @@ public class MasmItemsPredictor : IProjectPredictor
internal const string MasmItemName = "MASM";

/// <summary>
/// Property name declared in masm.targets
/// Property name declared in masm.targets.
/// </summary>
internal const string MasmBeforeTargetsPropertyName = "MASMBeforeTargets";

Expand Down Expand Up @@ -61,7 +59,7 @@ public class MasmItemsPredictor : IProjectPredictor
/// <summary>
/// Character separator for values specified in %(MASM.IncludePaths).
/// </summary>
private static readonly char[] IncludePathsSeparator = { ';' };
private static readonly char[] _includePathsSeparator = { ';' };

/// <inheritdoc />
public void PredictInputsAndOutputs(ProjectInstance project, ProjectPredictionReporter reporter)
Expand Down Expand Up @@ -101,7 +99,7 @@ private void ReportInputs(ProjectPredictionReporter reporter, ProjectItemInstanc
reporter.ReportInputFile(masmItem.EvaluatedInclude);

string[] includePaths = masmItem.GetMetadataValue(IncludePathsMetadata)
.Split(IncludePathsSeparator, StringSplitOptions.RemoveEmptyEntries);
.Split(_includePathsSeparator, StringSplitOptions.RemoveEmptyEntries);

// Avoid reporting paths that we've already reported for this project.
foreach (string includePath in includePaths)
Expand Down
3 changes: 0 additions & 3 deletions src/BuildPrediction/ProjectGraphPredictionExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Build.Definition;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Evaluation.Context;
using Microsoft.Build.Execution;
using Microsoft.Build.Graph;

Expand Down
2 changes: 1 addition & 1 deletion src/BuildPrediction/ProjectPredictionReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.Build.Prediction
/// </summary>
/// <remarks>
/// This struct is used internally by the prediction library and is not intended to be created externally.
/// <see cref="IProjectPredictor"/> instances recieve this in their <see cref="IProjectPredictor.TryPredictInputsAndOutputs(Execution.ProjectInstance, out ProjectPredictions)"/>
/// <see cref="IProjectPredictor"/> instances recieve this in their <see cref="IProjectPredictor.PredictInputsAndOutputs(ProjectInstance, ProjectPredictionReporter)"/>
/// methods as a means to report predictions to the <see cref="IProjectPredictionCollector"/>. Generally the methods on this struct should mirror those on <see cref="IProjectPredictionCollector"/>.
/// </remarks>
#pragma warning disable CA1815 // Override equals and operator equals on value types. Justification: This struct is never compared or equated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>net472;net8.0;net9.0</TargetFrameworks>
<!-- Documentation rules aren't needed for the test project -->
<NoWarn>$(NoWarn);SA1600;SA1611;SA1615</NoWarn>
<NoWarn>$(NoWarn);SA1600;SA1611;SA1615;CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BuildPrediction\Microsoft.Build.Prediction.csproj" />
Expand Down
1 change: 0 additions & 1 deletion src/BuildPredictionTests/MsBuildHelpersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Linq;
using Microsoft.Build.Construction;
using Microsoft.Build.Execution;
using Microsoft.Build.Prediction;
using Xunit;

namespace Microsoft.Build.Prediction.Tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if !NETCOREAPP
using System.Collections.Generic;
using System.Linq;
using Microsoft.Build.Construction;
using Microsoft.Build.Prediction.Predictors;
using Xunit;

#if !NETCOREAPP
// These tests rely on VCTargetsPath, which isn't available in the netcoreapp flavor of MSBuild.
// MASM files and C++ builds in general aren't available on netcoreapp, so skipping these tests is OK.
namespace Microsoft.Build.Prediction.Tests.Predictors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.IO;
using Microsoft.Build.Prediction;
using Microsoft.Build.Prediction.Predictors;
using Microsoft.Build.Prediction.Tests;
using Xunit;

namespace Microsoft.Build.Prediction.Tests.Predictors
Expand Down
Loading