diff --git a/tools/packaging/packaging.psd1 b/tools/packaging/packaging.psd1 index d474f799727..de5672690e2 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', 'New-GlobalToolNupkg') +FunctionsToExport=@('Start-PSPackage','New-PSSignedBuildZip', 'New-MSIPatch', 'Expand-PSSignedBuild', 'Publish-NugetToMyGet', 'New-DotnetSdkContainerFxdPackage', 'New-GlobalToolNupkg', 'New-ILNugetPackage') RootModule="packaging.psm1" RequiredModules = @("build") } diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 846fe065cc5..23250a7db01 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -1444,7 +1444,7 @@ function CreateNugetPlatformFolder Creates NuGet packages containing linux, osx and Windows runtime assemblies. .DESCRIPTION -Creates a NuGet package for linux, osx, Windows runtimes for 32 bit, 64 bit and ARM. +Creates a NuGet package of IL assemblies for unix and windows. The packages for Microsoft.PowerShell.Commands.Diagnostics, Microsoft.PowerShell.Commands.Management, Microsoft.PowerShell.Commands.Utility, Microsoft.PowerShell.ConsoleHost, Microsoft.PowerShell.CoreCLR.Eventing, Microsoft.PowerShell.SDK, Microsoft.PowerShell.Security, Microsoft.WSMan.Management, Microsoft.WSMan.Runtime, @@ -1456,31 +1456,16 @@ Path where the package will be created. .PARAMETER PackageVersion Version of the created package. -.PARAMETER Winx86BinPath -Path to folder containing Windows x86 assemblies. +.PARAMETER WinFxdBinPath +Path to folder containing Windows framework dependent assemblies. -.PARAMETER Winx64BinPath -Path to folder containing Windows x64 assemblies. - -.PARAMETER WinArm32BinPath -Path to folder containing Windows arm32 assemblies. - -.PARAMETER WinArm64BinPath -Path to folder containing Windows arm64 assemblies. - -.PARAMETER LinuxArm32BinPath -Path to folder containing linux arm32 assemblies. - -.PARAMETER LinuxBinPath -Path to folder containing linux x64 assemblies. - -.PARAMETER OsxBinPath -Path to folder containing osx assemblies. +.PARAMETER LinuxFxdBinPath +Path to folder containing Linux framework dependent assemblies. .PARAMETER GenAPIToolPath Path to the GenAPI.exe tool. #> -function New-UnifiedNugetPackage +function New-ILNugetPackage { [CmdletBinding(SupportsShouldProcess = $true)] param( @@ -1492,28 +1477,10 @@ function New-UnifiedNugetPackage [string] $PackageVersion, [Parameter(Mandatory = $true)] - [string] $Winx86BinPath, - - [Parameter(Mandatory = $true)] - [string] $Winx64BinPath, - - [Parameter(Mandatory = $true)] - [string] $WinArm32BinPath, - - [Parameter(Mandatory = $true)] - [string] $WinArm64BinPath, - - [Parameter(Mandatory = $true)] - [string] $LinuxArm32BinPath, - - [Parameter(Mandatory = $false)] - [string] $LinuxAlpineBinPath, + [string] $WinFxdBinPath, [Parameter(Mandatory = $true)] - [string] $LinuxBinPath, - - [Parameter(Mandatory = $true)] - [string] $OsxBinPath, + [string] $LinuxFxdBinPath, [Parameter(Mandatory = $true)] [string] $GenAPIToolPath @@ -1521,7 +1488,7 @@ function New-UnifiedNugetPackage if (-not $Environment.IsWindows) { - throw "New-UnifiedNugetPackage can be only executed on Windows platform." + throw "New-ILNugetPackage can be only executed on Windows platform." } $fileList = @( @@ -1548,7 +1515,7 @@ function New-UnifiedNugetPackage $refBinPath = New-TempFolder $SnkFilePath = "$RepoRoot\src\signing\visualstudiopublic.snk" - New-ReferenceAssembly -linux64BinPath $linuxBinPath -RefAssemblyDestinationPath $refBinPath -RefAssemblyVersion $PackageVersion -SnkFilePath $SnkFilePath -GenAPIToolPath $GenAPIToolPath + New-ReferenceAssembly -linux64BinPath $LinuxFxdBinPath -RefAssemblyDestinationPath $refBinPath -RefAssemblyVersion $PackageVersion -SnkFilePath $SnkFilePath -GenAPIToolPath $GenAPIToolPath foreach ($file in $fileList) { @@ -1565,22 +1532,11 @@ function New-UnifiedNugetPackage $packageRuntimesFolderPath = $packageRuntimesFolder.FullName - CreateNugetPlatformFolder -Platform 'win-x86' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $winX86BinPath - CreateNugetPlatformFolder -Platform 'win-x64' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $winX64BinPath - CreateNugetPlatformFolder -Platform 'win-arm' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $winArm32BinPath - CreateNugetPlatformFolder -Platform 'win-arm64' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $winArm64BinPath + CreateNugetPlatformFolder -Platform 'win' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $WinFxdBinPath if ($linuxExceptionList -notcontains $file ) { - CreateNugetPlatformFolder -Platform 'linux-arm' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $linuxArm32BinPath - - if ($linuxAlpineBinPath) - { - CreateNugetPlatformFolder -Platform 'alpine-x64' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $LinuxAlpineBinPath - } - - CreateNugetPlatformFolder -Platform 'linux-x64' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $linuxBinPath - CreateNugetPlatformFolder -Platform 'osx' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $osxBinPath + CreateNugetPlatformFolder -Platform 'unix' -PackageRuntimesFolder $packageRuntimesFolderPath -PlatformBinPath $LinuxFxdBinPath } #region nuspec @@ -1691,7 +1647,7 @@ function New-UnifiedNugetPackage <# Copy the generated reference assemblies to the 'ref/netcoreapp2.1' folder properly. - This is a helper function used by 'New-UnifiedNugetPackage' + This is a helper function used by 'New-ILNugetPackage' #> function CopyReferenceAssemblies { @@ -1903,7 +1859,7 @@ function New-ReferenceAssembly throw "$assemblyName.dll was not found at: $Linux64BinPath" } - $genAPIArgs = "$linuxDllPath","-libPath:$Linux64BinPath" + $genAPIArgs = "$linuxDllPath","-libPath:$Linux64BinPath,$Linux64BinPath\ref" Write-Log "GenAPI cmd: $genAPIExe $genAPIArgsString" Start-NativeExecution { & $genAPIExe $genAPIArgs } | Out-File $generatedSource -Force @@ -1995,6 +1951,26 @@ function CleanupGeneratedSourceCode ApplyTo = "Microsoft.PowerShell.Commands.Utility" Pattern = "public partial struct ConvertToJsonContext" Replacement = "public readonly struct ConvertToJsonContext" + }, + @{ + ApplyTo = "Microsoft.PowerShell.Commands.Utility" + Pattern = "Unable to resolve assembly 'Assembly(Name=Newtonsoft.Json" + Replacement = "// Unable to resolve assembly 'Assembly(Name=Newtonsoft.Json" + }, + @{ + ApplyTo = "System.Management.Automation" + Pattern = "Unable to resolve assembly 'Assembly(Name=System.Security.Principal.Windows" + Replacement = "// Unable to resolve assembly 'Assembly(Name=System.Security.Principal.Windows" + }, + @{ + ApplyTo = "System.Management.Automation" + Pattern = "Unable to resolve assembly 'Assembly(Name=Microsoft.Management.Infrastructure" + Replacement = "// Unable to resolve assembly 'Assembly(Name=Microsoft.Management.Infrastructure" + }, + @{ + ApplyTo = "System.Management.Automation" + Pattern = "Unable to resolve assembly 'Assembly(Name=System.Security.AccessControl" + Replacement = "// Unable to resolve assembly 'Assembly(Name=System.Security.AccessControl" } ) diff --git a/tools/releaseBuild/azureDevOps/templates/nuget.yml b/tools/releaseBuild/azureDevOps/templates/nuget.yml index 33e985e5c3d..91273416864 100644 --- a/tools/releaseBuild/azureDevOps/templates/nuget.yml +++ b/tools/releaseBuild/azureDevOps/templates/nuget.yml @@ -9,13 +9,6 @@ jobs: condition: succeeded() pool: PowerShell variables: - linuxArm32Path: '$(System.ArtifactsDirectory)/linuxArm32' - winArm32Path: '$(System.ArtifactsDirectory)/winArm32' - linuxX64Path: '$(System.ArtifactsDirectory)/linuxX64' - macOSPath: '$(System.ArtifactsDirectory)/macOS' - winArm64Path: '$(System.ArtifactsDirectory)/winArm64' - winX64Path: '$(System.ArtifactsDirectory)/winX64' - winX86Path: '$(System.ArtifactsDirectory)/winX86' GenAPIToolPath: '$(System.ArtifactsDirectory)/GenAPI' PackagePath: '$(System.ArtifactsDirectory)/UnifiedPackagePath' winFxdPath: '$(System.ArtifactsDirectory)/winFxd' @@ -54,48 +47,6 @@ jobs: Get-ChildItem $packagePath -Recurse displayName: 'Conflate packages to same folder' - - task: ExtractFiles@1 - displayName: 'Extract files linuxArm32' - inputs: - archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/powershell-*-linux-arm32.tar.gz' - destinationFolder: '$(linuxArm32Path)' - - - task: ExtractFiles@1 - displayName: 'Extract files linuxX64' - inputs: - archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/powershell-*-linux-x64.tar.gz' - destinationFolder: '$(linuxX64Path)' - - - task: ExtractFiles@1 - displayName: 'Extract files macOS files' - inputs: - archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/powershell-*-osx*.tar.gz' - destinationFolder: '$(macOSPath)' - - - task: ExtractFiles@1 - displayName: 'Extract files win-arm32' - inputs: - archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-arm32.zip' - destinationFolder: '$(winArm32Path)' - - - task: ExtractFiles@1 - displayName: 'Extract files win-arm64' - inputs: - 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' - destinationFolder: '$(winX64Path)' - - - task: ExtractFiles@1 - displayName: 'Extract files win-X86' - inputs: - archiveFilePatterns: '$(System.ArtifactsDirectory)/packages/PowerShell-*-win-x86.zip' - destinationFolder: '$(winX86Path)' - - task: ExtractFiles@1 displayName: 'Extract files win-fxdependent' inputs: @@ -128,7 +79,7 @@ jobs: - 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)" + New-ILNugetPackage -PackagePath "$(PackagePath)" -PackageVersion "$(Version)" -WinFxdBinPath '$(winFxdPath)' -LinuxFxdBinPath '$(linuxFxdPath)' -GenAPIToolPath "$(GenAPIToolPath)" displayName: 'Create Nuget Package Folders' - powershell: |