Skip to content

Commit 1eacfff

Browse files
authored
Centralize shared Build/Src package versions (#822)
* Refine versions * Reviewer comments
1 parent 552a2a4 commit 1eacfff

3 files changed

Lines changed: 32 additions & 16 deletions

File tree

Build/Src/Directory.Packages.props

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
<Project>
2+
<!--
3+
Build/Src uses the repo root CPM file as its baseline, then layers only the
4+
few build-tool-specific deltas that genuinely differ from application code.
5+
NuGet auto-imports only the nearest Directory.Packages.props, so parent CPM
6+
settings must be imported manually.
7+
-->
28
<PropertyGroup>
3-
<!--
4-
Build infrastructure projects (FwBuildTasks, NativeBuild) manage their own
5-
package versions independently. They do not contribute assemblies to the
6-
shared Output/ directory, so CPM transitive pinning does not apply here.
7-
FwBuildTasks also requires different versions of test infrastructure packages
8-
(NUnit3TestAdapter 5.2.0, SIL.TestUtilities 12.0.0-*) than the main codebase.
9-
-->
10-
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
9+
<RootDirectoryPackagesProps>$([MSBuild]::GetPathOfFileAbove('Directory.Packages.props', '$(MSBuildThisFileDirectory)..'))</RootDirectoryPackagesProps>
1110
</PropertyGroup>
11+
12+
<Import Project="$(RootDirectoryPackagesProps)" Condition="Exists('$(RootDirectoryPackagesProps)')" />
13+
14+
<Target Name="EnsureRootDirectoryPackagesPropsExists" BeforeTargets="CollectPackageReferences" Condition="'$(RootDirectoryPackagesProps)' == '' Or !Exists('$(RootDirectoryPackagesProps)')">
15+
<Error Text="Unable to locate the repo root Directory.Packages.props for Build/Src. Expected to find a parent Directory.Packages.props above '$(MSBuildThisFileDirectory)'. Ensure the root CPM file exists and has not been renamed or omitted from the current source checkout." />
16+
</Target>
17+
18+
<!-- Use Update for root-pinned packages and Include for build-only packages absent from the root CPM file. -->
19+
<ItemGroup Label="Build Tool Package Versions">
20+
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="18.4.0" />
21+
<PackageVersion Update="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
22+
<PackageVersion Update="NUnit3TestAdapter" Version="5.2.0" />
23+
<PackageVersion Include="SIL.BuildTasks" Version="3.2.0" />
24+
<PackageVersion Update="SIL.TestUtilities" Version="12.0.1" />
25+
</ItemGroup>
1226
</Project>

Build/Src/FwBuildTasks/FwBuildTasks.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
<Prefer32Bit>false</Prefer32Bit>
2222
</PropertyGroup>
2323
<ItemGroup>
24-
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="18.4.0" />
25-
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
26-
<PackageReference Include="NUnit" Version="3.14.0" PrivateAssets="All" />
27-
<PackageReference Include="NUnit3TestAdapter" Version="5.2.0" PrivateAssets="All" />
28-
<PackageReference Include="SIL.BuildTasks" Version="3.2.0" />
29-
<PackageReference Include="SIL.TestUtilities" Version="12.0.1" PrivateAssets="All" />
30-
<PackageReference Include="System.Reflection.Metadata" Version="9.0.14" />
31-
<PackageReference Include="System.Resources.Extensions" Version="9.0.14" />
24+
<PackageReference Include="Microsoft.Build.Utilities.Core" />
25+
<PackageReference Include="Microsoft.Extensions.DependencyModel" />
26+
<PackageReference Include="NUnit" PrivateAssets="All" />
27+
<PackageReference Include="NUnit3TestAdapter" PrivateAssets="All" />
28+
<PackageReference Include="SIL.BuildTasks" />
29+
<PackageReference Include="SIL.TestUtilities" PrivateAssets="All" />
30+
<PackageReference Include="System.Reflection.Metadata" />
31+
<PackageReference Include="System.Resources.Extensions" />
3232
<Reference Include="netstandard" />
3333
<Reference Include="Microsoft.Build.Framework" />
3434
<Reference Include="System.IO.Compression" />

Build/Src/NativeBuild/NativeBuild.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<PropertyGroup>
1818
<Platform Condition="'$(Platform)'==''">x64</Platform>
1919
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
20+
<!-- NativeBuild keeps explicit package versions because it is a traditional MSBuild project. -->
21+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
2022
<!-- Set fwrt early so NuGet package restore can find packages -->
2123
<fwrt>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\..'))</fwrt>
2224
<!--

0 commit comments

Comments
 (0)