diff --git a/Directory.Packages.props b/Directory.Packages.props
index 939606e8..d4f4fded 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -16,6 +16,7 @@
+
@@ -57,4 +58,4 @@
-
+
\ No newline at end of file
diff --git a/src/Microsoft.Sbom.Targets/Microsoft.Sbom.Targets.targets b/src/Microsoft.Sbom.Targets/Microsoft.Sbom.Targets.targets
index 84012489..914941eb 100644
--- a/src/Microsoft.Sbom.Targets/Microsoft.Sbom.Targets.targets
+++ b/src/Microsoft.Sbom.Targets/Microsoft.Sbom.Targets.targets
@@ -30,10 +30,10 @@
$(AssemblyName)
$(Version)
1.0.0
- http://spdx.org/spdxdocs/$(SbomGenerationPackageName)"
+ http://spdx.org/spdxdocs/$(SbomGenerationPackageName)
false
false
- LogAlways
+ information
SPDX:2.2
true
diff --git a/src/Microsoft.Sbom.Targets/SbomCLIToolTask.cs b/src/Microsoft.Sbom.Targets/SbomCLIToolTask.cs
index a050412a..99f3692e 100644
--- a/src/Microsoft.Sbom.Targets/SbomCLIToolTask.cs
+++ b/src/Microsoft.Sbom.Targets/SbomCLIToolTask.cs
@@ -93,7 +93,7 @@ private void SetOutputImportance()
{
this.StandardOutputImportance = "High";
- if (this.Verbosity.ToLower().Equals("Fatal"))
+ if (this.Verbosity.ToLower().Equals("fatal"))
{
this.StandardOutputImportance = "Low";
}
diff --git a/src/Microsoft.Sbom.Targets/SbomInputValidator.cs b/src/Microsoft.Sbom.Targets/SbomInputValidator.cs
index 6076c34c..747595ee 100644
--- a/src/Microsoft.Sbom.Targets/SbomInputValidator.cs
+++ b/src/Microsoft.Sbom.Targets/SbomInputValidator.cs
@@ -13,6 +13,9 @@ namespace Microsoft.Sbom.Targets;
///
public partial class GenerateSbom
{
+ private const string DefaultVerbosity = "Information";
+ private const EventLevel DefaultEventLevel = EventLevel.Informational;
+
///
/// Ensure all required arguments are non-null/empty,
/// and do not contain whitespaces, tabs, or newline characters.
@@ -74,9 +77,9 @@ public EventLevel ValidateAndAssignVerbosity()
// EventLevel value for the API.
if (string.IsNullOrWhiteSpace(this.Verbosity))
{
- Log.LogWarning($"No verbosity level specified. Setting verbosity level at Verbose");
- this.Verbosity = "Verbose";
- return EventLevel.Verbose;
+ Log.LogWarning($"No verbosity level specified. Setting verbosity level at {DefaultVerbosity}.");
+ this.Verbosity = DefaultVerbosity;
+ return DefaultEventLevel;
}
switch (this.Verbosity.ToLower().Trim())
@@ -94,9 +97,9 @@ public EventLevel ValidateAndAssignVerbosity()
case "fatal":
return EventLevel.Critical;
default:
- Log.LogWarning($"Unrecognized verbosity level specified. Setting verbosity level at Verbose");
- this.Verbosity = "Verbose";
- return EventLevel.Verbose;
+ Log.LogWarning($"Unrecognized verbosity level specified. Setting verbosity level at {DefaultVerbosity}.");
+ this.Verbosity = DefaultVerbosity;
+ return DefaultEventLevel;
}
}
diff --git a/test/Microsoft.Sbom.Targets.Tests/AbstractGenerateSBomTaskInputTests.cs b/test/Microsoft.Sbom.Targets.Tests/AbstractGenerateSbomTaskInputTests.cs
similarity index 61%
rename from test/Microsoft.Sbom.Targets.Tests/AbstractGenerateSBomTaskInputTests.cs
rename to test/Microsoft.Sbom.Targets.Tests/AbstractGenerateSbomTaskInputTests.cs
index 7afe52e5..5274dbf5 100644
--- a/test/Microsoft.Sbom.Targets.Tests/AbstractGenerateSBomTaskInputTests.cs
+++ b/test/Microsoft.Sbom.Targets.Tests/AbstractGenerateSbomTaskInputTests.cs
@@ -4,31 +4,33 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
+using System.Reflection;
using System.Text.RegularExpressions;
using Microsoft.Build.Framework;
-using Microsoft.Sbom.Contracts;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace Microsoft.Sbom.Targets.Tests;
[TestClass]
-public abstract class AbstractGenerateSBomTaskInputTests
+public abstract class AbstractGenerateSbomTaskInputTests
{
- internal abstract SbomSpecification SbomSpecification { get; }
+ internal abstract string SbomSpecification { get; }
- internal static readonly string CurrentDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
+ internal static readonly string CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static readonly string DefaultManifestDirectory = Path.Combine(CurrentDirectory, "_manifest");
internal static readonly string TemporaryDirectory = Path.Combine(CurrentDirectory, "_temporary");
internal static readonly string BuildComponentPath = Path.Combine(CurrentDirectory, "..", "..", "..");
internal static readonly string ExternalDocumentListFile = Path.GetRandomFileName();
+ internal static string SbomToolPath = Path.Combine(Directory.GetCurrentDirectory(), "sbom-tool");
internal const string PackageSupplier = "Test-Microsoft";
internal const string PackageName = "CoseSignTool";
internal const string PackageVersion = "0.0.1";
internal const string NamespaceBaseUri = "https://base0.uri";
-
private Mock buildEngine;
private List errors;
+ private List messages;
[TestInitialize]
public void Startup()
@@ -36,7 +38,9 @@ public void Startup()
// Setup the build engine
this.buildEngine = new Mock();
this.errors = new List();
+ this.messages = new List();
this.buildEngine.Setup(x => x.LogErrorEvent(It.IsAny())).Callback(e => errors.Add(e));
+ this.buildEngine.Setup(x => x.LogMessageEvent(It.IsAny())).Callback(msg => messages.Add(msg));
}
[TestCleanup]
@@ -68,7 +72,8 @@ public void Sbom_Fails_With_Null_Empty_And_WhiteSpace_Required_Params(
string packageSupplier,
string packageName,
string packageVersion,
- string namespaceBaseUri)
+ string namespaceBaseUri,
+ string sbomToolPath)
{
// Arrange.
var task = new GenerateSbom
@@ -78,8 +83,11 @@ public void Sbom_Fails_With_Null_Empty_And_WhiteSpace_Required_Params(
PackageName = packageName,
PackageVersion = packageVersion,
NamespaceBaseUri = namespaceBaseUri,
- ManifestInfo = this.SbomSpecification.ToString(),
- BuildEngine = this.buildEngine.Object
+ ManifestInfo = this.SbomSpecification,
+ BuildEngine = this.buildEngine.Object,
+#if NET472
+ SbomToolPath = sbomToolPath,
+#endif
};
// Act
@@ -91,29 +99,38 @@ public void Sbom_Fails_With_Null_Empty_And_WhiteSpace_Required_Params(
private static IEnumerable