diff --git a/build.psm1 b/build.psm1 index 70900757d6..723c7fb42a 100644 --- a/build.psm1 +++ b/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"))) { diff --git a/src/Microsoft.PowerShell.GlobalTool.Shim/GlobalToolShim.cs b/src/Microsoft.PowerShell.GlobalTool.Shim/GlobalToolShim.cs new file mode 100644 index 0000000000..1ca27b09f7 --- /dev/null +++ b/src/Microsoft.PowerShell.GlobalTool.Shim/GlobalToolShim.cs @@ -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 +{ + /// + /// Shim layer to chose the appropriate runtime for PowerShell Core DotNet Global tool. + /// + public class EntryPoint + { + private const string PwshDllName = "pwsh.dll"; + + private const string WinFolderName = "win"; + + private const string UnixFolderName = "unix"; + + /// + /// Entry point for the global tool. + /// + /// Arguments passed to the global tool. + 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); + } + } + } +} diff --git a/src/Microsoft.PowerShell.GlobalTool.Shim/Microsoft.PowerShell.GlobalTool.Shim.csproj b/src/Microsoft.PowerShell.GlobalTool.Shim/Microsoft.PowerShell.GlobalTool.Shim.csproj new file mode 100644 index 0000000000..c8d2b253e5 --- /dev/null +++ b/src/Microsoft.PowerShell.GlobalTool.Shim/Microsoft.PowerShell.GlobalTool.Shim.csproj @@ -0,0 +1,11 @@ + + + + + Shim for global tool to select appropriate runtime + Microsoft.PowerShell.GlobalTool.Shim + EXE + Microsoft.PowerShell.GlobalTool.Shim + + + diff --git a/src/Microsoft.PowerShell.GlobalTool.Shim/runtimeconfig.template.json b/src/Microsoft.PowerShell.GlobalTool.Shim/runtimeconfig.template.json new file mode 100644 index 0000000000..8ba6dc2eba --- /dev/null +++ b/src/Microsoft.PowerShell.GlobalTool.Shim/runtimeconfig.template.json @@ -0,0 +1,4 @@ +// This is required to roll forward to runtime 3.x when 2.x is not installed +{ + "rollForwardOnNoCandidateFx": 2 +} diff --git a/tools/packaging/packaging.psd1 b/tools/packaging/packaging.psd1 index 9ca5941d19..d474f79972 100644 --- a/tools/packaging/packaging.psd1 +++ b/tools/packaging/packaging.psd1 @@ -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") } diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 3d70f78a0b..c29ecb93fd 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -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 } } diff --git a/tools/packaging/packaging.strings.psd1 b/tools/packaging/packaging.strings.psd1 index f1110d8901..e1f83bc24b 100644 --- a/tools/packaging/packaging.strings.psd1 +++ b/tools/packaging/packaging.strings.psd1 @@ -147,4 +147,37 @@ open {0} '@ + + GlobalToolNuSpec = @' + + + + {0} + {1} + Microsoft + Microsoft,PowerShell + https://github.com/PowerShell/PowerShell + https://github.com/PowerShell/PowerShell/blob/master/assets/Powershell_black_64.png?raw=true + false + PowerShell Core global tool + MIT + PowerShell + en-US + © Microsoft Corporation. All rights reserved. + + + + + +'@ + + GlobalToolSettingsFile = @' + + + + + + +'@ + } diff --git a/tools/releaseBuild/azureDevOps/releaseBuild.yml b/tools/releaseBuild/azureDevOps/releaseBuild.yml index 2a78d2f271..a29c4d9231 100644 --- a/tools/releaseBuild/azureDevOps/releaseBuild.yml +++ b/tools/releaseBuild/azureDevOps/releaseBuild.yml @@ -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 diff --git a/tools/releaseBuild/azureDevOps/templates/dotnetsdk-fxdependent.yml b/tools/releaseBuild/azureDevOps/templates/dotnetsdk-fxdependent.yml deleted file mode 100644 index 1cbee70618..0000000000 --- a/tools/releaseBuild/azureDevOps/templates/dotnetsdk-fxdependent.yml +++ /dev/null @@ -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' diff --git a/tools/releaseBuild/azureDevOps/templates/nuget.yml b/tools/releaseBuild/azureDevOps/templates/nuget.yml index da34068453..c9592df6ee 100644 --- a/tools/releaseBuild/azureDevOps/templates/nuget.yml +++ b/tools/releaseBuild/azureDevOps/templates/nuget.yml @@ -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: diff --git a/tools/releaseBuild/signing.xml b/tools/releaseBuild/signing.xml index 7fc788b791..8978f1796f 100644 --- a/tools/releaseBuild/signing.xml +++ b/tools/releaseBuild/signing.xml @@ -9,6 +9,7 @@ + diff --git a/tools/releaseBuild/updateSigning.ps1 b/tools/releaseBuild/updateSigning.ps1 index bd017976f9..3ebb474ca8 100644 --- a/tools/releaseBuild/updateSigning.ps1 +++ b/tools/releaseBuild/updateSigning.ps1 @@ -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