Skip to content

Commit ff632cd

Browse files
authored
Merge pull request #3398 from PrismLibrary/dev/ds/sbom
Adopts Central Package Management and Enables SBOM
2 parents 342e13b + 2bfbee1 commit ff632cd

4 files changed

Lines changed: 26 additions & 22 deletions

File tree

Directory.Build.props

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<PropertyGroup>
44
<NeutralLanguage>en</NeutralLanguage>
55
<Authors>Brian Lagunas;Dan Siegel</Authors>
6+
<Company>Prism Software, LLC</Company>
7+
<Copyright Condition="'$(Copyright)'==''">Copyright (C) 2015-$([System.DateTime]::Now.ToString(`yyyy`)) Prism Software, LLC - all rights reserved</Copyright>
68
<PackageProjectUrl>https://github.com/PrismLibrary/Prism</PackageProjectUrl>
79
<PackageLicenseFile>LICENSE</PackageLicenseFile>
810
<PackageIcon>prism-logo.png</PackageIcon>
@@ -152,26 +154,16 @@
152154
CopyToOutputDirectory="PreserveNewest" />
153155
</ItemGroup>
154156

155-
<ItemGroup Condition=" $(UseMaui) != 'true' ">
156-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies">
157-
<PrivateAssets>all</PrivateAssets>
158-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
159-
</PackageReference>
160-
</ItemGroup>
161-
162-
<ItemGroup Condition=" $(DISABLE_GITVERSIONING) != 'true' ">
163-
<PackageReference Include="Nerdbank.GitVersioning"
164-
Condition=" !$(MSBuildProjectDirectory.Contains('e2e')) ">
165-
<PrivateAssets>all</PrivateAssets>
166-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
167-
</PackageReference>
168-
</ItemGroup>
169-
170-
<ItemGroup Condition=" $(IsPackable) ">
171-
<PackageReference Include="Microsoft.SourceLink.GitHub">
172-
<PrivateAssets>all</PrivateAssets>
173-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
174-
</PackageReference>
157+
<!-- Versions: Directory.Packages.props (Central Package Management). PrivateAssets=all is implicit. -->
158+
<ItemGroup>
159+
<GlobalPackageReference Include="Microsoft.NETFramework.ReferenceAssemblies"
160+
Condition=" $(UseMaui) != 'true' " />
161+
<GlobalPackageReference Include="Nerdbank.GitVersioning"
162+
Condition=" $(DISABLE_GITVERSIONING) != 'true' AND !$(MSBuildProjectDirectory.Contains('e2e')) " />
163+
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub"
164+
Condition=" $(IsPackable) " />
165+
<GlobalPackageReference Include="Microsoft.Sbom.Targets"
166+
Condition=" $(IsPackable) " />
175167
</ItemGroup>
176168

177169
</Project>

Directory.Build.targets

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@
55
</PropertyGroup>
66

77
<PropertyGroup Condition=" $(IsPackable) ">
8+
<GenerateSBOM>true</GenerateSBOM>
9+
<SbomGenerationFetchLicenseInformation>true</SbomGenerationFetchLicenseInformation>
10+
<SbomGenerationPackageSupplier>$(Company)</SbomGenerationPackageSupplier>
811
<!-- Nuget source link -->
912
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1013
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1114
<EmbedUntrackedSources>true</EmbedUntrackedSources>
1215
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
1316
</PropertyGroup>
1417

18+
<Target Name="SetSbomMetadata"
19+
BeforeTargets="GenerateSbomTarget"
20+
AfterTargets="GetBuildVersion">
21+
<PropertyGroup>
22+
<SbomGenerationPackageVersion>$(PackageVersion)</SbomGenerationPackageVersion>
23+
</PropertyGroup>
24+
</Target>
1525
</Project>

Directory.Packages.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@
9999
<PackageVersion Include="Xamarin.UITest" Version="3.0.12" />
100100
</ItemGroup>
101101
<ItemGroup>
102-
<!-- Global Packages -->
102+
<!-- GlobalPackageReference in Directory.Build.props — build-only; not transitive to package consumers -->
103103
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
104104
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.9.50" />
105105
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
106+
<PackageVersion Include="Microsoft.Sbom.Targets" Version="4.1.5" />
106107
</ItemGroup>
107108
</Project>

src/Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<IsPackable Condition=" '$(IsWpfProject)' ">!$(DisableWpfPublish)</IsPackable>
88
<IsPackable Condition=" '$(IsFormsProject)' ">!$(DisableFormsPublish)</IsPackable>
99
<IsPackable Condition=" '$(IsUnoProject)' ">!$(DisableUnoPublish)</IsPackable>
10-
<ContinuousIntegrationBuild Condition="'$(BUILD_BUILDID)' != ''">true</ContinuousIntegrationBuild>
10+
<!-- GitHub Actions sets GITHUB_ACTIONS and CI; other CI hosts often set CI. -->
11+
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true' Or '$(CI)' == 'true'">true</ContinuousIntegrationBuild>
1112
<ImplicitUsings>enable</ImplicitUsings>
1213
</PropertyGroup>
1314

0 commit comments

Comments
 (0)