Skip to content

Commit

Permalink
build: use central package management
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Jul 3, 2024
1 parent a258115 commit 85998da
Show file tree
Hide file tree
Showing 21 changed files with 153 additions and 78 deletions.
88 changes: 88 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<Project>

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="Azure.Identity" Version="1.12.0" />
<PackageVersion Include="Azure.Security.KeyVault.Certificates" Version="4.6.0" />
<PackageVersion Include="Azure.Security.KeyVault.Keys" Version="4.6.0" />
<PackageVersion Include="Azure.Security.KeyVault.Secrets" Version="4.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.NetStandard20" Version="1.7.2" />
<PackageVersion Include="Glob" Version="1.1.9" />
<PackageVersion Include="HtmlAgilityPack" Version="1.11.61" />
<PackageVersion Include="Humanizer" Version="2.14.1" />
<PackageVersion Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageVersion Include="Microsoft.ApplicationInsights" Version="2.22.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="NJsonSchema" Version="10.9.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NuGet.Packaging" Version="6.10.1" />
<PackageVersion Include="Octokit" Version="13.0.1" />
<PackageVersion Include="Serilog" Version="4.0.0" />
<PackageVersion Include="Serilog.Formatting.Compact" Version="3.0.0" />
<PackageVersion Include="Serilog.Formatting.Compact.Reader" Version="4.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="Serilog.Sinks.File" Version="6.0.0" />
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Text.Json" Version="8.0.3" />
<PackageVersion Include="YamlDotNet" Version="15.3.0" />
<PackageVersion Include="matkoch.spectre.console" Version="0.46.0" />
</ItemGroup>

<!-- Testing -->
<ItemGroup>
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="TeamCity.VSTest.TestAdapter" Version="1.0.40" />
<PackageVersion Include="Verify.Xunit" Version="25.3.0" />
<PackageVersion Include="Verify.DiffPlex" Version="3.0.0" />
<PackageVersion Include="Verify.SourceGenerators" Version="2.2.0" />
<PackageVersion Include="xunit" Version="2.8.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
</ItemGroup>

<!-- Roslyn (Nuke.SourceGenerator + Nuke.GlobalTool) -->
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.10.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.10.0" />
</ItemGroup>

<!-- MSBuild (Nuke.ProjectModel + Nuke.MSBuildTasks) -->
<ItemGroup>
<PackageVersion Include="Microsoft.Build.Locator" Version="1.7.8" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.10.4" />
<PackageVersion Include="Microsoft.Build.Framework" Version="17.10.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageVersion Include="Microsoft.Build" Version="17.9.5" />
<PackageVersion Include="Microsoft.Build.Framework" Version="17.9.5" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="17.9.5" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.9.5" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageVersion Include="Microsoft.Build" Version="17.5.0" />
<PackageVersion Include="Microsoft.Build.Framework" Version="17.5.0" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="17.5.0" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.5.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageVersion Include="Microsoft.Build" Version="16.9.0" />
<PackageVersion Include="Microsoft.Build.Framework" Version="16.9.0" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="16.9.0" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="16.9.0" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>.\..</NukeRootDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</PropertyGroup>

<!-- Test properties for MSBuild integration -->
Expand Down
20 changes: 10 additions & 10 deletions source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="$(MSBuildProjectName.EndsWith('Tests'))">
<PackageReference Include="coverlet.msbuild" Version="6.0.2" />
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="TeamCity.VSTest.TestAdapter" Version="1.0.40"/>
<PackageReference Include="Verify.Xunit" Version="25.0.2" />
<PackageReference Include="Verify.DiffPlex" Version="2.3.0" />
<PackageReference Include="xunit" Version="2.8.1"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"/>
<PackageReference Include="coverlet.msbuild" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="GitHubActionsTestLogger" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="TeamCity.VSTest.TestAdapter" />
<PackageReference Include="Verify.Xunit" />
<PackageReference Include="Verify.DiffPlex" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion source/Nuke.Build.Shared/Nuke.Build.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>

</Project>
14 changes: 7 additions & 7 deletions source/Nuke.Build/Nuke.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.22.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageReference Include="NJsonSchema" Version="10.9.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
<PackageReference Include="Serilog.Formatting.Compact.Reader" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" />
<PackageReference Include="NJsonSchema" />
<PackageReference Include="Serilog.Formatting.Compact" />
<PackageReference Include="Serilog.Formatting.Compact.Reader" />
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Serilog.Sinks.File" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions source/Nuke.Common/Nuke.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.11.4" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.6.0" />
<PackageReference Include="Azure.Security.KeyVault.Keys" Version="4.6.0" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.6.0" />
<PackageReference Include="Octokit" Version="12.0.0" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" />
<PackageReference Include="Octokit" />
</ItemGroup>

