Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .azure-pipelines/code-sign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ jobs:
custom: msbuild
arguments: 'build.proj /t:"Build;CopyAboutTopics;GenerateHelp" /p:"Configuration=Release;GenerateDocumentationFile=true;ModifiedModuleBuild=true"'


- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'Manifest Generator '
inputs:
Expand Down Expand Up @@ -363,6 +362,11 @@ jobs:
displayName: 'Repackage modules'
condition: and(succeeded(), ne(variables['SignPsd1'], 'false'))

- pwsh: |
./tools/Docs/OutputTypeIndex.ps1 -OutputFile ./artifacts/outputtypes.json -BuildConfig Release
./tools/Docs/HelpIndex.ps1 -OutputFile ./artifacts/index.json -BuildConfig Release
displayName: 'Post process for Docs'

- task: PublishBuildArtifacts@1
displayName: 'Save artifacts'
inputs:
Expand Down
3 changes: 0 additions & 3 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,6 @@

<Target Name="Publish" Condition="'$(Configuration)' == 'Release'">
<Message Importance="high" Text="Publishing Cmdlets using $(Scope) scope" />
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(RepoTools)/NewOutputTypeIndex.ps1 -OutputFile $(RepoArtifacts)/outputtypes.json -BuildConfig $(Configuration)&quot;"/>
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(RepoTools)/NewHelpIndex.ps1 -OutputFile $(RepoArtifacts)/index.json -BuildConfig $(Configuration)&quot;"/>

<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(RepoTools)/CleanupBuild.ps1 -BuildConfig $(Configuration) -GenerateDocumentationFile $(GenerateDocumentationFile) &quot;" />

<Error Condition="'$(NuGetKey)' == ''" Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
Expand Down
27 changes: 16 additions & 11 deletions tools/NewHelpIndex.ps1 → tools/Docs/HelpIndex.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ param(
[Parameter(Mandatory = $false)]
[string] $BuildConfig = "Debug",
[Parameter(Mandatory = $false)]
[string] $OutputFile = "$PSScriptRoot/index.json"
[string] $OutputFile = "$PSScriptRoot/../index.json"
)

Import-LocalizedData -BindingVariable "Azpsd1" -BaseDirectory $PSScriptRoot/Az -FileName "Az.psd1"
$ToolsRootPath = "$PSScriptRoot/.."

Import-LocalizedData -BindingVariable "Azpsd1" -BaseDirectory $ToolsRootPath/Az -FileName "Az.psd1"

