Skip to content
Open
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
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project>

<PropertyGroup Label="Build">
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<RootNamespace>Microsoft.Sbom</RootNamespace>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
Expand Down
34 changes: 19 additions & 15 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PackageVersion>
</ItemDefinitionGroup>
<PropertyGroup>
<ComponentDetectionPackageVersion>6.0.0</ComponentDetectionPackageVersion>
<ComponentDetectionPackageVersion>6.2.0</ComponentDetectionPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="AutoMapper" Version="10.1.1" />
Expand All @@ -17,23 +17,25 @@
<PackageVersion Include="Microsoft.Build.Locator" Version="1.9.1" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.11.48" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="9.0.11" />
<PackageVersion Include="Microsoft.ComponentDetection.Common" Version="$(ComponentDetectionPackageVersion)" />
<PackageVersion Include="Microsoft.ComponentDetection.Contracts" Version="$(ComponentDetectionPackageVersion)" />
<PackageVersion Include="Microsoft.ComponentDetection.Detectors" Version="$(ComponentDetectionPackageVersion)" />
<PackageVersion Include="Microsoft.ComponentDetection.Orchestrator" Version="$(ComponentDetectionPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.10" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.10" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="9.0.10" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.10" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.10" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.10" />
<PackageVersion Include="Microsoft.IO.Redist" Version="6.1.0" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15" />
<PackageVersion Include="MinVer" Version="6.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<PackageVersion Include="NuGet.Configuration" Version="6.14.0" />
<PackageVersion Include="NuGet.Frameworks" Version="6.14.0" />
<PackageVersion Include="NuGet.ProjectModel" Version="6.11.1" />
<PackageVersion Include="NuGet.Configuration" Version="7.0.0" />
<PackageVersion Include="NuGet.Frameworks" Version="7.0.0" />
<PackageVersion Include="NuGet.ProjectModel" Version="7.0.0" />
<PackageVersion Include="packageurl-dotnet" Version="1.1.0" />
<PackageVersion Include="PowerArgs" Version="3.6.0" />
<PackageVersion Include="Scrutor" Version="6.1.0" />
Expand All @@ -43,19 +45,21 @@
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageVersion Include="Serilog.Sinks.Map" Version="2.0.0" />
<PackageVersion Include="Spectre.Console.Cli" Version="0.49.1" />
<PackageVersion Include="Spectre.Console.Cli" Version="0.53.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="System.IO.Compression" Version="4.3.0" />
<PackageVersion Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
<PackageVersion Include="System.Memory" Version="4.6.0" />
<PackageVersion Include="System.Memory" Version="4.6.3" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="9.0.10" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Net.Http.Json" Version="9.0.0" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="System.Reactive" Version="6.1.0" />
<PackageVersion Include="System.Runtime.Loader" Version="4.3.0" />
<PackageVersion Include="System.Text.Json" Version="9.0.9" />
<PackageVersion Include="System.Text.Json" Version="9.0.10" />
<PackageVersion Include="System.Threading.Channels" Version="9.0.10" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="8.0.1" />
<PackageVersion Include="System.Threading.Tasks.Dataflow" Version="9.0.10" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.121",
"rollForward": "latestMajor"
"version": "9.0.100",
"rollForward": "latestFeature"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" VersionOverride="9.0.9" />
<PackageReference Include="System.Text.Json" />
<ProjectReference Include="..\Microsoft.Sbom.Common\Microsoft.Sbom.Common.csproj" />
<ProjectReference Include="..\Microsoft.Sbom.Contracts\Microsoft.Sbom.Contracts.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Api/Microsoft.Sbom.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NuGet.Frameworks" VersionOverride="6.14.0" />
<PackageReference Include="NuGet.Frameworks" />
<ProjectReference Include="..\Microsoft.Sbom.Adapters\Microsoft.Sbom.Adapters.csproj" />
<ProjectReference Include="..\Microsoft.Sbom.Common\Microsoft.Sbom.Common.csproj" />
<ProjectReference Include="..\Microsoft.Sbom.Contracts\Microsoft.Sbom.Contracts.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Sbom.Common/Microsoft.Sbom.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" VersionOverride="9.0.9" />
<PackageReference Include="System.Text.Json" />
<ProjectReference Include="..\Microsoft.Sbom.Extensions\Microsoft.Sbom.Extensions.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.Http" />
<PackageReference Include="Microsoft.Extensions.Options" />
<PackageReference Include="Scrutor" />
<PackageReference Include="Serilog" />
<PackageReference Include="Serilog.Sinks.Async" />
Expand Down
15 changes: 14 additions & 1 deletion src/Microsoft.Sbom.Targets/GenerateSbomTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Microsoft.Sbom.Targets;

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Build.Utilities;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
Expand Down Expand Up @@ -36,6 +37,7 @@ public GenerateSbom()
{
var host = Host.CreateDefaultBuilder()
.ConfigureServices((host, services) =>
{
services
.AddSbomTool()
/* Manually adding some dependencies since `AddSbomTool()` does not add them when
Expand All @@ -58,7 +60,18 @@ public GenerateSbom()
.AddSingleton<IManifestInterface, SPDX22.Validator>()
.AddSingleton<IManifestInterface, SPDX30.Validator>()
.AddSingleton<IManifestConfigHandler, SPDX22ManifestConfigHandler>()
.AddSingleton<IManifestConfigHandler, SPDX30ManifestConfigHandler>())
.AddSingleton<IManifestConfigHandler, SPDX30ManifestConfigHandler>();

// Workaround for .NET 8 compatibility with Microsoft.Extensions.Http 9.x
// Remove the MetricsFactoryHttpMessageHandlerFilter that requires .NET 9 APIs
// This must be done AFTER AddHttpClient() is called (which happens inside AddSbomTool)
var metricsFilterDescriptor = services.FirstOrDefault(descriptor =>
descriptor.ImplementationType?.ToString() == "Microsoft.Extensions.Http.MetricsFactoryHttpMessageHandlerFilter");
if (metricsFilterDescriptor != null)
{
services.Remove(metricsFilterDescriptor);
}
})
.Build();
this.Generator = host.Services.GetRequiredService<ISbomGenerator>();
}
Expand Down
11 changes: 6 additions & 5 deletions src/Microsoft.Sbom.Targets/Microsoft.Sbom.Targets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<AssemblyName>Microsoft.Sbom.Targets</AssemblyName>
<TargetFrameworks>net8.0;net472</TargetFrameworks>
<TargetFrameworks>net9.0;net472</TargetFrameworks>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
<IsPublishable>true</IsPublishable>
<IsPackable>true</IsPackable>
Expand All @@ -11,7 +11,7 @@
<Title>GenerateSbomTask</Title>
<Description>Tasks and targets for running the SBOM tool.</Description>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<SbomCLIToolTargetFramework>net8.0</SbomCLIToolTargetFramework>
<SbomCLIToolTargetFramework>net9.0</SbomCLIToolTargetFramework>
<DevelopmentDependency>true</DevelopmentDependency>

<!-- This target will run when MSBuild is collecting the files to be packaged, and we'll implement it below. This property controls the dependency list for this packaging process, so by adding our custom property we hook ourselves into the process in a supported way. -->
Expand Down Expand Up @@ -68,12 +68,13 @@
<PackageReference Include="Microsoft.Build.Utilities.Core" PrivateAssets="all" ExcludeAssets="Runtime" />
<!-- This is a transitive dependency of Microsoft.Build.Utilities.Core, but we need to bump its version on .NET Framework -->
<PackageReference Condition="'$(TargetFramework)'=='net472'" Include="Microsoft.IO.Redist" PrivateAssets = "all" ExcludeAssets="Runtime" />
<PackageReference Condition="'$(TargetFramework)'=='net9.0'" Include="Microsoft.Extensions.Options" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectReference Condition="'$(TargetFramework)'=='net8.0'" Include="..\Microsoft.Sbom.Contracts\Microsoft.Sbom.Contracts.csproj" />
<ProjectReference Condition="'$(TargetFramework)'=='net8.0'" Include="..\Microsoft.Sbom.Extensions.DependencyInjection\Microsoft.Sbom.Extensions.DependencyInjection.csproj" PrivateAssets="all" />
<ProjectReference Condition="'$(TargetFramework)'=='net8.0'" Include="..\Microsoft.Sbom.Tool\Microsoft.Sbom.Tool.csproj" PrivateAssets="all" IncludeAssets="output" />
<ProjectReference Condition="'$(TargetFramework)'=='net9.0'" Include="..\Microsoft.Sbom.Contracts\Microsoft.Sbom.Contracts.csproj" />
<ProjectReference Condition="'$(TargetFramework)'=='net9.0'" Include="..\Microsoft.Sbom.Extensions.DependencyInjection\Microsoft.Sbom.Extensions.DependencyInjection.csproj" PrivateAssets="all" />
<ProjectReference Condition="'$(TargetFramework)'=='net9.0'" Include="..\Microsoft.Sbom.Tool\Microsoft.Sbom.Tool.csproj" PrivateAssets="all" IncludeAssets="output" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<GenerateSbom_TFM Condition=" '$(MSBuildRuntimeType)' == 'Full' ">net472</GenerateSbom_TFM>
<GenerateSbom_TFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">net8.0</GenerateSbom_TFM>
<GenerateSbom_TFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">net9.0</GenerateSbom_TFM>

<SbomToolBinaryOutputPath Condition="'$(SbomToolBinaryOutputPath)' == ''">$([System.IO.Path]::Combine($(MSBuildThisFileDirectory),..,tasks,$(GenerateSbom_TFM),sbom-tool))</SbomToolBinaryOutputPath>
<GenerateSbomTaskAssemblyFilePath Condition="'$(GenerateSbomTaskAssemblyFilePath)' == ''">$([System.IO.Path]::Combine($(MSBuildThisFileDirectory),..,tasks,$(GenerateSbom_TFM),Microsoft.Sbom.Targets.dll))</GenerateSbomTaskAssemblyFilePath>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net8.0;net472</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net9.0;net472</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net9.0</TargetFrameworks>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsPackable>false</IsPackable>
<RootNamespace>Microsoft.Sbom.Targets.E2E.Tests</RootNamespace>
<SbomCLIToolTargetFramework>net8.0</SbomCLIToolTargetFramework>
<SbomCLIToolTargetFramework>net9.0</SbomCLIToolTargetFramework>
<SBOMCLIToolProjectDir>$(MSBuildThisFileDirectory)..\..\src\Microsoft.Sbom.Tool\</SBOMCLIToolProjectDir>
<SBOMGenerationTargetsPath>$(MSBuildThisFileDirectory)..\..\src\Microsoft.Sbom.Targets\Microsoft.Sbom.Targets.targets</SBOMGenerationTargetsPath>
<NoWarn>CA1515;NU1903</NoWarn>
Expand All @@ -30,12 +30,13 @@
<PackageReference Include="NuGet.Frameworks" />
<PackageReference Include="NuGet.ProjectModel" />
<PackageReference Include="System.IO.Compression" />
<PackageReference Include="System.Threading.Tasks.Dataflow" VersionOverride="9.0.10" />
</ItemGroup>

<ItemGroup>
<ProjectReference Condition="$(TargetFramework) == 'net8.0'" Include="..\..\src\Microsoft.Sbom.Targets\Microsoft.Sbom.Targets.csproj" AdditionalProperties="TargetFramework=net8.0" />
<ProjectReference Condition="$(TargetFramework) == 'net9.0'" Include="..\..\src\Microsoft.Sbom.Targets\Microsoft.Sbom.Targets.csproj" AdditionalProperties="TargetFramework=net9.0" />
<ProjectReference Condition="$(TargetFramework) == 'net472'" Include="..\..\src\Microsoft.Sbom.Targets\Microsoft.Sbom.Targets.csproj" AdditionalProperties="TargetFramework=net472" />
<ProjectReference Condition="$(TargetFramework) == 'net8.0'" Include="..\..\src\Microsoft.Sbom.Tool\Microsoft.Sbom.Tool.csproj" />
<ProjectReference Condition="$(TargetFramework) == 'net9.0'" Include="..\..\src\Microsoft.Sbom.Tool\Microsoft.Sbom.Tool.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<GenerateSBOM>true</GenerateSBOM>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Authors>ProjectSample</Authors>
<Version>1.2.4</Version>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net8.0;net472</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net9.0;net472</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<RootNamespace>Microsoft.Sbom.Targets.Tests</RootNamespace>
<SbomCLIToolTargetFramework>net8.0</SbomCLIToolTargetFramework>
<SbomCLIToolTargetFramework>net9.0</SbomCLIToolTargetFramework>
<SBOMCLIToolProjectDir>$(MSBuildThisFileDirectory)..\..\src\Microsoft.Sbom.Tool\</SBOMCLIToolProjectDir>
<NoWarn>CA1515;CA1872;NU1903</NoWarn>
</PropertyGroup>
Expand Down Expand Up @@ -38,10 +38,10 @@
</Target>

<ItemGroup>
<ProjectReference Condition="$(TargetFramework) == 'net8.0'" Include="..\..\src\Microsoft.Sbom.Targets\Microsoft.Sbom.Targets.csproj" AdditionalProperties="TargetFramework=net8.0" />
<ProjectReference Condition="$(TargetFramework) == 'net9.0'" Include="..\..\src\Microsoft.Sbom.Targets\Microsoft.Sbom.Targets.csproj" AdditionalProperties="TargetFramework=net9.0" />
<ProjectReference Condition="$(TargetFramework) == 'net472'" Include="..\..\src\Microsoft.Sbom.Targets\Microsoft.Sbom.Targets.csproj" AdditionalProperties="TargetFramework=net472" />
<ProjectReference Condition="$(TargetFramework) == 'net8.0'" Include="..\..\src\Microsoft.Sbom.Extensions.DependencyInjection\Microsoft.Sbom.Extensions.DependencyInjection.csproj" />
<ProjectReference Condition="$(TargetFramework) == 'net8.0'" Include="..\..\src\Microsoft.Sbom.Tool\Microsoft.Sbom.Tool.csproj" />
<ProjectReference Condition="$(TargetFramework) == 'net9.0'" Include="..\..\src\Microsoft.Sbom.Extensions.DependencyInjection\Microsoft.Sbom.Extensions.DependencyInjection.csproj" />
<ProjectReference Condition="$(TargetFramework) == 'net9.0'" Include="..\..\src\Microsoft.Sbom.Tool\Microsoft.Sbom.Tool.csproj" />
</ItemGroup>

</Project>
</Project>