8000 Make 'Start-PSBuild' and 'Start-PSPackage' accept a release tag argument by daxian-dbw · Pull Request #3921 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Make 'Start-PSBuild' and 'Start-PSPackage' accept a release tag argument #3921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ function Start-PSBuild {
[switch]$Publish,

[Parameter(ParameterSetName='CoreCLR')]
[switch]$CrossGen
[switch]$CrossGen,

[Parameter(ParameterSetName='CoreCLR')]
[ValidatePattern("^v\d+\.\d+\.\d+(-\w+\.\d+)?$")]
[ValidateNotNullOrEmpty()]
[string]$ReleaseTag
)

function Stop-DevPowerShell {
Expand Down Expand Up @@ -157,8 +162,13 @@ function Start-PSBuild {
}
}

# save Git description to file for PowerShell to include in PSVersionTable
git --git-dir="$PSScriptRoot/.git" describe --dirty --abbrev=60 > "$psscriptroot/powershell.version"
# save git commit id to file for PowerShell to include in PSVersionTable
$gitCommitId = $ReleaseTag
if (-not $gitCommitId) {
# if ReleaseTag is not specified, use 'git describe' to get the commit id
$gitCommitId = git --git-dir="$PSScriptRoot/.git" describe --dirty --abbrev=60
}
$gitCommitId > "$psscriptroot/powershell.version"

# create the telemetry flag file
$null = new-item -force -type file "$psscriptroot/DELETE_ME_TO_DISABLE_CONSOLEHOST_TELEMETRY"
Expand Down Expand Up @@ -1206,8 +1216,14 @@ function Start-PSBootstrap {
function Start-PSPackage {
[CmdletBinding()]param(
# PowerShell packages use Semantic Versioning http://semver.org/
[Parameter(ParameterSetName = "Version")]
[string]$Version,

[Parameter(ParameterSetName = "ReleaseTag")]
[ValidatePattern("^v\d+\.\d+\.\d+(-\w+\.\d+)?$")]
[ValidateNotNullOrEmpty()]
[string]$ReleaseTag,

# Package name
[ValidatePattern("^powershell")]
[string]$Name = "powershell",
Expand Down Expand Up @@ -1253,6 +1269,11 @@ function Start-PSPackage {
throw "Please ensure you have run 'Start-PSBuild -Clean -CrossGen -Runtime $Runtime -Configuration $Configuration'!"
}

# If ReleaseTag is specified, use the given tag to calculate Vesrion
if ($PSCmdlet.ParameterSetName -eq "ReleaseTag") {
$Version = $ReleaseTag -Replace '^v'
}

# Use Git tag if not given a version
if (-not $Version) {
$Version = (git --git-dir="$PSScriptRoot/.git" describe) -Replace '^v'
Expand Down
0