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:
231231 $ModuleMapping.Keys | ForEach-Object {
232232 $ModuleName = $_
233233 $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
235235 }
236236
237237 - 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:
229229 $ModuleMapping.Keys | ForEach-Object {
230230 $ModuleName = $_
231231 $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
233233 }
234234
235235 - 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(
8585 $MetadataElement [" dependencies" ].AppendChild($NewDependencyElement )
8686 }
8787}
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 22# Licensed under the MIT License.
33Param (
44 [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
68)
9+ $NuspecHelperPS1 = Join-Path $PSScriptRoot " ./NuspecHelper.ps1"
10+ # Import scripts
11+ . $NuspecHelperPS1
12+
713$LASTEXITCODE = $null
814$ErrorActionPreference = " Stop"
915if ($PSEdition -ne " Core" ) {
1016 Write-Error " This script requires PowerShell Core to execute. [Note] Generated cmdlets will work in both PowerShell Core or Windows PowerShell."
1117}
1218
1319$ModuleProjLocation = Join-Path $PSScriptRoot " ../src/$Module /$Module "
20+ $ModuleNuspec = Join-Path $ModuleProjLocation " $ModulePrefix .$Module .nuspec"
1421$PackModulePS1 = Join-Path $ModuleProjLocation " /pack-module.ps1"
1522
1623if (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+ }
1729 # Pack module
1830 & $PackModulePS1
1931 if ($LASTEXITCODE ) {
You can’t perform that action at this time.
0 commit comments