Skip to content
Merged
Show file tree
Hide file tree
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
38 changes: 27 additions & 11 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ function Start-PSBuild {
# These runtimes must match those in project.json
# We do not use ValidateScript since we want tab completion
# If this parameter is not provided it will get determined automatically.
[ValidateSet("linux-arm",
[ValidateSet("fxdependent",
"linux-arm",
"linux-musl-x64",
"linux-x64",
"osx-x64",
Expand All @@ -455,7 +456,6 @@ function Start-PSBuild {
if ("win-arm","win-arm64" -contains $Runtime -and -not $Environment.IsWindows) {
throw "Cross compiling for win-arm or win-arm64 is only supported on Windows environment"
}

function Stop-DevPowerShell {
Get-Process pwsh* |
Where-Object {
Expand Down Expand Up @@ -536,7 +536,7 @@ Fix steps:
$Arguments += "--configuration", $Options.Configuration
$Arguments += "--framework", $Options.Framework

if (-not $SMAOnly) {
if (-not $SMAOnly -and $Options.Runtime -ne 'fxdependent') {
# libraries should not have runtime
$Arguments += "--runtime", $Options.Runtime
}
Expand Down Expand Up @@ -572,7 +572,8 @@ Fix steps:
Write-Log "Run dotnet $Arguments from $pwd"
Start-NativeExecution { dotnet $Arguments }

if ($CrossGen) {
if ($CrossGen -and $Options.Runtime -ne 'fxdependent') {
## fxdependent package cannot be CrossGen'ed
Start-CrossGen -PublishPath $publishPath -Runtime $script:Options.Runtime
Write-Log "pwsh.exe with ngen binaries is available at: $($Options.Output)"
} else {
Expand Down Expand Up @@ -657,10 +658,13 @@ Fix steps:
$iconPath = "$PSScriptRoot\assets\Powershell_black.ico"
}

Start-NativeExecution { & $rcedit $pwshPath --set-icon $iconPath `
--set-file-version $fileVersion --set-product-version $ReleaseVersion --set-version-string "ProductName" "PowerShell Core 6" `
--set-version-string "LegalCopyright" "(C) Microsoft Corporation. All Rights Reserved." `
--application-manifest "$PSScriptRoot\assets\pwsh.manifest" } | Write-Verbose
# fxdependent package does not have an executable to set iconPath etc.
if ($Options.Runtime -ne 'fxdependent') {
Start-NativeExecution { & $rcedit $pwshPath --set-icon $iconPath `
--set-file-version $fileVersion --set-product-version $ReleaseVersion --set-version-string "ProductName" "PowerShell Core 6" `
--set-version-string "LegalCopyright" "(C) Microsoft Corporation. All Rights Reserved." `
--application-manifest "$PSScriptRoot\assets\pwsh.manifest" } | Write-Verbose
}
}

# download modules from powershell gallery.
Expand Down Expand Up @@ -696,7 +700,12 @@ function Restore-PSPackage

if ($Force -or (-not (Test-Path "$($Options.Top)/obj/project.assets.json"))) {

$RestoreArguments = @("--runtime",$Options.Runtime,"--verbosity")
if($Options.Runtime -ne 'fxdependent') {
$RestoreArguments = @("--runtime",$Options.Runtime, "--verbosity")
} else {
$RestoreArguments = @("--verbosity")
}

if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) {
$RestoreArguments += "detailed"
} else {
Expand Down Expand Up @@ -780,6 +789,7 @@ function New-PSOptions {
# These are duplicated from Start-PSBuild
# We do not use ValidateScript since we want tab completion
[ValidateSet("",
"fxdependent",
"linux-arm",
"linux-musl-x64",
"linux-x64",
Expand Down Expand Up @@ -855,15 +865,21 @@ function New-PSOptions {
}
}

$Executable = if ($Environment.IsLinux -or $Environment.IsMacOS) {
$Executable = if ($Runtime -eq 'fxdependent') {
"pwsh.dll"
} elseif ($Environment.IsLinux -or $Environment.IsMacOS) {
"pwsh"
} elseif ($Environment.IsWindows) {
"pwsh.exe"
}

# Build the Output path
if (!$Output) {
$Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $Runtime, "publish", $Executable)
if ($Runtime -eq 'fxdependent') {
$Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, "publish", $Executable)
} else {
$Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $Runtime, "publish", $Executable)
}
}

if ($SMAOnly)
Expand Down
Loading