Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MSBuild Logging APIs for Task output instead of StdOut #933

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
remove unused code
  • Loading branch information
baronfel committed Mar 1, 2025
commit 1314672c96e2949f831e1c05cf243108e6959992
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// 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.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.Build.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -209,21 +207,6 @@ public void Sbom_Generation_Fails_For_Invalid_NamespaceUriUniquePart(string name
Assert.IsFalse(result);
}

internal class MSBuildMessageDebugView(BuildMessageEventArgs message)
{
public override string ToString()
{
if (message.Subcategory is not null && message.Code is not null)
{
return $"[{message.Timestamp}] [{message.Subcategory}/{message.Code}] {message.Message}";
}
else
{
return $"[{message.Timestamp}] {message.Message}";
}
}
}

/// <summary>
/// Test for ensuring GenerateSbom assigns a default Verbosity
/// level when null input is provided.
@@ -293,19 +276,14 @@ public void Sbom_Generation_Succeeds_For_Invalid_Verbosity()
/// values to the SBOM API.
/// </summary>
[TestMethod]
[DataRow("FATAL", "Fatal", false)]
[DataRow("information", "Information", true)]
[DataRow("vErBose", "Verbose", true)]
[DataRow("Warning", "Warning", false)]
[DataRow("eRRor", "Error", false)]
[DataRow("DeBug", "Verbose", true)]
public void Sbom_Generation_Assigns_Correct_Verbosity_IgnoreCase(string inputVerbosity, string mappedVerbosity, bool messageShouldBeLogged)
[DataRow("FATAL", "Fatal")]
[DataRow("information", "Information")]
[DataRow("vErBose", "Verbose")]
[DataRow("Warning", "Warning")]
[DataRow("eRRor", "Error")]
[DataRow("DeBug", "Verbose")]
public void Sbom_Generation_Assigns_Correct_Verbosity_IgnoreCase(string inputVerbosity, string mappedVerbosity)
{
if (!messageShouldBeLogged)
{
Assert.Inconclusive("Cases where the input Verbosity is more restrictive than `Information` are failing due to this issue: https://github.com/microsoft/sbom-tool/issues/616");
}

// Arrange
var task = new GenerateSbom
{