Skip to content

Commit 49ff64c

Browse files
committed
Drop .NET Core 3.1 support
It falls out of its LTS support early next month.
1 parent b40f861 commit 49ff64c

File tree

19 files changed

+63
-75
lines changed

19 files changed

+63
-75
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:6.0.301-focal
1+
FROM mcr.microsoft.com/dotnet/sdk:6.0.403-focal
22

33
# Installing mono makes `dotnet test` work without errors even for net472.
44
# But installing it takes a long time, so it's excluded by default.

azure-pipelines.yml

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ parameters:
2121

2222
resources:
2323
containers:
24-
- container: xenial
25-
image: andrewarnott/linux-buildagent
26-
- container: bionic
27-
image: mcr.microsoft.com/dotnet/core/sdk:3.1-bionic
2824
- container: focal
29-
image: mcr.microsoft.com/dotnet/core/sdk:3.1-focal
30-
- container: archlinux
31-
image: andrewarnott/archlinux
25+
image: mcr.microsoft.com/dotnet/sdk:6.0-focal
26+
- container: jammy60
27+
image: mcr.microsoft.com/dotnet/sdk:6.0-jammy
28+
- container: jammy70
29+
image: mcr.microsoft.com/dotnet/sdk:7.0-jammy
30+
- container: debian
31+
image: mcr.microsoft.com/dotnet/sdk:latest
3232

