Skip to content

Commit 7c135d8

Browse files
authored
Add support for the case that psd1 and help are in the {module}.Manaement folder (#20652)
* Add support for the case that psd1 and help are in the {module}.Management folder For normal cases, psd1 and help are in the {module} folder. But for storage, they are in Storeage.Management folder. And this PR is created to support case like storage. * Replace ternary operator with if-clause
1 parent 4145dd4 commit 7c135d8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tools/Gen2Master/MoveFromGeneration2Master.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,12 @@ Function Move-Generation2MasterHybrid {
299299
dotnet sln $SolutionPath add (Join-Path -Path (Join-Path -Path $DestPath -ChildPath $submoduleDir.Name) -ChildPath Az.$submoduleName.csproj)
300300

301301
# Update psd1
302-
$DestPsd1Path = Join-Path -Path (Join-Path -Path $DestPath -ChildPath $ModuleName) -ChildPath "Az.$ModuleName.psd1"
303-
$Psd1Metadata = Import-LocalizedData -BaseDirectory (Join-Path -Path $DestPath -ChildPath $ModuleName) -FileName "Az.$ModuleName.psd1"
302+
$Psd1FolderPostfix = '';
303+
if (-not (Test-Path (Join-Path -Path (Join-Path -Path $DestPath -ChildPath $ModuleName) -ChildPath "Az.$ModuleName.psd1"))) {
304+
$Psd1FolderPostfix = '.Management'
305+
}
306+
$DestPsd1Path = Join-Path -Path (Join-Path -Path $DestPath -ChildPath $ModuleName$Psd1FolderPostfix) -ChildPath "Az.$ModuleName.psd1"
307+
$Psd1Metadata = Import-LocalizedData -BaseDirectory (Join-Path -Path $DestPath -ChildPath $ModuleName$Psd1FolderPostfix) -FileName "Az.$ModuleName.psd1"
304308
$SubModulePsd1MetaData = Import-LocalizedData -BaseDirectory (Join-Path -Path $SourcePath -ChildPath $submoduleDir.Name) -FileName "Az.$submoduleName.psd1"
305309
if (!@($Psd1Metadata.RequiredAssemblies).Contains(("{0}\bin\Az.${submoduleName}.private.dll" -f $submoduleDir.Name))) {
306310
$Psd1Metadata.RequiredAssemblies = @($Psd1Metadata.RequiredAssemblies) + ("{0}\bin\Az.${submoduleName}.private.dll" -f $submoduleDir.Name)
@@ -339,11 +343,12 @@ Function Move-Generation2MasterHybrid {
339343
$job = start-job {
340344
param(
341345
[string] $ModuleName,
342-
[string] $DestPath
346+
[string] $DestPath,
347+
[string] $Psd1FolderPostfix
343348
)
344349
Import-Module "$DestPath\..\..\artifacts\Debug\Az.$ModuleName\Az.$ModuleName.psd1"
345-
Update-MarkdownHelpModule -Path "$DestPath\$ModuleName\help" -RefreshModulePage -AlphabeticParamsOrder -UseFullTypeName -ExcludeDontShow
346-
} -ArgumentList $ModuleName, $DestPath
350+
Update-MarkdownHelpModule -Path "$DestPath\$ModuleName$Psd1FolderPostfix\help" -RefreshModulePage -AlphabeticParamsOrder -UseFullTypeName -ExcludeDontShow
351+
} -ArgumentList $ModuleName, $DestPath, $Psd1FolderPostfix
347352

348353
$job | Wait-Job | Receive-Job
349354
# Import-Module "$DestPath\..\..\artifacts\Debug\Az.$ModuleName\Az.$ModuleName.psd1"

0 commit comments

Comments
 (0)