mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
update PSVersionTable code to use powershell.version rather than .version because on Linux the .version file doesn't seem to be binplaced. I postulate this is because it's a hidden file
This commit is contained in:
@@ -15,3 +15,6 @@ install.ps1
|
||||
|
||||
# We copy powershell.exe as a content in host dotnet cli projects
|
||||
*.exe
|
||||
|
||||
# ignore the version file as it is generated at build time
|
||||
powershell.version
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ function Start-PSBuild {
|
||||
[string]$msbuildConfiguration = "Release"
|
||||
)
|
||||
|
||||
git describe --dirty --abbrev=60 > "$psscriptroot/.version"
|
||||
git describe --dirty --abbrev=60 > "$psscriptroot/powershell.version"
|
||||
|
||||
# simplify ParameterSetNames
|
||||
if ($PSCmdlet.ParameterSetName -eq 'FullCLR') {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"Modules",
|
||||
"../Modules",
|
||||
"powershell.exe",
|
||||
"../../.version"
|
||||
"../../powershell.version"
|
||||
],
|
||||
|
||||
"frameworks": {
|
||||
|
||||
@@ -82,12 +82,12 @@ namespace System.Management.Automation
|
||||
return new Version(buildVersion);
|
||||
}
|
||||
|
||||
// Get the commit id from the .version file. If the .version file doesn't exist, use the string "N/A"
|
||||
// Get the commit id from the powershell.version file. If the powershell.version file doesn't exist, use the string "N/A"
|
||||
static internal string GetCommitInfo()
|
||||
{
|
||||
try {
|
||||
string assemblyPath = IO.Path.GetDirectoryName(typeof(PSVersionInfo).GetTypeInfo().Assembly.Location);
|
||||
return (IO.File.ReadAllLines(IO.Path.Combine(assemblyPath,".version"))[0]);
|
||||
return (IO.File.ReadAllLines(IO.Path.Combine(assemblyPath,"powershell.version"))[0]);
|
||||
}
|
||||
catch (Exception e){
|
||||
return e.Message;
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
"../Modules",
|
||||
"*_profile.ps1",
|
||||
"*.so",
|
||||
"*.dylib"
|
||||
"*.dylib",
|
||||
"../../powershell.version"
|
||||
],
|
||||
|
||||
"frameworks": {
|
||||
|
||||
@@ -15,6 +15,9 @@ Describe "PSVersionTable" {
|
||||
$PSVersionTable.ContainsKey("GitCommitId") | Should Be True
|
||||
|
||||
}
|
||||
It "GitCommitId property should not contain an error" {
|
||||
$PSVersionTable.GitCommitId | Should not match "powershell.version"
|
||||
}
|
||||
|
||||
It "Should have the correct edition" -Skip:(!$IsCore) {
|
||||
$expected =
|
||||
|
||||
Reference in New Issue
Block a user