|
| 1 | +# ---------------------------------------------------------------------------------- |
| 2 | +# Copyright Microsoft Corporation |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +# Unless required by applicable law or agreed to in writing, software |
| 8 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | +# See the License for the specific language governing permissions and |
| 11 | +# limitations under the License. |
| 12 | +# ---------------------------------------------------------------------------------- |
| 13 | + |
| 14 | +<# |
| 15 | +.SYNOPSIS |
| 16 | + Clean up unrelated files before nuget publish |
| 17 | +
|
| 18 | +.PARAMETER GenerateDocumentationFile |
| 19 | + Decide whether keeps XML files |
| 20 | +#> |
1 | 21 | [CmdletBinding()]
|
2 | 22 | Param
|
3 | 23 | (
|
4 | 24 | [Parameter()]
|
5 |
| - [string]$BuildConfig ="Debug" |
| 25 | + [string]$BuildConfig ="Debug", |
| 26 | + [Parameter()] |
| 27 | + [string]$GenerateDocumentationFile ="false" |
| 28 | + |
6 | 29 | )
|
7 | 30 |
|
8 | 31 | $output = Join-Path (Get-Item $PSScriptRoot).Parent.FullName "artifacts\$BuildConfig"
|
9 | 32 | Write-Verbose "The output folder is set to $output"
|
10 | 33 | $resourceManagerPath = $output
|
11 | 34 |
|
12 | 35 | $outputPaths = @($output)
|
| 36 | +$resourcesFolders = @("de", "es", "fr", "it", "ja", "ko", "ru", "zh-Hans", "zh-Hant", "cs", "pl", "pt-BR", "tr") |
| 37 | +$keepItems = @("*.dll-Help.xml", "Scaffold.xml", "RoleSettings.xml", "WebRole.xml", "WorkerRole.xml") |
| 38 | +$removeItems = @("*.lastcodeanalysissucceeded", "*.dll.config", "*.pdb") |
| 39 | +if($GenerateDocumentationFile -eq "false"){ |
| 40 | + Write-Verbose "Removing *.xml files from $output" |
| 41 | + $removeItems += "*.xml" |
| 42 | +} |
| 43 | +$webdependencies = @("Microsoft.Web.Hosting.dll", "Microsoft.Web.Delegation.dll", "Microsoft.Web.Administration.dll", "Microsoft.Web.Deployment.Tracing.dll") |
13 | 44 |
|
14 | 45 | foreach ($path in $outputPaths)
|
15 | 46 | {
|
16 | 47 | Write-Verbose "Removing generated NuGet folders from $path"
|
17 |
| - $resourcesFolders = @("de", "es", "fr", "it", "ja", "ko", "ru", "zh-Hans", "zh-Hant", "cs", "pl", "pt-BR", "tr") |
18 | 48 | Get-ChildItem -Include $resourcesFolders -Recurse -Force -Path $path | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
|
19 | 49 |
|
20 | 50 | Write-Verbose "Removing autogenerated XML help files, code analysis, config files, and symbols."
|
21 |
| - $exclude = @("*.dll-Help.xml", "Scaffold.xml", "RoleSettings.xml", "WebRole.xml", "WorkerRole.xml") |
22 |
| - $include = @("*.xml", "*.lastcodeanalysissucceeded", "*.dll.config", "*.pdb") |
23 |
| - Get-ChildItem -Include $include -Exclude $exclude -Recurse -Path $path | Remove-Item -Force -Recurse |
| 51 | + Get-ChildItem -Include $removeItems -Exclude $keepItems -Recurse -Path $path | Remove-Item -Force -Recurse |
24 | 52 | Get-ChildItem -Recurse -Path $path -Include *.dll-Help.psd1 | Remove-Item -Force
|
25 | 53 |
|
26 | 54 | Write-Verbose "Removing markdown help files and folders"
|
27 | 55 | Get-ChildItem -Recurse -Path $path -Include *.md | Remove-Item -Force -Confirm:$false
|
28 | 56 | Get-ChildItem -Directory -Include help -Recurse -Path $path | Remove-Item -Force -Recurse -Confirm:$false -ErrorAction "Ignore"
|
29 | 57 |
|
30 | 58 | Write-Verbose "Removing unneeded web deployment dependencies"
|
31 |
| - $webdependencies = @("Microsoft.Web.Hosting.dll", "Microsoft.Web.Delegation.dll", "Microsoft.Web.Administration.dll", "Microsoft.Web.Deployment.Tracing.dll") |
32 | 59 | Get-ChildItem -Include $webdependencies -Recurse -Path $path | Remove-Item -Force
|
33 | 60 | }
|
34 | 61 |
|
|
0 commit comments