diff --git a/PowerShell.Common.props b/PowerShell.Common.props index 947f320217d..540ff72895c 100644 --- a/PowerShell.Common.props +++ b/PowerShell.Common.props @@ -1,10 +1,95 @@ + + + + + + + + + + $(ReleaseTag) + + + + ^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) + + $(PSCoreBuildVersion) SHA: $(PSCoreCommitSHA) + $(PSCoreBuildVersion) Commits: $(PSCoreAdditionalCommits) SHA: $(PSCoreCommitSHA) + + + + + $(PSCoreBuildVersion) + $(PSCoreFormattedVersion) + $(PSCoreFormattedVersion) + + + $(PSCoreBuildVersion) + + + + + + + PowerShell Core Microsoft Corporation (c) Microsoft Corporation. All rights reserved. - 6.0.0 netcoreapp2.0 2.0.0 @@ -17,4 +102,5 @@ ../signing/visualstudiopublic.snk true + diff --git a/build.psm1 b/build.psm1 index 84f3913f79e..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" @@ -416,6 +421,11 @@ Fix steps: $Arguments += "--runtime", $Options.Runtime } + if ($ReleaseTag) { + $ReleaseTagToUse = $ReleaseTag -Replace '^v' + $Arguments += "/property:ReleaseTag=$ReleaseTagToUse" + } + # handle Restore if ($Restore -or -not (Test-Path "$($Options.Top)/obj/project.assets.json")) { log "Run dotnet restore" @@ -1320,20 +1330,21 @@ function Publish-NuGetFeed { param( [string]$OutputPath = "$PSScriptRoot/nuget-artifacts", - [Parameter(Mandatory=$true)] - [string]$VersionSuffix + [ValidatePattern("^v\d+\.\d+\.\d+(-\w+\.\d+)?$")] + [ValidateNotNullOrEmpty()] + [string]$ReleaseTag ) # 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" + ## We update 'project.assets.json' files with new version tag value by 'GetPSCoreVersionFromGit' target. + $TopProject = (New-PSOptions).Top + if ($ReleaseTag) { + $ReleaseTagToUse = $ReleaseTag -Replace '^v' + dotnet restore $TopProject "/property:ReleaseTag=$ReleaseTagToUse" + } else { + dotnet restore $TopProject } try { @@ -1351,8 +1362,8 @@ function Publish-NuGetFeed 'Microsoft.WSMan.Runtime', 'Microsoft.PowerShell.SDK' ) | ForEach-Object { - if ($VersionSuffix) { - dotnet pack "src/$_" --output $OutputPath --version-suffix $VersionSuffix /p:IncludeSymbols=true + if ($ReleaseTag) { + 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 ac5a9397ef3..95176160ed3 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -94,7 +94,7 @@ Function Test-DailyBuild { return $true } - + # if [Feature] is in the commit message, # Run Daily tests if($env:APPVEYOR_REPO_COMMIT_MESSAGE -match '\[feature\]') @@ -208,7 +208,6 @@ function Invoke-AppVeyorInstall } elseif($env:APPVEYOR_REPO_COMMIT_MESSAGE -notmatch '^\[Daily\].*$') { - $buildName += $env:APPVEYOR_REPO_COMMIT_MESSAGE } else @@ -451,24 +450,26 @@ function Invoke-AppveyorFinish if ($env:APPVEYOR_REPO_TAG_NAME) { - # ignore the first part of semver, use the preview part - $preReleaseVersion = ($env:APPVEYOR_REPO_TAG_NAME).Split('-')[1] + $preReleaseVersion = $env:APPVEYOR_REPO_TAG_NAME } else { - $previewLabel = (git describe --abbrev=0).Split('-')[1].replace('.','') + $previewVersion = (git describe --abbrev=0).Split('-') + $previewPrefix = $previewVersion[0] + $previewLabel = $previewVersion[1].replace('.','') + if(Test-DailyBuild) { - $previewLabel= "daily-{0}" -f $previewLabel + $previewLabel= "daily{0}" -f $previewLabel } - $preReleaseVersion = "$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 if((Test-DailyBuild) -and $env:TestPassed -eq 'True') { - Publish-NuGetFeed -OutputPath .\nuget-artifacts -VersionSuffix $preReleaseVersion + Publish-NuGetFeed -OutputPath .\nuget-artifacts -ReleaseTag $preReleaseVersion } $nugetArtifacts = Get-ChildItem .\nuget-artifacts -ErrorAction SilentlyContinue | ForEach-Object { $_.FullName } @@ -498,7 +499,7 @@ function Invoke-AppveyorFinish { log "pushing $_ to $env:NUGET_URL" Start-NativeExecution -sb {dotnet nuget push $_ --api-key $env:NUGET_KEY --source "$env:NUGET_URL/api/v2/package"} -IgnoreExitcode - } + } } if(!$pushedAllArtifacts) {