if ([string]::isNullOrEmpty($Version))
{
Expand Down Expand Up @@ -60,21 +62,24 @@ $output.Add("version", "$Version")
$outputModules = @{}

#Create mappings file
& "$PSScriptRoot/CreateMappings.ps1" -OutputFile $OutputFile/../groupMapping.json -WarningFile $OutputFile/../groupMappingWarnings.json
& "ToolsRootPath/CreateMappings.ps1" -OutputFile $OutputFile/../groupMapping.json -WarningFile $OutputFile/../groupMappingWarnings.json
$labelMapping = Get-Content -Raw $OutputFile/../groupMapping.json | ConvertFrom-Json

$RMpsd1s = @()
$HelpFolders = @()

$resourceManagerPath = "$PSScriptRoot/../artifacts/$BuildConfig/"

$RMpsd1s += Get-ChildItem -Path $resourceManagerPath -Depth 1 | Where-Object {
$_.Name -like "*.psd1" -and $_.FullName -notlike "*dll-Help*"
$ProjectPaths = @( "ToolsRootPath/../src")
$RMpsd1s = $ProjectPaths | ForEach-Object {
Get-ChildItem -Path $_ -Filter "*.psd1" -Recurse | Where-Object {
$_.FullName -inotlike "*autorest*" -and `
$_.FullName -inotlike "*extension*" -and `
$_.FullName -notlike "*Debug*" -and `
$_.FullName -notlike "*Netcore*" -and `
$_.FullName -notlike "*dll-Help.psd1*" -and (-not [Tools.Common.Utilities.ModuleFilter]::IsAzureStackModule($_.FullName))
}
}

.($PSScriptRoot + "\PreloadToolDll.ps1")
$HelpFolders += Get-ChildItem -Path "$PSScriptRoot/../src" -Recurse -Directory | where { $_.Name -eq "help" -and (-not [Tools.Common.Utilities.ModuleFilter]::IsAzureStackModule($_.FullName)) -and $_.FullName -notlike "*\bin\*" -and (-not $_.Parent.BaseName.EndsWith(".Autorest", "CurrentCultureIgnoreCase"))}

.($ToolsRootPath + "\PreloadToolDll.ps1")
$HelpFolders += Get-ChildItem -Path "$ToolsRootPath/../src" -Recurse -Directory | where { $_.Name -eq "help" -and (-not [Tools.Common.Utilities.ModuleFilter]::IsAzureStackModule($_.FullName)) -and $_.FullName -notlike "*\bin\*" -and (-not $_.Parent.BaseName.EndsWith(".Autorest", "CurrentCultureIgnoreCase"))}

# Map the name of the cmdlet to the location of the help file
$HelpFileMapping = @{}
Expand Down
88 changes: 88 additions & 0 deletions tools/Docs/OutputTypeIndex.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

param(
[Parameter(Mandatory = $false)]
[string] $BuildConfig = "Release",
[Parameter(Mandatory = $false)]
[string] $OutputFile = "outputtypes.json"
)

$ToolsRootPath = "$PSScriptRoot/.."
$AzPreviewPath = Get-Item $ToolsRootPath\AzPreview\AzPreview.psd1
Import-LocalizedData -BindingVariable ModuleMetadata -BaseDirectory $AzPreviewPath.DirectoryName -FileName $AzPreviewPath.Name
$ModulePath = ($env:PSModulePath -split ';')[0]
$outputTypes = New-Object System.Collections.Generic.HashSet[string]
$jsonData = @()
$ProjectPaths = @( "$ToolsRootPath/../src" )

$ModuleManifestFile = $ProjectPaths | ForEach-Object {
Get-ChildItem -Path $_ -Filter "*.psd1" -Recurse | Where-Object {
$_.FullName -notlike "*autorest*"
}
}

foreach ($item in $jsonData) {
$outputTypes.Add($item) | Out-Null
}

$ReleaseRepository = "ReleaseRP"
Register-PSRepository -Name $ReleaseRepository -SourceLocation "$ToolsRootPath/../artifacts" -PackageManagementProvider Nuget -InstallationPolicy Trusted
Install-Module -Scope CurrentUser -Name AzPreview -Repository $ReleaseRepository -Force -AllowClobber

$ModuleMetadata.RequiredModules | ForEach-Object {
$ModuleName = $_.ModuleName
$Version = $_.RequiredVersion
if ($Version -eq $null)
{
$Version = $_.ModuleVersion
}
$srcFile = $ModuleManifestFile | Where-Object {$_.Name -eq "$ModuleName.psd1"}
Import-LocalizedData -BindingVariable srcMetadata -BaseDirectory $srcFile.DirectoryName -FileName $srcFile.Name
$containsPsd1 = $srcMetadata.NestedModules | Where-Object { $_ -like "*.dll" }
$DestinationModulePath = [System.IO.Path]::Combine($ModulePath, $ModuleName, $Version)
$psd1Path = Join-Path -Path $DestinationModulePath -ChildPath "$ModuleName.psd1"
if (($containsPsd1.count -gt 0) -and (Test-Path $psd1Path)){
Import-Module $Psd1Path -Force
$Module = Get-Module $ModuleName
foreach ($ModuleInfo in $Module.NestedModules){
if ($srcMetadata.NestedModules -contains $ModuleInfo.Name+".dll") {
foreach ($Cmdlet in $ModuleInfo.ExportedCmdlets.Values) {
$OutputAttributeList = $Cmdlet.ImplementingType.GetTypeInfo().GetCustomAttributes([System.Management.Automation.OutputTypeAttribute], $true)
foreach ($OutputAttribute in $OutputAttributeList)
{
foreach ($OutputType in $OutputAttribute.Type)
{
$outputTypes.Add($OutputType.Name) | Out-Null
}
}
foreach ($Parameter in $Cmdlet.Parameters.Values){
if ($Parameter.Attributes.TypeId.FullName -contains "System.Management.Automation.ParameterAttribute") {
if ($Parameter.ParameterType.FullName -like "*System.Nullable*``[``[*")
{
$outputTypes.Add(($Parameter.ParameterType.BaseType.FullName -replace "[][]", "")) | Out-Null
}
elseif ($Parameter.ParameterType.FullName -notlike "*``[``[*")
{
$outputTypes.Add(($Parameter.ParameterType.FullName -replace "[][]", "")) | Out-Null
}
}
}
}
}
}
}
}
$json = ConvertTo-Json $outputTypes
$json | Out-File "$OutputFile"
62 changes: 0 additions & 62 deletions tools/NewOutputTypeIndex.ps1

This file was deleted.