From 83178f49155d7e0fa8f3ca52ec25828f5732d2b9 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 3 Nov 2017 10:45:20 -0700 Subject: [PATCH 1/4] change to package publish folder similar to normal, but include symbols as an embedded zip --- tools/packaging/packaging.psm1 | 49 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 3aaee4e6ebb..bcd5cf17834 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -146,38 +146,37 @@ function Start-PSPackage { $Source = Split-Path -Path $Script:Options.Output -Parent - # If building a symbols package, don't include the publish build. + # If building a symbols package, we add a zip of the parent to publish if ($IncludeSymbols.IsPresent) { $publishSource = $Source $buildSource = Split-Path -Path $Source -Parent $Source = New-TempFolder + $symbolsSource = New-TempFolder - # files not to include as individual files. These files will be included in publish.zip - $toExclude = @( - 'hostfxr.dll' - 'hostpolicy.dll' - 'libhostfxr.so' - 'libhostpolicy.so' - 'libhostfxr.dylib' - 'libhostpolicy.dylib' - 'Publish' - ) - Get-ChildItem -Path $buildSource | Where-Object {$toExclude -inotcontains $_.Name} | Copy-Item -Destination $Source -Recurse - - # Replace binaries with crossgen'ed binaires from publish folder. - Get-ChildItem -Recurse $Source | ForEach-Object { - $relativePath = $_.FullName.Replace($Source, '') - $publishPath = Join-Path $publishSource -ChildPath $relativePath - if (Test-Path -Path $publishPath) - { - Copy-Item -Path $publishPath -Destination $_.FullName -Force - } + try + { + Get-ChildItem -Path $publishSource | Copy-Item -Destination $Source -Recurse + # files not to include as individual files. These files will be included in publish.zip + $toExclude = @( + 'hostfxr.dll' + 'hostpolicy.dll' + 'libhostfxr.so' + 'libhostpolicy.so' + 'libhostfxr.dylib' + 'libhostpolicy.dylib' + 'Publish' + ) + Get-ChildItem -Path $buildSource | Where-Object {$toExclude -inotcontains $_.Name} | Copy-Item -Destination $symbolsSource -Recurse + + $zipSource = Join-Path $symbolsSource -ChildPath '*' + $zipPath = Join-Path -Path $Source -ChildPath 'symbols.zip' + Compress-Archive -Path $zipSource -DestinationPath $zipPath + } + finally + { + Remove-Item -Path $symbolsSource -Recurse -Force -ErrorAction SilentlyContinue } - - $zipSource = Join-Path $publishSource -ChildPath '*' - $zipPath = Join-Path -Path $Source -ChildPath 'publish.zip' - Compress-Archive -Path $zipSource -DestinationPath $zipPath } log "Packaging Source: '$Source'" From 9b2f48dabd5f6d23bf4c6436652b5f7a8912953d Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 3 Nov 2017 12:09:51 -0700 Subject: [PATCH 2/4] Add comments --- tools/packaging/packaging.psm1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index bcd5cf17834..1badd7f5241 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -156,8 +156,10 @@ function Start-PSPackage { try { + # Copy files which go into the root package Get-ChildItem -Path $publishSource | Copy-Item -Destination $Source -Recurse - # files not to include as individual files. These files will be included in publish.zip + + # files not to include as individual files. These files will be included in the root package $toExclude = @( 'hostfxr.dll' 'hostpolicy.dll' @@ -167,8 +169,10 @@ function Start-PSPackage { 'libhostpolicy.dylib' 'Publish' ) + # Copy file which go into symbols.zip Get-ChildItem -Path $buildSource | Where-Object {$toExclude -inotcontains $_.Name} | Copy-Item -Destination $symbolsSource -Recurse + # Zip symbols.zip to the root package $zipSource = Join-Path $symbolsSource -ChildPath '*' $zipPath = Join-Path -Path $Source -ChildPath 'symbols.zip' Compress-Archive -Path $zipSource -DestinationPath $zipPath From e63f311f14b23821821be548fcf47a998be7afb9 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 3 Nov 2017 12:42:17 -0700 Subject: [PATCH 3/4] add compliance extraction script --- tools/releaseBuild/createComplianceFolder.ps1 | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tools/releaseBuild/createComplianceFolder.ps1 diff --git a/tools/releaseBuild/createComplianceFolder.ps1 b/tools/releaseBuild/createComplianceFolder.ps1 new file mode 100644 index 00000000000..31b972b9bc5 --- /dev/null +++ b/tools/releaseBuild/createComplianceFolder.ps1 @@ -0,0 +1,38 @@ +param( + [Parameter(HelpMessage="Artifact folder to find compliance files in.")] + [string[]] + $ArtifactFolder, + [Parameter(HelpMessage="VSTS Variable to set path to complinance Files.")] + [string] + $VSTSVariableName +) + +$compliancePath = $null +foreach($folder in $ArtifactFolder) +{ + # Find Symbols zip which contains compliance files + Write-Host "ArtifactFolder: $folder" + $filename = Join-Path -Path $folder -ChildPath 'symbols.zip' + $name = Split-Path -Path $folder -Leaf + + # Throw is compliance zip does not exist + if (!(Test-Path $filename)) + { + throw "symbols.zip for $VSTSVariableName does not exist" + } + + # make sure we have a single parent for everything + if (!$compliancePath) + { + $parent = Split-Path -Path $folder + $compliancePath = Join-Path -Path $parent -ChildPath 'compliance' + } + + # Extract complance files to individual folder to avoid overwriting files. + $unzipPath = Join-Path -Path $compliancePath -ChildPath $name + Write-Host "Symbols-zip: $filename ; unzipPath: $unzipPath" + Expand-Archive -Path $fileName -DestinationPath $unzipPath +} + +# set VSTS variable with path to compliance files +Write-Host "##vso[task.setvariable variable=$VSTSVariableName]$unzipPath" \ No newline at end of file From 6ea7d05c51cfcc6e652cc8b93397a9211d38e585 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 3 Nov 2017 13:22:54 -0700 Subject: [PATCH 4/4] Add exclusion for pwsh.exe and pester --- tools/packaging/packaging.psm1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 1badd7f5241..7026fb393ef 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -160,6 +160,7 @@ function Start-PSPackage { Get-ChildItem -Path $publishSource | Copy-Item -Destination $Source -Recurse # files not to include as individual files. These files will be included in the root package + # pwsh.exe is just dotnet.exe renamed by dotnet.exe during the build. $toExclude = @( 'hostfxr.dll' 'hostpolicy.dll' @@ -168,10 +169,18 @@ function Start-PSPackage { 'libhostfxr.dylib' 'libhostpolicy.dylib' 'Publish' + 'pwsh.exe' ) # Copy file which go into symbols.zip Get-ChildItem -Path $buildSource | Where-Object {$toExclude -inotcontains $_.Name} | Copy-Item -Destination $symbolsSource -Recurse + # Exclude Pester until we move it to PSModuleRestore + $pesterPath = Join-Path -Path $symbolsSource -ChildPath 'Modules\Pester' + if(Test-Path -Path $pesterPath) + { + Remove-Item -Path $pesterPath -Recurse -Force -ErrorAction SilentlyContinue + } + # Zip symbols.zip to the root package $zipSource = Join-Path $symbolsSource -ChildPath '*' $zipPath = Join-Path -Path $Source -ChildPath 'symbols.zip'