From b74c493782be9cdb8eb684ce002000e886038498 Mon Sep 17 00:00:00 2001 From: iSazonov Date: Tue, 4 Jul 2017 12:42:14 +0300 Subject: [PATCH 01/11] Get PowerShell version from git tag --- PowerShell.Common.props | 94 ++++++++++++++++++++++++++++++++++++++++- build.psm1 | 14 ++---- 2 files changed, 96 insertions(+), 12 deletions(-) diff --git a/PowerShell.Common.props b/PowerShell.Common.props index 947f320217d..b41917743c4 100644 --- a/PowerShell.Common.props +++ b/PowerShell.Common.props @@ -1,10 +1,100 @@ + + + + + + git + + + + + + + + $(MSBuildProjectDirectory)/$(GitCDUP)/.git + + + + + + + + ^v(.+)-(\d+)-g(.+) + $([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[1].Value) + $([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[2].Value) + $([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[3].Value) + + ^((\d+).(\d+).(\d+))(?:-(.+))? + $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[1].Value) + $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[2].Value) + $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[3].Value) + $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[4].Value) + $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[5].Value) + + $(PSCoreBuildVersion) SHA: $(PSCoreCommitSHA) + $(PSCoreBuildVersion) Commits: $(PSCoreAdditionalCommits) SHA: $(PSCoreCommitSHA) + + $(PSCoreFormattedVersion) + + $(PSCoreBuildVersion) + $(PSCoreFormattedVersion) + + + + + + $(PSCoreBuildVersion) + + + + + + + PowerShell Core Microsoft Corporation (c) Microsoft Corporation. All rights reserved. - 6.0.0 netcoreapp2.0 2.0.0 @@ -16,5 +106,7 @@ true ../signing/visualstudiopublic.snk true + + diff --git a/build.psm1 b/build.psm1 index 84f3913f79e..930973f8fef 100644 --- a/build.psm1 +++ b/build.psm1 @@ -1319,22 +1319,14 @@ function Start-PSBootstrap { function Publish-NuGetFeed { param( - [string]$OutputPath = "$PSScriptRoot/nuget-artifacts", - [Parameter(Mandatory=$true)] - [string]$VersionSuffix + [string]$OutputPath = "$PSScriptRoot/nuget-artifacts" ) # Add .NET CLI tools to PATH Find-Dotnet - if ($VersionSuffix) { - ## NuGet/Home #3953, #4337 -- dotnet pack - version suffix missing from ProjectReference - ## Workaround: - ## dotnet restore /p:VersionSuffix= # Bake the suffix into project.assets.json - ## dotnet pack --version-suffix - $TopProject = (New-PSOptions).Top - dotnet restore $TopProject "/p:VersionSuffix=$VersionSuffix" - } + # Update 'project.assets.json' files with new version tag value. + dotnet restore $TopProject try { Push-Location $PSScriptRoot From 840c18a53630f8ab9518c46dd4ab7f19eb63349d Mon Sep 17 00:00:00 2001 From: iSazonov Date: Tue, 22 Aug 2017 18:57:13 +0300 Subject: [PATCH 02/11] Add support ReleaseTag in Start-PSBuild and Publish-NuGetFeed --- PowerShell.Common.props | 22 ++++++++++++++++------ build.psm1 | 29 ++++++++++++++++++++++++----- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/PowerShell.Common.props b/PowerShell.Common.props index b41917743c4..1f0e33bd76a 100644 --- a/PowerShell.Common.props +++ b/PowerShell.Common.props @@ -7,7 +7,7 @@ 2. Properties in global 'PropertyGroups' is assigned before any targets 3. and cannot be conditionally excecuted as targets (after this target). - To assign vertions properties we should excecute the target: + To assign versions properties we should excecute the target: '_GenerateRestoreProjectSpec' - before 'Restore' target 'GenerateNuspec' - before 'Pack' target 'BeforeBuild' - before 'Build' target @@ -28,14 +28,23 @@ $(MSBuildProjectDirectory)/$(GitCDUP)/.git - + ^v(.+)-(\d+)-g(.+) - $([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[1].Value) + + + + $(ReleaseTag) $([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[2].Value) + + + + $([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[1].Value) $([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[3].Value) ^((\d+).(\d+).(\d+))(?:-(.+))? @@ -45,7 +54,7 @@ $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[4].Value) $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[5].Value) - $(PSCoreBuildVersion) SHA: $(PSCoreCommitSHA) + $(PSCoreBuildVersion) SHA: $(PSCoreCommitSHA) $(PSCoreBuildVersion) Commits: $(PSCoreAdditionalCommits) SHA: $(PSCoreCommitSHA) $(PSCoreFormattedVersion) @@ -69,8 +78,9 @@ - - $(PSCoreBuildVersion) $(PSCoreFormattedVersion) + $(PSCoreFormattedVersion) $(PSCoreBuildVersion) @@ -71,7 +72,6 @@ PSCoreMinorVersion = $(PSCoreMinorVersion); PSCorePatchVersion = $(PSCorePatchVersion); PSCoreLabelVersion = $(PSCoreLabelVersion); - GitCDUP = $(GitCDUP); RegexGitVersion = $(RegexGitVersion); PSCoreFormattedVersion = $(PSCoreFormattedVersion); ProductVersion = $(ProductVersion); From 44101fc05ada4ed9b404ce2d2c6601e059c8f436 Mon Sep 17 00:00:00 2001 From: iSazonov Date: Mon, 4 Sep 2017 08:19:28 +0300 Subject: [PATCH 06/11] Fix previewLabel in AppVeyor.psm1 --- tools/appveyor.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index f43be751828..f8f32ebc324 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -457,7 +457,7 @@ function Invoke-AppveyorFinish { $previewVersion = (git describe --abbrev=0).Split('-') $previewPrefix = $previewVersion[0] - $previewLabel = $previewVersion[1].Replace('.','') + $previewLabel = $previewVersion[1] if(Test-DailyBuild) { From 953fb6b7237b1c639516b1dc3f95b73be3fb21b1 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Mon, 4 Sep 2017 12:14:42 -0700 Subject: [PATCH 07/11] [Feature] Fix nuget package publish in daily build --- build.psm1 | 17 +++++++++++------ tools/appveyor.psm1 | 8 ++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/build.psm1 b/build.psm1 index e4dfb5338e3..4dc567dfabe 100644 --- a/build.psm1 +++ b/build.psm1 @@ -51,6 +51,8 @@ function Sync-PSTags # Gets the latest tag for the current branch function Get-PSLatestTag { + [CmdletBinding()] + param() # This function won't always return the correct value unless tags have been sync'ed # So, Write a warning to run Sync-PSTags if(!$tagsUpToDate) @@ -63,6 +65,7 @@ function Get-PSLatestTag function Get-PSVersion { + [CmdletBinding()] param( [switch] $OmitCommitId @@ -79,6 +82,8 @@ function Get-PSVersion function Get-PSCommitId { + [CmdletBinding()] + param() # This function won't always return the correct value unless tags have been sync'ed # So, Write a warning to run Sync-PSTags if(!$tagsUpToDate) @@ -339,7 +344,7 @@ function Start-PSBuild { $gitCommitId = $ReleaseTag if (-not $gitCommitId) { # if ReleaseTag is not specified, use 'git describe' to get the commit id - $gitCommitId = Get-PSCommitId + $gitCommitId = Get-PSCommitId -WarningAction SilentlyContinue } $gitCommitId > "$psscriptroot/powershell.version" @@ -417,8 +422,8 @@ Fix steps: } if ($ReleaseTag) { - $ReleaseTag1 = $ReleaseTag -Replace '^v' - $Arguments += "/property:ReleaseTag=$ReleaseTag1" + $ReleaseTagToUse = $ReleaseTag -Replace '^v' + $Arguments += "/property:ReleaseTag=$ReleaseTagToUse" } # handle Restore @@ -1336,8 +1341,8 @@ function Publish-NuGetFeed ## We update 'project.assets.json' files with new version tag value by 'GetPSCoreVersionFromGit' target. $TopProject = (New-PSOptions).Top if ($ReleaseTag) { - $ReleaseTag1 = $ReleaseTag -Replace '^v' - dotnet restore $TopProject "/property:ReleaseTag=$ReleaseTag1" + $ReleaseTagToUse = $ReleaseTag -Replace '^v' + dotnet restore $TopProject "/property:ReleaseTag=$ReleaseTagToUse" } else { dotnet restore $TopProject } @@ -1358,7 +1363,7 @@ function Publish-NuGetFeed 'Microsoft.PowerShell.SDK' ) | ForEach-Object { if ($ReleaseTag) { - dotnet pack "src/$_" --output $OutputPath "/property:IncludeSymbols=true;ReleaseTag=$ReleaseTag1" + dotnet pack "src/$_" --output $OutputPath "/property:IncludeSymbols=true;ReleaseTag=$ReleaseTagToUse" } else { dotnet pack "src/$_" --output $OutputPath } diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index f8f32ebc324..618d84ab9ae 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -451,20 +451,20 @@ function Invoke-AppveyorFinish if ($env:APPVEYOR_REPO_TAG_NAME) { - $preReleaseVersion = "v$($env:APPVEYOR_REPO_TAG_NAME)" + $preReleaseVersion = $env:APPVEYOR_REPO_TAG_NAME } else { $previewVersion = (git describe --abbrev=0).Split('-') $previewPrefix = $previewVersion[0] - $previewLabel = $previewVersion[1] + $previewLabel = $previewVersion[1].replace('.','') if(Test-DailyBuild) { - $previewLabel= "daily-{0}" -f $previewLabel + $previewLabel= "daily{0}" -f $previewLabel } - $preReleaseVersion = "$previewPrefix-$previewLabel-$($env:APPVEYOR_BUILD_NUMBER.Replace('.','-'))" + $preReleaseVersion = "$previewPrefix-$previewLabel.$env:APPVEYOR_BUILD_NUMBER" } # only publish to nuget feed if it is a daily build and tests passed From 048ab758528d0dafa28bcf7f5f7b3a21084fa685 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 5 Sep 2017 16:06:11 -0700 Subject: [PATCH 08/11] Update some comments in 'PowerShell.Common.props' --- PowerShell.Common.props | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/PowerShell.Common.props b/PowerShell.Common.props index 3649053dca1..d6f1067cbe7 100644 --- a/PowerShell.Common.props +++ b/PowerShell.Common.props @@ -1,16 +1,16 @@ $([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[2].Value) $([System.Text.RegularExpressions.Regex]::Match($(PowerShellVersion), $(RegexGitVersion)).Groups[3].Value) - ^((\d+).(\d+).(\d+))(?:-(.+))? - $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[1].Value) - $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[2].Value) - $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[3].Value) - $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[4].Value) - $([System.Text.RegularExpressions.Regex]::Match($(PSCoreBuildVersion), $(RegexSymVer)).Groups[5].Value) - $(PSCoreBuildVersion) SHA: $(PSCoreCommitSHA) $(PSCoreBuildVersion) Commits: $(PSCoreAdditionalCommits) SHA: $(PSCoreCommitSHA) + + + Overwrite="true" /> + --> @@ -99,7 +103,6 @@ true ../signing/visualstudiopublic.snk true - From 5bae6ba544b3ac50244a1113fef55a85a4e3f314 Mon Sep 17 00:00:00 2001 From: iSazonov Date: Wed, 6 Sep 2017 06:59:23 +0300 Subject: [PATCH 09/11] Fix comment --- PowerShell.Common.props | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PowerShell.Common.props b/PowerShell.Common.props index d6f1067cbe7..119ddbfc97b 100644 --- a/PowerShell.Common.props +++ b/PowerShell.Common.props @@ -1,13 +1,13 @@ Date: Wed, 6 Sep 2017 13:21:49 -0700 Subject: [PATCH 11/11] Remove an unnecessary empty line --- tools/appveyor.psm1 | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index 618d84ab9ae..95176160ed3 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -208,7 +208,6 @@ function Invoke-AppVeyorInstall } elseif($env:APPVEYOR_REPO_COMMIT_MESSAGE -notmatch '^\[Daily\].*$') { - $buildName += $env:APPVEYOR_REPO_COMMIT_MESSAGE } else