File tree Expand file tree Collapse file tree 4 files changed +31
-3
lines changed Expand file tree Collapse file tree 4 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -231,7 +231,7 @@ jobs:
231
231
$ModuleMapping.Keys | ForEach-Object {
232
232
$ModuleName = $_
233
233
$ModuleProjectDir = "$(System.DefaultWorkingDirectory)/src/$ModuleName/$ModuleName"
234
- & $(System.DefaultWorkingDirectory)/tools/PackModule.ps1 -Module $ModuleName -ArtifactsLocation $(Build.ArtifactStagingDirectory)\
234
+ & $(System.DefaultWorkingDirectory)/tools/PackModule.ps1 -Module $ModuleName -ArtifactsLocation $(Build.ArtifactStagingDirectory)\ -ExcludeMarkdownDocsFromNugetPackage
235
235
}
236
236
237
237
- task : SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
Original file line number Diff line number Diff line change @@ -229,7 +229,7 @@ jobs:
229
229
$ModuleMapping.Keys | ForEach-Object {
230
230
$ModuleName = $_
231
231
$ModuleProjectDir = "$(System.DefaultWorkingDirectory)/src/$ModuleName/$ModuleName"
232
- & $(System.DefaultWorkingDirectory)/tools/PackModule.ps1 -Module $ModuleName -ArtifactsLocation $(Build.ArtifactStagingDirectory)\
232
+ & $(System.DefaultWorkingDirectory)/tools/PackModule.ps1 -Module $ModuleName -ArtifactsLocation $(Build.ArtifactStagingDirectory)\ -ExcludeMarkdownDocsFromNugetPackage
233
233
}
234
234
235
235
- task : SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
Original file line number Diff line number Diff line change @@ -85,3 +85,19 @@ function Set-Dependencies(
85
85
$MetadataElement [" dependencies" ].AppendChild($NewDependencyElement )
86
86
}
87
87
}
88
+
89
+ <#
90
+ Remove Markdown Docs Element from the Nuspec File.
91
+ This is fixed in autorest code generator
92
+ https://github.com/Azure/autorest.powershell/blob/4e5e47e874747ce9cfbf88981538654dd2bafe4f/powershell/generators/nuspec.ts#L42
93
+ #>
94
+ function Remove-MarkdownDocsElement (
95
+ [parameter (Position = 1 , Mandatory = $true )]
96
+ [ValidateScript ({Test-Path $_ - PathType Leaf})][string ] $NuSpecFilePath ){
97
+
98
+ $XmlDocument = New-Object System.Xml.XmlDocument
99
+ $XmlDocument.Load ($NuSpecFilePath )
100
+ $docsNode = $XmlDocument.DocumentElement.Files.ChildNodes | Where-Object { $_.target -eq ' docs' }
101
+ $XmlDocument.DocumentElement.Files.RemoveChild ($docsNode ) | Out-Null
102
+ $XmlDocument.Save ($NuSpecFilePath )
103
+ }
Original file line number Diff line number Diff line change 2
2
# Licensed under the MIT License.
3
3
Param (
4
4
[Parameter (Mandatory = $true )] [ValidateNotNullOrEmpty ()][string ] $Module ,
5
- [Parameter (Mandatory = $true )] [ValidateNotNullOrEmpty ()][string ] $ArtifactsLocation
5
+ [Parameter (Mandatory = $true )] [ValidateNotNullOrEmpty ()][string ] $ArtifactsLocation ,
6
+ [string ] $ModulePrefix = " Microsoft.Graph" ,
7
+ [switch ] $ExcludeMarkdownDocsFromNugetPackage
6
8
)
9
+ $NuspecHelperPS1 = Join-Path $PSScriptRoot " ./NuspecHelper.ps1"
10
+ # Import scripts
11
+ . $NuspecHelperPS1
12
+
7
13
$LASTEXITCODE = $null
8
14
$ErrorActionPreference = " Stop"
9
15
if ($PSEdition -ne " Core" ) {
10
16
Write-Error " This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell."
11
17
}
12
18
13
19
$ModuleProjLocation = Join-Path $PSScriptRoot " ../src/$Module /$Module "
20
+ $ModuleNuspec = Join-Path $ModuleProjLocation " $ModulePrefix .$Module .nuspec"
14
21
$PackModulePS1 = Join-Path $ModuleProjLocation " /pack-module.ps1"
15
22
16
23
if (Test-Path $PackModulePS1 ) {
24
+ # Remove MarkDown Docs From Nuget Package
25
+ if ($ExcludeMarkdownDocsFromNugetPackage ) {
26
+ Write-Information " Removing MarkDownDocs from Nuget Package..."
27
+ Remove-MarkdownDocsElement - NuSpecFilePath $ModuleNuspec
28
+ }
17
29
# Pack module
18
30
& $PackModulePS1
19
31
if ($LASTEXITCODE ) {
You can’t perform that action at this time.
0 commit comments