-
Notifications
You must be signed in to change notification settings - Fork 8.1k
$PSVersionTable.GitCommitId based on generated constant #3690
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
acc80be
$PSVersionTable.GitCommitId based on generated constant
iSazonov 90e090f
Remove "powershell.version" file
iSazonov aaf27a9
Generate PSVersion
iSazonov d46752b
Remove 'powershell.version' from all files
iSazonov 6ec07b9
Update assemblies versions by MSBuild
iSazonov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,6 +150,42 @@ function Start-PSBuild { | |
| Stop-Process -Verbose | ||
| } | ||
|
|
||
| # Generate version constant for $PSVersionTable | ||
| function Start-PowerShellVersionGen { | ||
| $powershellVersion = git --git-dir="$PSScriptRoot/.git" describe --abbrev=60 --long | ||
| $matchVersion = ([regex]::Match($powershellVersion, "^v(.+)-(\d+)-g(.+)")).Groups.Value | ||
| $null, $ps6MajorVersion, $ps6MinorVersion, $ps6PatchVersion, $ps6LabelVersion = ([regex]::Match($matchVersion[1], "^(\d+).(\d+).(\d+)-(.+)")).Groups.Value | ||
| $Global:formattedVersion = "$($matchVersion[1])" | ||
| if ($($matchVersion[1]) -ne "0") { | ||
| $Global:formattedVersion += " Additional commits: $($matchVersion[2])" | ||
| } | ||
| $Global:formattedVersion += " Commit Hash: $($matchVersion[3])" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JamesWTruher the telemetry you're receiving is from @iSazonov running a build of PowerShell with this (not yet committed to master) change. |
||
|
|
||
| $template = @" | ||
| //------------------------------------------------------------------------------ | ||
| // <auto-generated> | ||
| // This code was generated by Build.psm1\Start-PSBuild. | ||
| // | ||
| // Changes to this file may cause incorrect behavior and will be lost if | ||
| // the code is regenerated. | ||
| // </auto-generated> | ||
| //------------------------------------------------------------------------------ | ||
|
|
||
| namespace System.Management.Automation | ||
| { | ||
| internal class GitCommitInfo | ||
| { | ||
| internal const string s_GitCommitInfo = "$formattedVersion"; | ||
| internal static readonly SemanticVersion s_psV6Version = new SemanticVersion($ps6MajorVersion, $ps6MinorVersion, $ps6PatchVersion, "$ps6LabelVersion"); | ||
| } | ||
| } | ||
| "@ | ||
|
|
||
| Set-Content -Path "$PSScriptRoot\src\System.Management.Automation\gen\PSVersionInfo.generated.cs" -Value $template | ||
|
|
||
| $Global:formattedVersion = $Global:formattedVersion -replace ' ', '%20' | ||
| } | ||
|
|
||
| if ($Clean) { | ||
| log "Cleaning your working directory. You can also do it with 'git clean -fdX'" | ||
| Push-Location $PSScriptRoot | ||
|
|
@@ -165,14 +201,6 @@ function Start-PSBuild { | |
| } | ||
| } | ||
|
|
||
| # 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" | ||
|
|
||
|
|
@@ -196,7 +224,7 @@ function Start-PSBuild { | |
| Write-Warning @" | ||
| The currently installed .NET Command Line Tools is not the required version. | ||
|
|
||
| Installed version: $dotnetCLIIntalledVersion | ||
| Installed version: $dotnetCLIIntalledVersion | ||
| Required version: $dotnetCLIRequiredVersion | ||
|
|
||
| Fix steps: | ||
|
|
@@ -302,6 +330,14 @@ Fix steps: | |
| Start-ResGen | ||
| } | ||
|
|
||
| # Generate version constant for $PSVersionTable | ||
| # (Call after 'Start-ResGen'!) | ||
| Start-PowerShellVersionGen | ||
|
|
||
| # $Arguments += "/p:ProductVersion=$formattedVersion;InformationalVersion=$formattedVersion;" | ||
| $Arguments += "/p:ProductVersion=$formattedVersion;InformationalVersion=$formattedVersion" | ||
|
|
||
|
|
||
| # handle xaml files | ||
| # Heuristic to resolve xaml on the fresh machine | ||
| if ($FullCLR -and ($XamlGen -or -not (Test-Path "$PSScriptRoot/src/Microsoft.PowerShell.Activities/gen/*.g.cs"))) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <PropertyGroup> | ||
| <Product>PowerShell Core</Product> | ||
| <Company>Microsoft Corporation</Company> | ||
| <Copyright>(c) Microsoft Corporation. All rights reserved.</Copyright> | ||
|
|
||
| <FileVersion>6.0.0.0</FileVersion> | ||
| <AssemblyVersion>6.0.0.0</AssemblyVersion> | ||
| <!-- | ||
| <ProductVersion>6.0.0-beta.1 Additional commits: 1 Commit Hash: 9ebe</ProductVersion> | ||
| <InformationalVersion>6.0.0-beta.1 Additional commits: 2 Commit Hash: 59ebe</InformationalVersion> | ||
| !--> | ||
| <TargetFramework>netcoreapp2.0</TargetFramework> | ||
| <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
|
|
||
| <DelaySign>true</DelaySign> | ||
| <AssemblyOriginatorKeyFile>../signing/visualstudiopublic.snk</AssemblyOriginatorKeyFile> | ||
| <SignAssembly>true</SignAssembly> | ||
| </PropertyGroup> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change in formatting breaks our telemetry