From 167b51c4d61a64c028a8e164e27c1df2ff12a786 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Wed, 27 Jun 2018 15:30:38 -0700 Subject: [PATCH] update build and packaging modules for Alpine (#7149) --- build.psm1 | 39 +++++++++++++++++----------------- tools/packaging/packaging.psm1 | 21 +++++++++++++++++- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/build.psm1 b/build.psm1 index 412e541208..e060ee1437 100644 --- a/build.psm1 +++ b/build.psm1 @@ -419,13 +419,14 @@ 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("win7-x64", - "win7-x86", - "osx-x64", + [ValidateSet("linux-arm", + "linux-musl-x64", "linux-x64", - "linux-arm", + "osx-x64", "win-arm", - "win-arm64")] + "win-arm64", + "win7-x64", + "win7-x86")] [string]$Runtime, [ValidateSet('Debug', 'Release', 'CodeCoverage', '')] # We might need "Checked" as well @@ -737,13 +738,14 @@ function New-PSOptions { # These are duplicated from Start-PSBuild # We do not use ValidateScript since we want tab completion [ValidateSet("", - "win7-x86", - "win7-x64", - "osx-x64", - "linux-x64", "linux-arm", + "linux-musl-x64", + "linux-x64", + "osx-x64", "win-arm", - "win-arm64")] + "win-arm64", + "win7-x64", + "win7-x86")] [string]$Runtime, [switch]$CrossGen, @@ -2160,13 +2162,14 @@ function Start-CrossGen { $PublishPath, [Parameter(Mandatory=$true)] - [ValidateSet("win7-x86", - "win7-x64", - "osx-x64", + [ValidateSet("linux-arm", + "linux-musl-x64", "linux-x64", - "linux-arm", + "osx-x64", "win-arm", - "win-arm64")] + "win-arm64", + "win7-x64", + "win7-x86")] [string] $Runtime ) @@ -2227,10 +2230,8 @@ function Start-CrossGen { } } elseif ($Runtime -eq "linux-arm") { throw "crossgen is not available for 'linux-arm'" - } elseif ($Environment.IsLinux) { - "linux-x64" - } elseif ($Environment.IsMacOS) { - "osx-x64" + } else { + $Runtime } if (-not $crossGenRuntime) { diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index b50ed787c9..0b5501a0a7 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -22,7 +22,7 @@ function Start-PSPackage { [string]$Name = "powershell", # Ubuntu, CentOS, Fedora, macOS, and Windows packages are supported - [ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg", "tar", "tar-arm")] + [ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg", "tar", "tar-arm", 'tar-musl')] [string[]]$Type, # Generate windows downlevel package @@ -64,6 +64,8 @@ function Start-PSPackage { $WindowsRuntime, "Release" } elseif ($Type -eq "tar-arm") { New-PSOptions -Configuration "Release" -Runtime "Linux-ARM" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } + } elseif ($Type -eq "tar-musl") { + New-PSOptions -Configuration "Release" -Runtime "Linux-musl-x64" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } } else { New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration } } @@ -316,6 +318,19 @@ function Start-PSPackage { New-TarballPackage @Arguments } } + "tar-musl" { + $Arguments = @{ + PackageSourcePath = $Source + Name = $Name + Version = $Version + Force = $Force + Architecture = "musl-x64" + } + + if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) { + New-TarballPackage @Arguments + } + } 'deb' { $Arguments = @{ Type = 'deb' @@ -1397,6 +1412,9 @@ function New-UnifiedNugetPackage [Parameter(Mandatory = $true)] [string] $LinuxArm32BinPath, + [Parameter(Mandatory = $true)] + [string] $LinuxMuslPath, + [Parameter(Mandatory = $true)] [string] $LinuxBinPath, @@ -1462,6 +1480,7 @@ function New-UnifiedNugetPackage if ($linuxExceptionList -notcontains $file ) { CreateNugetPlatformFolder -Platform 'linux-arm' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $linuxArm32BinPath + CreateNugetPlatformFolder -Platform 'linux-musl-x64' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $linuxMuslBinPath CreateNugetPlatformFolder -Platform 'linux-x64' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $linuxBinPath CreateNugetPlatformFolder -Platform 'osx' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $osxBinPath }