3333
variables:
3434
TreatWarningsAsErrors: true
@@ -53,18 +53,16 @@ stages:
5353
- job: linux
5454
strategy:
5555
matrix:
56-
# xenial:
57-
# containerImage: xenial
58-
# configureContainerCommand: 'sudo apt update && sudo apt-get install -y git'
59-
Ubuntu_Bionic:
60-
containerImage: bionic
6156
Ubuntu_Focal:
6257
containerImage: focal
63-
# Arch_Linux:
64-
# containerImage: archlinux
65-
# configureContainerCommand: 'sudo pacman -Sy --noconfirm git dotnet-sdk openssl-1.0'
58+
Ubuntu_Jammy_60:
59+
containerImage: jammy60
60+
Ubuntu_Jammy_70:
61+
containerImage: jammy70
62+
Debian:
63+
containerImage: debian
6664
pool:
67-
vmImage: ubuntu-20.04
65+
vmImage: ubuntu-22.04
6866
container: $[ variables['containerImage'] ]
6967
steps:
7068
- bash: $(configureContainerCommand)
@@ -92,7 +90,7 @@ stages:
9290
strategy:
9391
matrix:
9492
ubuntu:
95-
imageName: ubuntu-20.04
93+
imageName: ubuntu-22.04
9694
repoDir: '~/git'
9795
windows:
9896
imageName: windows-2022
@@ -104,15 +102,10 @@ stages:
104102
vmImage: $(imageName)
105103
steps:
106104
- task: UseDotNet@2
107-
displayName: Install .NET Core 3.1 runtime
108-
inputs:
109-
packageType: runtime
110-
version: 3.1.x
111-
- task: UseDotNet@2
112-
displayName: Install .NET 6.0.301 SDK
105+
displayName: Install .NET 6.0.403 SDK
113106
inputs:
114107
packageType: sdk
115-
version: 6.0.301
108+
version: 6.0.403
116109
- script: dotnet --info
117110
displayName: Show dotnet SDK info
118111
- bash: |
@@ -126,7 +119,7 @@ stages:
126119
dotnet build -c Release
127120
displayName: Build in Release mode
128121
- script: |
129-
dotnet run -c Release -f netcoreapp3.1 -- --filter *GetVersionBenchmarks* --artifacts $(Build.ArtifactStagingDirectory)/benchmarks/packed/$(imageName)
122+
dotnet run -c Release -f net6.0 -- --filter *GetVersionBenchmarks* --artifacts $(Build.ArtifactStagingDirectory)/benchmarks/packed/$(imageName)
130123
workingDirectory: test/Nerdbank.GitVersioning.Benchmarks
131124
displayName: Run benchmarks (packed)
132125
- bash: |
@@ -143,7 +136,7 @@ stages:
143136
git unpack-objects < .git/objects/pack/*.pack
144137
displayName: Unpack Git repositories
145138
- script: |
146-
dotnet run -c Release -f netcoreapp3.1 -- --filter '*GetVersionBenchmarks*' --artifacts $(Build.ArtifactStagingDirectory)/benchmarks/unpacked/$(imageName)
139+
dotnet run -c Release -f net6.0 -- --filter '*GetVersionBenchmarks*' --artifacts $(Build.ArtifactStagingDirectory)/benchmarks/unpacked/$(imageName)
147140
workingDirectory: test/Nerdbank.GitVersioning.Benchmarks
148141
displayName: Run benchmarks (unpacked)
149142
- task: PublishBuildArtifacts@1

azure-pipelines/build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ jobs:
2323
- template: install-dependencies.yml
2424
- pwsh: |
2525
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
26-
& .\dotnet-install.ps1 -Architecture x86 -Channel 3.1 -InstallDir "C:\Program Files (x86)\dotnet\" -NoPath -Verbose -Runtime dotnet
27-
& .\dotnet-install.ps1 -Architecture x86 -Version 6.0.301 -InstallDir "C:\Program Files (x86)\dotnet\" -NoPath -Verbose
26+
& .\dotnet-install.ps1 -Architecture x86 -Version 6.0.403 -InstallDir "C:\Program Files (x86)\dotnet\" -NoPath -Verbose
2827
displayName: ⚙ Install 32-bit .NET SDK and runtimes
2928
3029
- powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud -c'

azure-pipelines/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ steps:
1515
displayName: Build LKG package
1616
workingDirectory: src/Nerdbank.GitVersioning.Tasks
1717

18-
- script: dotnet publish -c $(BuildConfiguration) -o ../nerdbank-gitversioning.npm/out/nbgv.cli/tools/netcoreapp3.1/any /bl:"$(Build.ArtifactStagingDirectory)/build_logs/nbgv_publish.binlog"
18+
- script: dotnet publish -c $(BuildConfiguration) -o ../nerdbank-gitversioning.npm/out/nbgv.cli/tools/net6.0/any /bl:"$(Build.ArtifactStagingDirectory)/build_logs/nbgv_publish.binlog"
1919
displayName: Publish nbgv tool
2020
workingDirectory: src/nbgv
2121

azure-pipelines/xplattest-pipeline.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,6 @@ steps:
4343
failOnStderr: true
4444

4545
- script: >
46-
# Uses dotnet commands that require at least 3.x
47-
48-
DNVERSION=$(dotnet --version)
49-
50-
if [[ $DNVERSION == 2.* ]] ;
51-
then
52-
echo "Skipping .NET Core $DNVERSION"
53-
exit 0
54-
else
55-
echo ".NET Core $DNVERSION"
56-
fi
57-
5846
PkgFileName=$(ls deployables-Windows/Cake.GitVersioning.*nupkg)
5947
6048
NBGV_NuGetPackageVersion=$([[ $PkgFileName =~ Cake.GitVersioning\.(.*)\.nupkg ]] && echo "${BASH_REMATCH[1]}")
@@ -65,7 +53,7 @@ steps:
6553
cd caketest &&
6654
git init &&
6755
dotnet new tool-manifest &&
68-
dotnet tool install Cake.Tool --version 2.3.0
56+
dotnet tool install Cake.Tool
6957
7058
echo "#addin nuget:?package=Cake.GitVersioning&version=${NBGV_NuGetPackageVersion}&prerelease=true"
7159

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.301",
3+
"version": "6.0.403",
44
"rollForward": "patch",
55
"allowPrerelease": false
66
}

src/Cake.GitVersioning/Cake.GitVersioning.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<Authors>Chris Crutchfield, Andrew Arnott</Authors>
77
<Company>andarno</Company>
@@ -37,14 +37,14 @@
3737
<None Include="cake-contrib-addin-medium.png" Pack="true" PackagePath="" />
3838

3939
<!-- Include native binaries -->
40-
<None Include="$(LibGit2SharpNativeBinaries)runtimes\**\*.*" Pack="true" PackagePath="lib\netcoreapp3.1\lib\" LinkBase="lib" />
40+
<None Include="$(LibGit2SharpNativeBinaries)runtimes\**\*.*" Pack="true" PackagePath="lib\net6.0\lib\" LinkBase="lib" />
4141

4242
<!-- Additional copies to work around DllNotFoundException on Mono (https://github.com/AArnott/Nerdbank.GitVersioning/issues/222) -->
43-
<None Include="$(LibGit2SharpNativeBinaries)runtimes\osx-x64\native\*.dylib" Pack="true" PackagePath="lib\netcoreapp3.1\lib\osx\x86_64\" LinkBase="lib\osx\x86_64" />
44-
<None Include="$(LibGit2SharpNativeBinaries)runtimes\osx-arm64\native\*.dylib" Pack="true" PackagePath="lib\netcoreapp3.1\lib\osx\arm_64\" LinkBase="lib\arm64\arm_64" />
45-
<None Include="$(LibGit2SharpNativeBinaries)runtimes\linux-x64\native\*.so" Pack="true" PackagePath="lib\netcoreapp3.1\lib\linux\x86_64\" LinkBase="lib\linux\x86_64" />
46-
<None Include="$(LibGit2SharpNativeBinaries)runtimes\win-x64\native\*.dll" Pack="true" PackagePath="lib\netcoreapp3.1\lib\win32\x64\" LinkBase="lib\win32\x64" />
47-
<None Include="$(LibGit2SharpNativeBinaries)runtimes\win-x86\native\*.dll" Pack="true" PackagePath="lib\netcoreapp3.1\lib\win32\x86\" LinkBase="lib\win32\x86" />
43+
<None Include="$(LibGit2SharpNativeBinaries)runtimes\osx-x64\native\*.dylib" Pack="true" PackagePath="lib\net6.0\lib\osx\x86_64\" LinkBase="lib\osx\x86_64" />
44+
<None Include="$(LibGit2SharpNativeBinaries)runtimes\osx-arm64\native\*.dylib" Pack="true" PackagePath="lib\net6.0\lib\osx\arm_64\" LinkBase="lib\arm64\arm_64" />
45+
<None Include="$(LibGit2SharpNativeBinaries)runtimes\linux-x64\native\*.so" Pack="true" PackagePath="lib\net6.0\lib\linux\x86_64\" LinkBase="lib\linux\x86_64" />
46+
<None Include="$(LibGit2SharpNativeBinaries)runtimes\win-x64\native\*.dll" Pack="true" PackagePath="lib\net6.0\lib\win32\x64\" LinkBase="lib\win32\x64" />
47+
<None Include="$(LibGit2SharpNativeBinaries)runtimes\win-x86\native\*.dll" Pack="true" PackagePath="lib\net6.0\lib\win32\x86\" LinkBase="lib\win32\x86" />
4848
</ItemGroup>
4949

5050
<ItemGroup>

src/NerdBank.GitVersioning/LibGit2/LibGit2GitExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static ushort GetTruncatedCommitIdAsUInt16(this Commit commit)
8080
/// <exception cref="InvalidOperationException">
8181
/// Thrown in the very rare situation that more than one matching commit is found.
8282
/// </exception>
83-
public static Commit GetCommitFromVersion(LibGit2Context context, Version version)
83+
public static Commit? GetCommitFromVersion(LibGit2Context context, Version version)
8484
{
8585
// Note we'll accept no match, or one match. But we throw if there is more than one match.
8686
return GetCommitsFromVersion(context, version).SingleOrDefault();
@@ -455,7 +455,7 @@ bool ContainsRelevantChanges(IEnumerable<TreeEntryChanges> changes) =>
455455
? changes.Any()
456456
//// If there is a single change that isn't excluded,
457457
//// then this commit is relevant.
458-
: changes.Any(change => !excludePaths.Any(exclude => exclude.Excludes(change.Path, ignoreCase)));
458+
: changes.Any(change => !excludePaths!.Any(exclude => exclude.Excludes(change.Path, ignoreCase)));
459459

460460
int height = 1;
461461

@@ -465,7 +465,7 @@ bool ContainsRelevantChanges(IEnumerable<TreeEntryChanges> changes) =>
465465
// paths refer to the root of the repository, then do not
466466
// filter the diff at all.
467467
List<string>? diffInclude =
468-
includePaths.Count == 0 || pathFilters.Any(filter => filter.IsRoot)
468+
includePaths.Count == 0 || pathFilters!.Any(filter => filter.IsRoot)
469469
? null
470470
: includePaths;
471471

src/NerdBank.GitVersioning/ManagedGit/FileHelpers.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using System.Diagnostics.CodeAnalysis;
77
using System.Runtime.InteropServices;
8+
using System.Runtime.Versioning;
89
using Microsoft.Win32.SafeHandles;
910
using Windows.Win32;
1011
using Windows.Win32.Storage.FileSystem;
@@ -24,7 +25,11 @@ internal static class FileHelpers
2425
/// <returns><see langword="true" /> if the file exists; otherwise <see langword="false" />.</returns>
2526
internal static bool TryOpen(string path, out FileStream? stream)
2627
{
27-
if (IsWindows)
28+
#if NET5_0_OR_GREATER
29+
if (OperatingSystem.IsWindowsVersionAtLeast(5, 1, 2600))
30+
#else
31+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
32+
#endif
2833
{
2934
SafeFileHandle? handle = PInvoke.CreateFile(path, FILE_ACCESS_FLAGS.FILE_GENERIC_READ, FILE_SHARE_MODE.FILE_SHARE_READ, lpSecurityAttributes: null, FILE_CREATION_DISPOSITION.OPEN_EXISTING, FILE_FLAGS_AND_ATTRIBUTES.FILE_ATTRIBUTE_NORMAL, null);
3035

@@ -62,7 +67,11 @@ internal static bool TryOpen(string path, out FileStream? stream)
6267
/// <returns><see langword="true" /> if the file exists; otherwise <see langword="false" />.</returns>
6368
internal static unsafe bool TryOpen(ReadOnlySpan<char> path, [NotNullWhen(true)] out FileStream? stream)
6469
{
65-
if (IsWindows)
70+
#if NET5_0_OR_GREATER
71+
if (OperatingSystem.IsWindowsVersionAtLeast(5, 1, 2600))
72+
#else
73+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
74+
#endif
6675
{
6776
HANDLE handle;
6877
fixed (char* pPath = &path[0])

src/NerdBank.GitVersioning/Nerdbank.GitVersioning.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
44
<GenerateDocumentationFile>true</GenerateDocumentationFile>
55
<DebugType>Full</DebugType>
66
<IsPackable>false</IsPackable>

0 commit comments

Comments
 (0)