Build Global tool for PowerShell and SDK container (#8984)
* Add shim dll to redirect to appropriate runtime * Build updates for creating global tool package * Add building global tool to nuget.yml * Add azure upload of nuget packages
This commit is contained in:
parent
31699be223
commit
fb05169a51
18
build.psm1
18
build.psm1
|
@ -379,6 +379,20 @@ Fix steps:
|
|||
Write-Log "pwsh.exe with ngen binaries is available at: $($Options.Output)"
|
||||
} else {
|
||||
Write-Log "PowerShell output: $($Options.Output)"
|
||||
|
||||
if ($Options.Runtime -eq 'fxdependent') {
|
||||
$globalToolSrcFolder = Resolve-Path (Join-Path $Options.Top "../Microsoft.PowerShell.GlobalTool.Shim") | Select-Object -ExpandProperty Path
|
||||
|
||||
try {
|
||||
Push-Location $globalToolSrcFolder
|
||||
$Arguments += "--output", $publishPath
|
||||
Write-Log "Run dotnet $Arguments from $pwd to build global tool entry point"
|
||||
Start-NativeExecution { dotnet $Arguments }
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
|
@ -497,6 +511,10 @@ function Restore-PSPackage
|
|||
if (-not $ProjectDirs)
|
||||
{
|
||||
$ProjectDirs = @($Options.Top, "$PSScriptRoot/src/TypeCatalogGen", "$PSScriptRoot/src/ResGen", "$PSScriptRoot/src/Modules")
|
||||
|
||||
if ($Options.Runtime -eq 'fxdependent') {
|
||||
$ProjectDirs += "$PSScriptRoot/src/Microsoft.PowerShell.GlobalTool.Shim"
|
||||
}
|
||||
}
|
||||
|
||||
if ($Force -or (-not (Test-Path "$($Options.Top)/obj/project.assets.json"))) {
|
||||
|
|
46
src/Microsoft.PowerShell.GlobalTool.Shim/GlobalToolShim.cs
Normal file
46
src/Microsoft.PowerShell.GlobalTool.Shim/GlobalToolShim.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.PowerShell.GlobalTool.Shim
|
||||
{
|
||||
/// <summary>
|
||||
/// Shim layer to chose the appropriate runtime for PowerShell Core DotNet Global tool.
|
||||
/// </summary>
|
||||
public class EntryPoint
|
||||
{
|
||||
private const string PwshDllName = "pwsh.dll";
|
||||
|
||||
private const string WinFolderName = "win";
|
||||
|
||||
private const string UnixFolderName = "unix";
|
||||
|
||||
/// <summary>
|
||||
/// Entry point for the global tool.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments passed to the global tool.</param>
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var currentPath = new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location).Directory.FullName;
|
||||
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
|
||||
string platformFolder = isWindows ? WinFolderName : UnixFolderName;
|
||||
|
||||
string argsString = args.Length > 0 ? string.Join(" ", args) : null;
|
||||
var pwshPath = Path.Combine(currentPath, platformFolder, PwshDllName);
|
||||
string processArgs = string.IsNullOrEmpty(argsString) ? $"{pwshPath}" : $"{pwshPath} -c {argsString}";
|
||||
|
||||
if (File.Exists(pwshPath))
|
||||
{
|
||||
System.Diagnostics.Process.Start("dotnet", processArgs).WaitForExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new FileNotFoundException(pwshPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\PowerShell.Common.props" />
|
||||
<PropertyGroup>
|
||||
<Description>Shim for global tool to select appropriate runtime</Description>
|
||||
<AssemblyName>Microsoft.PowerShell.GlobalTool.Shim</AssemblyName>
|
||||
<OutputType>EXE</OutputType>
|
||||
<RootNamespace>Microsoft.PowerShell.GlobalTool.Shim</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,4 @@
|
|||
// This is required to roll forward to runtime 3.x when 2.x is not installed
|
||||
{
|
||||
"rollForwardOnNoCandidateFx": 2
|
||||
}
|
|
@ -6,7 +6,7 @@ Copyright="Copyright (c) Microsoft Corporation. All rights reserved."
|
|||
ModuleVersion="1.0.0"
|
||||
PowerShellVersion="5.0"
|
||||
CmdletsToExport=@()
|
||||
FunctionsToExport=@('Start-PSPackage','New-PSSignedBuildZip', 'New-UnifiedNugetPackage', 'New-MSIPatch', 'Expand-PSSignedBuild', 'Publish-NugetToMyGet', 'New-DotnetSdkContainerFxdPackage')
|
||||
FunctionsToExport=@('Start-PSPackage','New-PSSignedBuildZip', 'New-UnifiedNugetPackage', 'New-MSIPatch', 'Expand-PSSignedBuild', 'Publish-NugetToMyGet', 'New-DotnetSdkContainerFxdPackage', 'New-GlobalToolNupkg')
|
||||
RootModule="packaging.psm1"
|
||||
RequiredModules = @("build")
|
||||
}
|
||||
|
|
|
@ -3092,105 +3092,152 @@ function Get-PackageVersionAsMajorMinorBuildRevision
|
|||
.SYNOPSIS
|
||||
Create a smaller framework dependent package based off fxdependent package for dotnet-sdk container images.
|
||||
|
||||
.PARAMETER FxdPackagePath
|
||||
.PARAMETER Path
|
||||
Path to the folder containing the fxdependent package.
|
||||
|
||||
.PARAMETER ReleaseTag
|
||||
Release tag to construct the package name.
|
||||
#>
|
||||
function New-DotnetSdkContainerFxdPackage {
|
||||
[CmdletBinding(SupportsShouldProcess = $true)]
|
||||
function ReduceFxDependentPackage
|
||||
{
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)] $FxdPackagePath,
|
||||
|
||||
[ValidatePattern("^v\d+\.\d+\.\d+(-\w+(\.\d+)?)?$")]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Parameter(Mandatory)] $ReleaseTag,
|
||||
|
||||
[Parameter(Mandatory)] $DestinationPath
|
||||
[Parameter(Mandatory)] [string] $Path
|
||||
)
|
||||
|
||||
$Version = $ReleaseTag -Replace '^v'
|
||||
|
||||
if ($Environment.IsWindows) {
|
||||
$basePackagePattern = "*$Version-win-fxdependent.zip"
|
||||
$packageNamePlatform = 'win'
|
||||
$packageNameExtension = '.zip'
|
||||
} else {
|
||||
$basePackagePattern = "*$Version-linux-x64-fxdependent.tar.gz"
|
||||
$packageNamePlatform = 'linux-x64'
|
||||
$packageNameExtension = '.tar.gz'
|
||||
if (-not (Test-Path $path))
|
||||
{
|
||||
throw "Path not found: $Path"
|
||||
}
|
||||
|
||||
Write-Log "basePackagePattern: $basePackagePattern"
|
||||
Write-Log "fxdPackagePath: $FxdPackagePath"
|
||||
## Remove unnecessary files
|
||||
$localeFolderToRemove = 'cs', 'de', 'es', 'fr', 'it', 'ja', 'ko', 'pl', 'pt-BR', 'ru', 'tr', 'zh-Hans', 'zh-Hant'
|
||||
Get-ChildItem $Path -Recurse -Directory | Where-Object { $_.Name -in $localeFolderToRemove } | ForEach-Object { Remove-Item $_.FullName -Force -Recurse -Verbose }
|
||||
|
||||
$packageName = "powershell-$Version-$packageNamePlatform-fxd-dotnetsdk$packageNameExtension"
|
||||
$destinationPackageFullName = Join-Path $DestinationPath $packageName
|
||||
$runtimeFolder = Get-ChildItem $Path -Recurse -Directory -Filter 'runtimes'
|
||||
|
||||
## Get fxdependent package path
|
||||
$fxdPackage = Get-ChildItem $FxdPackagePath -Recurse -Filter $basePackagePattern | Select-Object -First 1 -ExpandProperty FullName
|
||||
|
||||
Write-Log "Fxd Package Path: $fxdPackage"
|
||||
|
||||
if ($fxdPackage) {
|
||||
if ($PSCmdlet.ShouldProcess("Create the reduced framework dependent package based of $fxPackage")) {
|
||||
|
||||
## Extract fxd package
|
||||
$tempExtractFolder = New-Item -Type Directory -Path "$FxdPackagePath/fxdreduced" -Force
|
||||
Push-Location $tempExtractFolder
|
||||
|
||||
Write-Log "Pushed location: $tempExtractFolder"
|
||||
|
||||
try {
|
||||
if ($Environment.IsWindows) {
|
||||
Expand-Archive -Path $fxdPackage -DestinationPath $tempExtractFolder
|
||||
} else {
|
||||
Start-NativeExecution { tar -xf $fxdPackage }
|
||||
}
|
||||
|
||||
## Remove unnecessary files
|
||||
$localeFolderToRemove = 'cs', 'de', 'es', 'fr', 'it', 'ja', 'ko', 'pl', 'pt-BR', 'ru', 'tr', 'zh-Hans', 'zh-Hant'
|
||||
Get-ChildItem -Recurse -Directory | Where-Object { $_.Name -in $localeFolderToRemove } | ForEach-Object { Remove-Item $_.FullName -Force -Recurse -Verbose }
|
||||
|
||||
$runtimeFolder = Get-ChildItem -Recurse -Directory -Filter 'runtimes'
|
||||
|
||||
# donet SDK container image microsoft/dotnet:2.2-sdk supports the following:
|
||||
# win10-x64 (Nano Server)
|
||||
# win-arm (Nano Server)
|
||||
# linux-musl-x64 (Alpine 3.8)
|
||||
# linux-x64 (bionic / stretch)
|
||||
# unix, linux, win for dependencies
|
||||
# win-x64 to get PowerShell.Native components
|
||||
$runtimesToKeep = 'win10-x64', 'win-arm', 'win-x64', 'linux-x64', 'linux-musl-x64', 'unix', 'linux', 'win'
|
||||
|
||||
$runtimeFolder | ForEach-Object {
|
||||
Get-ChildItem $_ -Exclude $runtimesToKeep -Directory | Remove-Item -Force -Recurse -Verbose
|
||||
}
|
||||
|
||||
Write-Verbose -Verbose "Compressing"
|
||||
|
||||
if (-not (Test-Path $DestinationPath)) {
|
||||
$null = New-Item -ItemType Directory -Path $DestinationPath
|
||||
}
|
||||
|
||||
if ($Environment.IsWindows) {
|
||||
Compress-Archive -Path "$FxdPackagePath/fxdreduced/*" -Destination $destinationPackageFullName -Force
|
||||
} else {
|
||||
Start-NativeExecution { tar -czf "$destinationPackageFullName" . }
|
||||
}
|
||||
|
||||
Write-Log "Compressing complete"
|
||||
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
# donet SDK container image microsoft/dotnet:2.2-sdk supports the following:
|
||||
# win10-x64 (Nano Server)
|
||||
# win-arm (Nano Server)
|
||||
# win-x64 to get PowerShell.Native components
|
||||
# linux-musl-x64 (Alpine 3.8)
|
||||
# linux-x64 (bionic / stretch)
|
||||
# unix, linux, win for dependencies
|
||||
# linux-arm and linux-arm64 for arm containers
|
||||
# osx to run global tool on macOS
|
||||
$runtimesToKeep = if ($Environment.IsWindows) {
|
||||
'win10-x64', 'win-arm', 'win-x64', 'win'
|
||||
} else {
|
||||
'linux-x64', 'linux-musl-x64', 'unix', 'linux', 'linux-arm', 'linux-arm64', 'osx'
|
||||
}
|
||||
|
||||
if (Test-Path $destinationPackageFullName) {
|
||||
Write-Host "##vso[artifact.upload containerfolder=release;artifactname=release]$destinationPackageFullName"
|
||||
} else {
|
||||
Write-Log "Package not found: $destinationPackageFullName"
|
||||
$runtimeFolder | ForEach-Object {
|
||||
Get-ChildItem $_ -Exclude $runtimesToKeep -Directory | Remove-Item -Force -Recurse -Verbose
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a Global tool nuget package for PowerShell.
|
||||
|
||||
.DESCRIPTION
|
||||
If the UnifiedPackage switch is present, then create a packag with both Windows and Unix runtimes.
|
||||
Else create two packages, one for Windows and other for Linux.
|
||||
|
||||
.PARAMETER LinuxBinPath
|
||||
Path to the folder containing the fxdependent package for Linux.
|
||||
|
||||
.PARAMETER WindowsBinPath
|
||||
Path to the folder containing the fxdependent package for Windows.
|
||||
|
||||
.PARAMETER PackageVersion
|
||||
Version for the NuGet package that will be generated.
|
||||
|
||||
.PARAMETER DestinationPath
|
||||
Path to the folder where the generated packages will be copied to.
|
||||
|
||||
.PARAMETER UnifiedPackage
|
||||
Create package with both Windows and Unix runtimes.
|
||||
#>
|
||||
function New-GlobalToolNupkg
|
||||
{
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)] [string] $LinuxBinPath,
|
||||
[Parameter(Mandatory)] [string] $WindowsBinPath,
|
||||
[Parameter(Mandatory)] [string] $PackageVersion,
|
||||
[Parameter(Mandatory)] [string] $DestinationPath,
|
||||
[Parameter(ParameterSetName="UnifiedPackage")] [switch] $UnifiedPackage
|
||||
)
|
||||
|
||||
$packageInfo = @()
|
||||
|
||||
Remove-Item -Path (Join-Path $LinuxBinPath 'libcrypto.so.1.0.0') -Verbose -Force -Recurse
|
||||
Remove-Item -Path (Join-Path $LinuxBinPath 'libssl.so.1.0.0') -Verbose -Force -Recurse
|
||||
|
||||
if ($UnifiedPackage)
|
||||
{
|
||||
Write-Log "Creating a unified package"
|
||||
$packageInfo += @{ RootFolder = (New-TempFolder); PackageName = "PowerShell"; Type = "Unified"}
|
||||
$ShimDllPath = Join-Path $WindowsBinPath "Microsoft.PowerShell.GlobalTool.Shim.dll"
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Log "Reducing size of Linux package"
|
||||
ReduceFxDependentPackage -Path $LinuxBinPath
|
||||
|
||||
Write-Log "Reducing size of Windows package"
|
||||
ReduceFxDependentPackage -Path $WindowsBinPath
|
||||
|
||||
Write-Log "Creating a Linux and Windows packages"
|
||||
$packageInfo += @{ RootFolder = (New-TempFolder); PackageName = "PowerShell.Linux"; Type = "Linux"}
|
||||
$packageInfo += @{ RootFolder = (New-TempFolder); PackageName = "PowerShell.Windows"; Type = "Windows"}
|
||||
}
|
||||
|
||||
$packageInfo | ForEach-Object {
|
||||
$ridFolder = New-Item -Path (Join-Path $_.RootFolder "tools/netcoreapp2.1/any") -ItemType Directory
|
||||
|
||||
switch ($_.Type)
|
||||
{
|
||||
"Unified"
|
||||
{
|
||||
$winFolder = New-Item (Join-Path $ridFolder "win") -ItemType Directory
|
||||
$unixFolder = New-Item (Join-Path $ridFolder "unix") -ItemType Directory
|
||||
|
||||
Write-Log "Copying runtime assemblies from $WindowsBinPath"
|
||||
Copy-Item "$WindowsBinPath\*" -Destination $winFolder -Recurse
|
||||
|
||||
Write-Log "Copying runtime assemblies from $LinuxBinPath"
|
||||
Copy-Item "$LinuxBinPath\*" -Destination $unixFolder -Recurse
|
||||
|
||||
Write-Log "Copying shim dll from $ShimDllPath"
|
||||
Copy-Item $ShimDllPath -Destination $ridFolder
|
||||
|
||||
$shimConfigFile = Join-Path (Split-Path $ShimDllPath -Parent) 'Microsoft.PowerShell.GlobalTool.Shim.runtimeconfig.json'
|
||||
Write-Log "Copying shim config file from $shimConfigFile"
|
||||
Copy-Item $shimConfigFile -Destination $ridFolder -ErrorAction Stop
|
||||
|
||||
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f (Split-Path $ShimDllPath -Leaf)
|
||||
}
|
||||
|
||||
"Linux"
|
||||
{
|
||||
Write-Log "Copying runtime assemblies from $LinuxBinPath"
|
||||
Copy-Item "$LinuxBinPath/*" -Destination $ridFolder -Recurse
|
||||
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
|
||||
}
|
||||
|
||||
"Windows"
|
||||
{
|
||||
Write-Log "Copying runtime assemblies from $LinuxBinPath"
|
||||
Copy-Item "$WindowsBinPath/*" -Destination $ridFolder -Recurse
|
||||
$toolSettings = $packagingStrings.GlobalToolSettingsFile -f "pwsh.dll"
|
||||
}
|
||||
}
|
||||
|
||||
$packageName = $_.PackageName
|
||||
$nuSpec = $packagingStrings.GlobalToolNuSpec -f $packageName, $PackageVersion
|
||||
$nuSpec | Out-File -FilePath (Join-Path $_.RootFolder "$packageName.nuspec") -Encoding ascii
|
||||
$toolSettings | Out-File -FilePath (Join-Path $ridFolder "DotnetToolSettings.xml") -Encoding ascii
|
||||
|
||||
Write-Log "Creating a package: $packageName"
|
||||
New-NugetPackage -NuSpecPath $_.RootFolder -PackageDestinationPath $DestinationPath
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,4 +147,37 @@ open {0}
|
|||
</packageSources>
|
||||
</configuration>
|
||||
'@
|
||||
|
||||
GlobalToolNuSpec = @'
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>{0}</id>
|
||||
<version>{1}</version>
|
||||
<authors>Microsoft</authors>
|
||||
<owners>Microsoft,PowerShell</owners>
|
||||
<projectUrl>https://github.com/PowerShell/PowerShell</projectUrl>
|
||||
<iconUrl>https://github.com/PowerShell/PowerShell/blob/master/assets/Powershell_black_64.png?raw=true</iconUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>PowerShell Core global tool</description>
|
||||
<license type="expression">MIT</license>
|
||||
<tags>PowerShell</tags>
|
||||
<language>en-US</language>
|
||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
<packageTypes>
|
||||
<packageType name="DotnetTool" />
|
||||
</packageTypes>
|
||||
</metadata>
|
||||
</package>
|
||||
'@
|
||||
|
||||
GlobalToolSettingsFile = @'
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DotNetCliTool Version="1">
|
||||
<Commands>
|
||||
<Command Name="pwsh" EntryPoint="{0}" Runner="dotnet" />
|
||||
</Commands>
|
||||
</DotNetCliTool>
|
||||
'@
|
||||
|
||||
}
|
||||
|
|
|
@ -36,13 +36,6 @@ jobs:
|
|||
parameters:
|
||||
buildName: alpine
|
||||
|
||||
- template: templates/dotnetsdk-fxdependent.yml
|
||||
parameters:
|
||||
parentJobs:
|
||||
- build_fxdependent
|
||||
poolName: Hosted Ubuntu 1604
|
||||
buildName: Linux
|
||||
|
||||
- template: templates/mac.yml
|
||||
|
||||
- template: templates/windows-build.yml
|
||||
|
@ -65,13 +58,6 @@ jobs:
|
|||
parameters:
|
||||
Architecture: fxdependent
|
||||
|
||||
- template: templates/dotnetsdk-fxdependent.yml
|
||||
parameters:
|
||||
parentJobs:
|
||||
- WinPackageSigningJob
|
||||
poolName: Package ES CodeHub Lab E
|
||||
buildName: Windows
|
||||
|
||||
- template: templates/windows-component-governance.yml
|
||||
|
||||
- template: templates/windows-package-signing.yml
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
parameters:
|
||||
parentJobs: []
|
||||
poolName: Hosted Ubuntu 1604
|
||||
buildName: Linux-x64
|
||||
|
||||
jobs:
|
||||
- job: dotnetfxd_${{ parameters.buildName }}
|
||||
displayName: Create fxdependent package dotnet sdk - ${{ parameters.buildName }}
|
||||
dependsOn:
|
||||
${{ parameters.parentJobs }}
|
||||
condition: succeeded()
|
||||
pool: ${{ parameters.poolName }}
|
||||
steps:
|
||||
|
||||
- template: SetVersionVariables.yml
|
||||
parameters:
|
||||
ReleaseTagVar: $(ReleaseTagVar)
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download Artifacts'
|
||||
inputs:
|
||||
downloadType: specific
|
||||
itemPattern: |
|
||||
**/*.tar.gz
|
||||
**/*.zip
|
||||
downloadPath: '$(System.ArtifactsDirectory)/finished'
|
||||
|
||||
- powershell: |
|
||||
Get-ChildItem '$(System.ArtifactsDirectory)/finished' -recurse
|
||||
displayName: Capture list of downloaded artifacts
|
||||
|
||||
- powershell: |
|
||||
Import-Module $(Build.SourcesDirectory)/build.psm1 -Force
|
||||
Import-Module $(Build.SourcesDirectory)/tools/packaging -Force
|
||||
New-DotnetSdkContainerFxdPackage -FxdPackagePath "$(System.ArtifactsDirectory)/finished" -ReleaseTag $(ReleaseTagVar) -DestinationPath "$(System.ArtifactsDirectory)/finished/release"
|
||||
displayName: 'Create fxdependent package for dotnet sdk docker image'
|
||||
|
||||
- job:
|
||||
displayName: Upload fxdependent package dotnet sdk - ${{ parameters.buildName }}
|
||||
dependsOn: dotnetfxd_${{ parameters.buildName }}
|
||||
condition: succeeded()
|
||||
pool: Package ES CodeHub Lab E
|
||||
steps:
|
||||
|
||||
- template: SetVersionVariables.yml
|
||||
parameters:
|
||||
ReleaseTagVar: $(ReleaseTagVar)
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download FxDependent dotnet sdx artifacts'
|
||||
inputs:
|
||||
downloadType: specific
|
||||
itemPattern: |
|
||||
**/*fxd-dotnetsdk.zip
|
||||
**/*fxd-dotnetsdk.tar.gz
|
||||
downloadPath: '$(System.ArtifactsDirectory)'
|
||||
condition: succeeded()
|
||||
|
||||
- powershell: |
|
||||
Get-ChildItem '$(System.ArtifactsDirectory)\release'
|
||||
displayName: Capture list of downloaded artifacts
|
||||
|
||||
- task: AzureFileCopy@1
|
||||
displayName: 'Upload to azure'
|
||||
inputs:
|
||||
SourcePath: '$(System.ArtifactsDirectory)\release'
|
||||
azureSubscription: '$(AzureFileCopySubscription)'
|
||||
Destination: AzureBlob
|
||||
storage: '$(StorageAccount)'
|
||||
ContainerName: '$(AzureVersion)-internal'
|
|
@ -18,6 +18,8 @@ jobs:
|
|||
winX86Path: '$(System.ArtifactsDirectory)/winX86'
|
||||
GenAPIToolPath: '$(System.ArtifactsDirectory)/GenAPI'
|
||||
PackagePath: '$(System.ArtifactsDirectory)/UnifiedPackagePath'
|
||||
winFxdPath: '$(System.ArtifactsDirectory)/winFxd'
|
||||
linuxFxdPath: '$(System.ArtifactsDirectory)/linuxFxd'
|
||||
|
||||
steps:
|
||||
|
||||
|
@ -36,9 +38,7 @@ jobs:
|
|||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download PowerShell build artifacts'
|
||||
inputs:
|
||||
buildType: specific
|
||||
project: '9d7f7aa4-6f41-480d-a367-82eb278461a1'
|
||||
pipeline: 696
|
||||
buildType: current
|
||||
downloadType: specific
|
||||
itemPattern: |
|
||||
finalResults/PowerShell-*-win-*.zip
|
||||
|
@ -84,21 +84,33 @@ jobs:
|
|||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files win-arm64'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-arm64.zip '
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-arm64.zip'
|
||||
destinationFolder: '$(winArm64Path)'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files win-X64'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-x64.zip '
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-x64.zip'
|
||||
destinationFolder: '$(winX64Path)'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files win-X86'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-x86.zip '
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-x86.zip'
|
||||
destinationFolder: '$(winX86Path)'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files win-fxdependent'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-fxdependent.zip'
|
||||
destinationFolder: '$(winFxdPath)'
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract files linux-fxdependent'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/powershell-*-linux-x64-fxdependent.tar.gz'
|
||||
destinationFolder: '$(linuxFxdPath)'
|
||||
|
||||
- task: PkgESInstallNuGetToolsPackage@10
|
||||
displayName: 'Install package Microsoft.DotNet.BuildTools.GenAPI'
|
||||
inputs:
|
||||
|
@ -116,13 +128,23 @@ jobs:
|
|||
inputs:
|
||||
versionSpec: 4.9.3
|
||||
|
||||
|
||||
- powershell: |
|
||||
Import-Module $env:BUILD_SOURCESDIRECTORY\build.psm1
|
||||
Import-Module $env:BUILD_SOURCESDIRECTORY\tools\packaging
|
||||
New-UnifiedNugetPackage -PackagePath "$(PackagePath)" -PackageVersion "$(Version)" -winx86BinPath "$(winX86Path)" -winx64BinPath "$(winX64Path)" -winArm32BinPath "$(winArm32Path)" -winArm64BinPath "$(winArm64Path)" -linuxArm32BinPath "$(linuxArm32Path)" -linuxBinPath "$(linuxX64Path)" -osxBinPath "$(macOSPath)" -GenAPIToolPath "$(GenAPIToolPath)"
|
||||
displayName: 'Create Nuget Package Folders'
|
||||
|
||||
- powershell: |
|
||||
Import-Module $env:BUILD_SOURCESDIRECTORY\build.psm1
|
||||
Import-Module $env:BUILD_SOURCESDIRECTORY\tools\packaging
|
||||
|
||||
# Create unified package first
|
||||
New-GlobalToolNupkg -UnifiedPackage -LinuxBinPath "$(linuxFxdPath)" -WindowsBinPath "$(winFxdPath)" -PackageVersion "$(Version)" -DestinationPath "$(PackagePath)"
|
||||
|
||||
# Create packages for dotnet sdk
|
||||
New-GlobalToolNupkg -LinuxBinPath "$(linuxFxdPath)" -WindowsBinPath "$(winFxdPath)" -PackageVersion "$(Version)" -DestinationPath "$(PackagePath)"
|
||||
displayName: 'Create Global tool packages'
|
||||
|
||||
- powershell: |
|
||||
Get-ChildItem "$(PackagePath)" -Recurse
|
||||
displayName: Capture generated packages
|
||||
|
@ -165,6 +187,16 @@ jobs:
|
|||
parameters:
|
||||
artifactPath: '$(System.ArtifactsDirectory)\signed'
|
||||
|
||||
- task: AzureFileCopy@1
|
||||
displayName: 'Upload NuGet packages to Azure'
|
||||
inputs:
|
||||
SourcePath: '$(System.ArtifactsDirectory)\signed\'
|
||||
azureSubscription: '$(AzureFileCopySubscription)'
|
||||
Destination: AzureBlob
|
||||
storage: '$(StorageAccount)'
|
||||
ContainerName: '$(AzureVersion)-nuget'
|
||||
condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'))
|
||||
|
||||
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
||||
displayName: 'Component Detection'
|
||||
inputs:
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<file src="__INPATHROOT__\Microsoft.PowerShell.ConsoleHost.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Microsoft.PowerShell.ConsoleHost.dll" />
|
||||
<file src="__INPATHROOT__\Microsoft.PowerShell.CoreCLR.Eventing.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Microsoft.PowerShell.CoreCLR.Eventing.dll" />
|
||||
<file src="__INPATHROOT__\Microsoft.PowerShell.MarkdownRender.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Microsoft.PowerShell.MarkdownRender.dll" />
|
||||
<file src="__INPATHROOT__\Microsoft.PowerShell.GlobalTool.Shim.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Microsoft.PowerShell.GlobalTool.Shim.dll" />
|
||||
<file src="__INPATHROOT__\Microsoft.PowerShell.Security.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Microsoft.PowerShell.Security.dll" />
|
||||
<file src="__INPATHROOT__\Microsoft.WSMan.Management.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Microsoft.WSMan.Management.dll" />
|
||||
<file src="__INPATHROOT__\Microsoft.WSMan.Runtime.dll" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Microsoft.WSMan.Runtime.dll" />
|
||||
|
|
|
@ -8,9 +8,10 @@ param(
|
|||
|
||||
if ($SkipPwshExe) {
|
||||
## This is required for fxdependent package as no .exe is generated.
|
||||
$xmlContent = Get-Content $SigningXmlPath | Where-Object { $_ -notmatch '__INPATHROOT__\\pwsh.exe'}
|
||||
$xmlContent = Get-Content $SigningXmlPath | Where-Object { $_ -notmatch '__INPATHROOT__\\pwsh.exe' }
|
||||
} else {
|
||||
$xmlContent = Get-Content $signingXmlPath
|
||||
## We skip the global tool shim assembly for regular builds.
|
||||
$xmlContent = Get-Content $signingXmlPath | Where-Object { $_ -notmatch '__INPATHROOT__\\Microsoft.PowerShell.GlobalTool.Shim.dll' }
|
||||
}
|
||||
|
||||
# Parse the signing xml
|
||||
|
|
Loading…
Reference in a new issue