From 18fe7c8b1a1136bf553b833177ea2637bbc52b5c Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Mon, 28 Oct 2019 12:14:47 +0000 Subject: [PATCH 01/12] Bump SourceLink to beta2 --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 1df4c543..055e017a 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -19,6 +19,6 @@ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - + From 91a3780ff647c53f591699419346da4172a3b53b Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Mon, 28 Oct 2019 12:15:50 +0000 Subject: [PATCH 02/12] Add support for Debian and Ubuntu on ARM64 --- .../RuntimeIdMap.cs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Nerdbank.GitVersioning.Tasks/RuntimeIdMap.cs b/src/Nerdbank.GitVersioning.Tasks/RuntimeIdMap.cs index a22e250b..168d0c0a 100644 --- a/src/Nerdbank.GitVersioning.Tasks/RuntimeIdMap.cs +++ b/src/Nerdbank.GitVersioning.Tasks/RuntimeIdMap.cs @@ -166,6 +166,7 @@ internal static void ParseRuntimeId(string runtimeId, out string osName, out str "centos.7-x64", "debian-x64", "debian.8-x64", + "debian.9-arm64", "debian.9-x64", "fedora-x64", "fedora.23-x64", @@ -237,12 +238,22 @@ internal static void ParseRuntimeId(string runtimeId, out string osName, out str "ubuntu.14.10-x64", "ubuntu.15.04-x64", "ubuntu.15.10-x64", + "ubuntu.16.04-arm64", "ubuntu.16.04-x64", + "ubuntu.16.10-arm64", "ubuntu.16.10-x64", + "ubuntu.17.04-arm64", "ubuntu.17.04-x64", + "ubuntu.17.10-arm64", "ubuntu.17.10-x64", + "ubuntu.18.04-arm64", "ubuntu.18.04-x64", + "ubuntu.18.10-arm64", "ubuntu.18.10-x64", + "ubuntu.19.04-arm64", + "ubuntu.19.04-x64", + "ubuntu.19.10-arm64", + "ubuntu.19.10-x64", "win-x64", "win-x64-aot", "win-x86", @@ -296,6 +307,7 @@ internal static void ParseRuntimeId(string runtimeId, out string osName, out str "linux-x64", "linux-x64", "linux-x64", + "debian.9-arm64", "ubuntu.18.04-x64", "rhel-x64", "rhel-x64", @@ -347,12 +359,22 @@ internal static void ParseRuntimeId(string runtimeId, out string osName, out str "linux-x64", "linux-x64", "linux-x64", + "ubuntu.16.04-arm64", "linux-x64", + "ubuntu.16.10-arm64", "linux-x64", + "ubuntu.16.04-arm64", "linux-x64", + "ubuntu.16.04-arm64", "linux-x64", + "debian.9-arm64", + "ubuntu.18.04-x64", + "debian.9-arm64", + "ubuntu.18.04-x64", + "debian.9-arm64", + "ubuntu.18.04-x64", + "debian.9-arm64", "ubuntu.18.04-x64", - "linux-x64", "win-x64", "win-x64", "win-x86", From 2422be7afed0fa2fc73bfd8cdd43312b9e64604a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 28 Oct 2019 06:47:04 -0600 Subject: [PATCH 03/12] Enable Ubuntu 19 testing --- azure-pipelines.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e51f6b4a..8823f3c4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -149,6 +149,14 @@ jobs: steps: - template: azure-pipelines/xplattest-pipeline.yml +- job: Ubuntu_Disco + dependsOn: Windows + pool: + vmImage: Ubuntu 16.04 # not a bug. we always use this pool, but use containers for the specific version + container: disco + steps: + - template: azure-pipelines/xplattest-pipeline.yml + - job: macOS dependsOn: Windows pool: From 1a1811365eef4576865e7f2b50df6fdd6b3eaa64 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Sun, 17 Nov 2019 11:20:44 +0100 Subject: [PATCH 04/12] Test on bionic using both .NET Core 2.1 and 3.0 --- azure-pipelines.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8823f3c4..3ef928fd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,6 +18,10 @@ resources: image: andrewarnott/linux-buildagent - container: bionic image: microsoft/dotnet:2.1-sdk-bionic + - container: bionic-3.0 + image: mcr.microsoft.com/dotnet/core/sdk:3.0-bionic + - container: disco + image: mcr.microsoft.com/dotnet/core/sdk:3.0-disco jobs: - job: Windows @@ -149,6 +153,14 @@ jobs: steps: - template: azure-pipelines/xplattest-pipeline.yml +- job: Ubuntu_Bionic_3_0 + dependsOn: Windows + pool: + vmImage: Ubuntu 16.04 # not a bug. we always use this pool, but use containers for the specific version + container: bionic-3.0 + steps: + - template: azure-pipelines/xplattest-pipeline.yml + - job: Ubuntu_Disco dependsOn: Windows pool: From 57883593102a018e660fb04f45edf59a1126321b Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Sun, 17 Nov 2019 13:27:42 +0100 Subject: [PATCH 05/12] Use NuGet sources --- azure-pipelines/xplattest-pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/xplattest-pipeline.yml b/azure-pipelines/xplattest-pipeline.yml index 599a3705..9fad686f 100644 --- a/azure-pipelines/xplattest-pipeline.yml +++ b/azure-pipelines/xplattest-pipeline.yml @@ -20,7 +20,7 @@ steps: NBGV_NuGetPackageVersion=$([[ $PkgFileName =~ Nerdbank.GitVersioning\.(.*)\.nupkg ]] && echo "${BASH_REMATCH[1]}") - echo "" > nuget.config && + echo "" > nuget.config && dotnet new classlib -o lib && cd lib && echo '{"version":"42.42"}' > version.json && From 53d03171e7a78e2d7ba2bc836448241ac5a6a741 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Sun, 17 Nov 2019 22:52:30 +0100 Subject: [PATCH 06/12] nbgv: Load the libgit native libraries using the GitLoaderContext --- .../GitLoaderContext.cs | 10 +++++++++- src/nbgv/Program.cs | 15 +++++++++++++++ src/nbgv/nbgv.csproj | 5 +++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/Nerdbank.GitVersioning.Tasks/GitLoaderContext.cs b/src/Nerdbank.GitVersioning.Tasks/GitLoaderContext.cs index b5d5fb31..36f85eee 100644 --- a/src/Nerdbank.GitVersioning.Tasks/GitLoaderContext.cs +++ b/src/Nerdbank.GitVersioning.Tasks/GitLoaderContext.cs @@ -15,6 +15,14 @@ internal class GitLoaderContext : AssemblyLoadContext { public static readonly GitLoaderContext Instance = new GitLoaderContext(); + // When invoked as a MSBuild task, the native libraries will be at + // ../runtimes. When invoked from the nbgv CLI, the libraries + // will be at ./runtimes. + // This property allows code which consumes GitLoaderContext to + // differentiate between these different locations. + // In the case of the nbgv CLI, the value is set in Program.Main() + public static string RuntimePath = "../runtimes"; + protected override Assembly Load(AssemblyName assemblyName) { var path = Path.Combine(Path.GetDirectoryName(typeof(GitLoaderContext).Assembly.Location), assemblyName.Name + ".dll"); @@ -53,7 +61,7 @@ protected override IntPtr LoadUnmanagedDll(string unmanagedDllName) internal static string GetNativeLibraryDirectory() { var dir = Path.GetDirectoryName(typeof(GitLoaderContext).Assembly.Location); - return Path.Combine(dir, "..", "runtimes", RuntimeIdMap.GetNativeLibraryDirectoryName(RuntimeEnvironment.GetRuntimeIdentifier()), "native"); + return Path.Combine(dir, RuntimePath, RuntimeIdMap.GetNativeLibraryDirectoryName(RuntimeEnvironment.GetRuntimeIdentifier()), "native"); } private static string GetNativeLibraryExtension() diff --git a/src/nbgv/Program.cs b/src/nbgv/Program.cs index d39d0a9a..58020fcc 100644 --- a/src/nbgv/Program.cs +++ b/src/nbgv/Program.cs @@ -56,6 +56,21 @@ private enum ExitCodes private static ExitCodes exitCode; public static int Main(string[] args) + { + GitLoaderContext.RuntimePath = "./runtimes"; + + string thisAssemblyPath = new Uri(typeof(Program).GetTypeInfo().Assembly.CodeBase).LocalPath; + + Assembly inContextAssembly = GitLoaderContext.Instance.LoadFromAssemblyPath(thisAssemblyPath); + Type innerProgramType = inContextAssembly.GetType(typeof(Program).FullName); + object innerProgram = Activator.CreateInstance(innerProgramType); + + var mainInnerMethod = innerProgramType.GetMethod(nameof(MainInner), BindingFlags.Static | BindingFlags.NonPublic); + int result = (int)mainInnerMethod.Invoke(null, new object[] { args }); + return result; + } + + private static int MainInner(string[] args) { var commandText = string.Empty; var projectPath = string.Empty; diff --git a/src/nbgv/nbgv.csproj b/src/nbgv/nbgv.csproj index 721f8152..f3a4dbf1 100644 --- a/src/nbgv/nbgv.csproj +++ b/src/nbgv/nbgv.csproj @@ -18,6 +18,11 @@ + + + + + From 3baf1d95bd5202733755667c0cf5d1bdcc9b3e2e Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Mon, 18 Nov 2019 10:18:06 +0100 Subject: [PATCH 07/12] Use LibGit2Sharp.NativeBinaries 2.0.280-armpreview01 --- src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj | 4 ++++ .../Nerdbank.GitVersioning.Tasks.csproj | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj b/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj index 374c0e29..113cc7b3 100644 --- a/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj +++ b/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj @@ -9,6 +9,10 @@ + + diff --git a/src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.Tasks.csproj b/src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.Tasks.csproj index 14bd1aa8..8e7fd062 100644 --- a/src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.Tasks.csproj +++ b/src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.Tasks.csproj @@ -18,7 +18,7 @@ - $(NuGetPackageRoot)libgit2sharp.nativebinaries\2.0.278\ + $(NuGetPackageRoot)libgit2sharp.nativebinaries\2.0.280-armpreview01\ $(NuspecProperties);Version=$(Version);commit=$(GitCommitId);BaseOutputPath=$(OutputPath);LibGit2SharpNativeBinaries=$(LibGit2SharpNativeBinaries) From de336dd5cbf21a631153eebcad0fc678cd8bd679 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Mon, 18 Nov 2019 10:18:27 +0100 Subject: [PATCH 08/12] Update RID for Debian --- src/Nerdbank.GitVersioning.Tasks/RuntimeIdMap.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Nerdbank.GitVersioning.Tasks/RuntimeIdMap.cs b/src/Nerdbank.GitVersioning.Tasks/RuntimeIdMap.cs index 168d0c0a..8f0c79b8 100644 --- a/src/Nerdbank.GitVersioning.Tasks/RuntimeIdMap.cs +++ b/src/Nerdbank.GitVersioning.Tasks/RuntimeIdMap.cs @@ -367,13 +367,13 @@ internal static void ParseRuntimeId(string runtimeId, out string osName, out str "linux-x64", "ubuntu.16.04-arm64", "linux-x64", - "debian.9-arm64", + "debian-arm64", "ubuntu.18.04-x64", - "debian.9-arm64", + "debian-arm64", "ubuntu.18.04-x64", - "debian.9-arm64", + "debian-arm64", "ubuntu.18.04-x64", - "debian.9-arm64", + "debian-arm64", "ubuntu.18.04-x64", "win-x64", "win-x64", From a9005dd2f30bef3f6e73d8d3617de17a28ce7a05 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Wed, 20 Nov 2019 10:00:42 +0100 Subject: [PATCH 09/12] Download a newer version of LibGit2Sharp.NativeBinaries --- src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj b/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj index 113cc7b3..c901086d 100644 --- a/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj +++ b/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj @@ -9,10 +9,10 @@ - - + From 356f467d54767e400d79a4c6ef8b37b8d239996d Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Wed, 20 Nov 2019 10:24:23 +0100 Subject: [PATCH 10/12] Use .NET Core 2.2.402 SDK --- azure-pipelines.yml | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3ef928fd..280e8482 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -39,7 +39,7 @@ jobs: displayName: Install .NET Core SDK inputs: packageType: sdk - version: 2.1.500 + version: 2.2.402 - script: dotnet --info displayName: Show dotnet SDK info diff --git a/global.json b/global.json index b62f6cc5..89b3b0f4 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "2.1.500" + "version": "2.2.402" } } From fbfe2c1fac1926bba7f291a685dc6345af0d2c73 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Wed, 20 Nov 2019 11:07:01 +0100 Subject: [PATCH 11/12] Use dotnet publish to publish nbgv for npm --- azure-pipelines.yml | 4 ++++ src/nbgv/nbgv.csproj | 14 -------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 280e8482..4075f576 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -69,6 +69,10 @@ jobs: displayName: Build NuGet package and tests workingDirectory: src + - script: dotnet publish -c $(BuildConfiguration) -o ..\nerdbank-gitversioning.npm\out\nbgv.cli\tools\netcoreapp2.1\any /bl:"$(Build.ArtifactStagingDirectory)/build_logs/msbuild.binlog" + displayName: Build NuGet package and tests + workingDirectory: src\nbgv + - task: gulp@0 displayName: Build nerdbank-gitversioning NPM package inputs: diff --git a/src/nbgv/nbgv.csproj b/src/nbgv/nbgv.csproj index f3a4dbf1..a315294b 100644 --- a/src/nbgv/nbgv.csproj +++ b/src/nbgv/nbgv.csproj @@ -26,18 +26,4 @@ - - - - ..\nerdbank-gitversioning.npm\out\nbgv.cli\ - - - - $(NpmPackageLayoutDir)$([System.IO.Path]::GetDirectoryName('%(_PackageFiles.PackagePath)'))\%(FileName)%(Extension) - $(NpmPackageLayoutDir)%(FileName)%(Extension) - - - - - From 24c1dc4f59fcddabb0a8ca7d9e978b101d0e90d1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 20 Nov 2019 12:05:18 -0700 Subject: [PATCH 12/12] Minor cleanup --- azure-pipelines.yml | 2 +- .../NerdBank.GitVersioning.csproj | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4075f576..60de404c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -69,7 +69,7 @@ jobs: displayName: Build NuGet package and tests workingDirectory: src - - script: dotnet publish -c $(BuildConfiguration) -o ..\nerdbank-gitversioning.npm\out\nbgv.cli\tools\netcoreapp2.1\any /bl:"$(Build.ArtifactStagingDirectory)/build_logs/msbuild.binlog" + - script: dotnet publish -c $(BuildConfiguration) -o ..\nerdbank-gitversioning.npm\out\nbgv.cli\tools\netcoreapp2.1\any /bl:"$(Build.ArtifactStagingDirectory)/build_logs/nbgv_publish.binlog" displayName: Build NuGet package and tests workingDirectory: src\nbgv diff --git a/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj b/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj index c901086d..b7111d8d 100644 --- a/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj +++ b/src/NerdBank.GitVersioning/NerdBank.GitVersioning.csproj @@ -9,16 +9,18 @@ - - + + + +