<ItemGroup Condition="'$(_IsPacking)' == 'True'">
Expand Down
8 changes: 4 additions & 4 deletions source/Nuke.GlobalTool/Nuke.GlobalTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="matkoch.spectre.console" Version="0.46.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.10.0" />
<PackageReference Include="matkoch.spectre.console" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions source/Nuke.MSBuildTasks/Nuke.MSBuildTasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NuGet.Packaging" Version="6.10.0" />
<PackageReference Include="NuGet.Packaging" />
</ItemGroup>

<ItemGroup>
<!-- MSBuild and dependencies only acquired through MSBuild shall not make it into the final package -->
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.10.4" CopyLocal="false" Publish="false" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.10.4" CopyLocal="false" Publish="false" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Utilities.Core" CopyLocal="false" Publish="false" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Framework" CopyLocal="false" Publish="false" ExcludeAssets="runtime" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions source/Nuke.ProjectModel.Tests/ProjectModelTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public void MSBuildProjectTest()
var solution = SolutionModelTasks.ParseSolution(SolutionFile);
var project = solution.Projects.Single(x => x.Name == "Nuke.ProjectModel");

var msbuildProject = project.GetMSBuildProject(targetFramework: "net6.0");
var msbuildProject = project.GetMSBuildProject(targetFramework: "net8.0");

var package = msbuildProject.GetItems("PackageReference").FirstOrDefault(x => x.EvaluatedInclude == "Microsoft.Build");
var package = msbuildProject.GetItems("PackageVersion").FirstOrDefault(x => x.EvaluatedInclude == "Microsoft.Build");
package.Should().NotBeNull();
package.GetMetadataValue("Version").Should().Be("16.9.0");
package.GetMetadataValue("Version").Should().Be("17.9.5");
}
}
27 changes: 5 additions & 22 deletions source/Nuke.ProjectModel/Nuke.ProjectModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Locator" Version="1.7.8" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Build" Version="17.9.5" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.9.5" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.9.5" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.9.5" ExcludeAssets="runtime" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.Build" Version="17.5.0" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.5.0" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.5.0" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.5.0" ExcludeAssets="runtime" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.Build" Version="16.9.0" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Framework" Version="16.9.0" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="16.9.0" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.9.0" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Locator" />
<PackageReference Include="Microsoft.Build" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Framework" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Tasks.Core" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="runtime" />
</ItemGroup>

</Project>
5 changes: 4 additions & 1 deletion source/Nuke.ProjectModel/Project.Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ public static bool HasPackageReference(this Project project, string packageId)
/// </summary>
public static string GetPackageReferenceVersion(this Project project, string packageId)
{
return project.GetItemMetadataSingleOrDefault("PackageReference", packageId, "Version");
var version = project.GetItemMetadataSingleOrDefault("PackageReference", packageId, "Version");
return version == string.Empty
? project.GetItemMetadataSingleOrDefault("PackageVersion", packageId, "Version")
: null;
}

[CanBeNull]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
<PackageReference Include="Verify.SourceGenerators" Version="2.2.0" />
<PackageReference Include="Basic.Reference.Assemblies.NetStandard20" Version="1.7.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
<PackageReference Include="Verify.SourceGenerators" />
<PackageReference Include="Basic.Reference.Assemblies.NetStandard20" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions source/Nuke.SourceGenerators/Nuke.SourceGenerators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" VersionOverride="4.7.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" PrivateAssets="all" GeneratePathProperty="true" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions source/Nuke.Tooling.Generator/Nuke.Tooling.Generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.61" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Humanizer" Version="2.14.1" />
<PackageReference Include="Serilog" Version="4.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="HtmlAgilityPack" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="Humanizer" />
<PackageReference Include="Serilog" />
<PackageReference Include="System.ComponentModel.Annotations" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions source/Nuke.Tooling/Nuke.Tooling.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NuGet.Packaging" Version="6.10.0" />
<PackageReference Include="Serilog" Version="4.0.0" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NuGet.Packaging" />
<PackageReference Include="Serilog" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="SharpZipLib" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Glob" Version="1.1.9"/>
<PackageReference Include="Glob" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions source/Nuke.Utilities.Net/Nuke.Utilities.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.Net.Http" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="YamlDotNet" Version="15.1.6" />
<PackageReference Include="YamlDotNet" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion source/Nuke.Utilities/Nuke.Utilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="JetBrains.Annotations" />
</ItemGroup>

</Project>

0 comments on commit 85998da

Please sign in to comment.