From 518ee610d6b8654ac02501fc5fb19bc102ffa717 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 28 Apr 2023 22:10:59 -0600 Subject: [PATCH 1/7] Revert "Disable package signing" This reverts commit 4247b1c4dd6b858d3612d69ca3eb3acd947c9c1f. --- azure-pipelines/dotnet.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 54b1d4e3f..92ffd9701 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -50,7 +50,6 @@ steps: --descriptionUrl 'https://github.com/dotnet/Nerdbank.GitVersioning' displayName: 🔏 Code sign condition: and(succeeded(), eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/andrewarnott/'), eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['Build.Reason'], 'PullRequest')) - enabled: false # signing is broken with the expired cert, I suppose - pwsh: > obj/SignClient sign @@ -64,7 +63,6 @@ steps: --descriptionUrl 'https://github.com/dotnet/Nerdbank.GitVersioning' displayName: 🔏 Code sign LKG condition: and(succeeded(), eq(variables['System.TeamFoundationCollectionUri'], 'https://dev.azure.com/andrewarnott/'), eq(variables['Agent.OS'], 'Windows_NT'), ne(variables['Build.Reason'], 'PullRequest')) - enabled: false # signing is broken with the expired cert, I suppose - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true From d33a5d47eb697f893069b89b9563216aabd09a66 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 10 May 2023 08:24:19 -0600 Subject: [PATCH 2/7] Fix BitBucket recognition of publicReleaseRefSpec BitBucket environment variables do not include the `refs/` prefix, so we need to add them ourselves (as we do for some other cloud build services already). Fixes #935 --- .../CloudBuildServices/BitbucketCloud.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NerdBank.GitVersioning/CloudBuildServices/BitbucketCloud.cs b/src/NerdBank.GitVersioning/CloudBuildServices/BitbucketCloud.cs index ea4592fd7..087fba80d 100644 --- a/src/NerdBank.GitVersioning/CloudBuildServices/BitbucketCloud.cs +++ b/src/NerdBank.GitVersioning/CloudBuildServices/BitbucketCloud.cs @@ -20,10 +20,10 @@ public class BitbucketCloud : ICloudBuild public bool IsPullRequest => !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("BITBUCKET_PR_ID")); /// - public string BuildingBranch => Environment.GetEnvironmentVariable("BITBUCKET_BRANCH"); + public string BuildingBranch => CloudBuild.ShouldStartWith(Environment.GetEnvironmentVariable("BITBUCKET_BRANCH"), "refs/heads/"); /// - public string BuildingTag => Environment.GetEnvironmentVariable("BITBUCKET_TAG"); + public string BuildingTag => CloudBuild.ShouldStartWith(Environment.GetEnvironmentVariable("BITBUCKET_TAG"), "refs/tags/"); /// public string GitCommitId => Environment.GetEnvironmentVariable("BITBUCKET_COMMIT"); From 02d36b23ae84728247310071b1f2b79f67f70fb7 Mon Sep 17 00:00:00 2001 From: kapsiR Date: Thu, 11 May 2023 00:00:25 +0200 Subject: [PATCH 3/7] Downgrade Cake.Core to v2.3.0 This fixes a regression of 3.6.99-alpha+56b1dacf89, Cake v2.x wasn't supported anymore Fixes #934 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index c27742d90..d9cd89906 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -10,7 +10,7 @@ - + From b36f1fe724a1b43ea96b981713c2170bf46e1b39 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 16 May 2023 22:44:27 -0600 Subject: [PATCH 4/7] Revert "Drop BuildMetadata from NPM package version " This reverts commit 5e1adb525ffafaa91f3ae54cc86e10efcdf710b7. Fixes #943 --- src/NerdBank.GitVersioning/VersionOracle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NerdBank.GitVersioning/VersionOracle.cs b/src/NerdBank.GitVersioning/VersionOracle.cs index c3d2160ae..8f43f8c5f 100644 --- a/src/NerdBank.GitVersioning/VersionOracle.cs +++ b/src/NerdBank.GitVersioning/VersionOracle.cs @@ -376,7 +376,7 @@ public IDictionary CloudBuildVersionVars /// /// Gets the version to use for NPM packages. /// - public string NpmPackageVersion => $"{this.Version.ToStringSafe(3)}{this.PrereleaseVersion}"; + public string NpmPackageVersion => this.SemVer2; /// /// Gets a SemVer 1.0 compliant string that represents this version, including the -COMMITID suffix From 4ea125e60bed55a58d6d68b889f59b1d2d084764 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 30 Sep 2023 10:42:06 -0600 Subject: [PATCH 5/7] Fix WPF incremental build Fixes #175 --- .../build/Nerdbank.GitVersioning.targets | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets b/src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets index f617e51ad..bd163e4ed 100644 --- a/src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets +++ b/src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets @@ -119,6 +119,9 @@ $([MSBuild]::NormalizePath('$(IntermediateOutputPath)', '$(AssemblyName).Version$(DefaultLanguageSourceExtension)')) $(VersionSourceFile).new + + $(RootNamespace) + $(_TargetAssemblyProjectName) Date: Mon, 6 Nov 2023 18:39:08 -0700 Subject: [PATCH 6/7] Fix build.ps1 script Closes #992 --- build.ps1 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build.ps1 b/build.ps1 index 269bdaa2d..1d150f01a 100644 --- a/build.ps1 +++ b/build.ps1 @@ -17,10 +17,6 @@ Param( $msbuildCommandLine = "dotnet build `"$PSScriptRoot\Nerdbank.GitVersioning.sln`" /m /verbosity:$MsBuildVerbosity /nologo /p:Platform=`"Any CPU`" /t:build,pack" -if (Test-Path "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll") { - $msbuildCommandLine += " /logger:`"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll`"" -} - if ($Configuration) { $msbuildCommandLine += " /p:Configuration=$Configuration" } @@ -34,6 +30,13 @@ try { } } + if ($PSCmdlet.ShouldProcess('src/nbgv', 'dotnet publish')) { + dotnet publish src/nbgv -c $Configuration -o src/nerdbank-gitversioning.npm/out/nbgv.cli/tools/net6.0/any + if ($LASTEXITCODE -ne 0) { + throw "dotnet publish failed" + } + } + if ($PSCmdlet.ShouldProcess("$PSScriptRoot\src\nerdbank-gitversioning.npm", "gulp")) { cd "$PSScriptRoot\src\nerdbank-gitversioning.npm" yarn install From e1cc3ec65706cdcc8e9d0239099c5a1a3c95de55 Mon Sep 17 00:00:00 2001 From: Richard Webb Date: Tue, 16 Jan 2024 22:04:03 +0000 Subject: [PATCH 7/7] Change F# AssemblyInfo generation to always include a do() after the version attributes --- .../AssemblyVersionInfo.cs | 12 +++++++++++- .../Nerdbank.GitVersioning.Tests/AssemblyInfoTest.cs | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Nerdbank.GitVersioning.Tasks/AssemblyVersionInfo.cs b/src/Nerdbank.GitVersioning.Tasks/AssemblyVersionInfo.cs index 6ff17c7b5..8745d89a6 100644 --- a/src/Nerdbank.GitVersioning.Tasks/AssemblyVersionInfo.cs +++ b/src/Nerdbank.GitVersioning.Tasks/AssemblyVersionInfo.cs @@ -397,6 +397,8 @@ private void GenerateAssemblyAttributes() this.generator.DeclareAttribute(typeof(AssemblyCopyrightAttribute), this.AssemblyCopyright); } } + + this.generator.EndAssemblyAttributes(); } private List> GetFieldsForThisAssembly() @@ -658,6 +660,10 @@ internal virtual void StartAssemblyAttributes() { } + internal virtual void EndAssemblyAttributes() + { + } + internal abstract void DeclareAttribute(Type type, string arg); internal abstract void StartThisAssemblyClass(); @@ -726,6 +732,11 @@ internal override void StartAssemblyAttributes() this.CodeBuilder.AppendLine($"namespace {this.Namespace}"); } + internal override void EndAssemblyAttributes() + { + this.CodeBuilder.AppendLine("do()"); + } + internal override void DeclareAttribute(Type type, string arg) { this.CodeBuilder.AppendLine($"[]"); @@ -738,7 +749,6 @@ internal override void EndThisAssemblyClass() internal override void StartThisAssemblyClass() { - this.CodeBuilder.AppendLine("do()"); this.CodeBuilder.AppendLine($"#if {CompilerDefinesAroundGeneratedCodeAttribute}"); this.CodeBuilder.AppendLine($"[]"); this.CodeBuilder.AppendLine("#endif"); diff --git a/test/Nerdbank.GitVersioning.Tests/AssemblyInfoTest.cs b/test/Nerdbank.GitVersioning.Tests/AssemblyInfoTest.cs index 43641569e..b42d39500 100644 --- a/test/Nerdbank.GitVersioning.Tests/AssemblyInfoTest.cs +++ b/test/Nerdbank.GitVersioning.Tests/AssemblyInfoTest.cs @@ -66,8 +66,8 @@ namespace AssemblyInfo [] [] [] -{(thisAssemblyClass.GetValueOrDefault(true) ? $@"do() -#if NETSTANDARD || NETFRAMEWORK || NETCOREAPP +do() +{(thisAssemblyClass.GetValueOrDefault(true) ? $@"#if NETSTANDARD || NETFRAMEWORK || NETCOREAPP [] #endif #if NET40_OR_GREATER || NETCOREAPP2_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER