diff --git a/tools/BuildScripts/BuildModules.ps1 b/tools/BuildScripts/BuildModules.ps1 index 3c2396b0cd09..7420ed6535ca 100644 --- a/tools/BuildScripts/BuildModules.ps1 +++ b/tools/BuildScripts/BuildModules.ps1 @@ -38,7 +38,7 @@ if (($null -eq $RepoRoot) -or (0 -eq $RepoRoot.Length)) { $notModules = @('lib', 'shared', 'helpers') $coreTestModule = @('Compute', 'Network', 'Resources', 'Sql', 'Websites') -$RepoArtifacts = Join-Path $RepoRoot "Artifacts" +$RepoArtifacts = Join-Path $RepoRoot "artifacts" $csprojFiles = @() $testModule = @() @@ -127,6 +127,9 @@ $prepareScriptPath = Join-Path $toolDirectory 'BuildScripts' 'PrepareAutorestMod $isInvokedByPipeline = $false if ($InvokedByPipeline) { $isInvokedByPipeline = $true + $outputTargetPath = Join-Path $RepoArtifacts "TargetModule.txt" + New-Item -Path $outputTargetPath -Force + $TargetModule | Out-File -Path $outputTargetPath -Force } foreach ($moduleRootName in $TargetModule) { Write-Host "Preparing $moduleRootName ..." -ForegroundColor DarkGreen diff --git a/tools/ExpandModules.ps1 b/tools/ExpandModules.ps1 index c94eabfc2a37..d02a9e024f84 100644 --- a/tools/ExpandModules.ps1 +++ b/tools/ExpandModules.ps1 @@ -33,21 +33,21 @@ if ([string]::IsNullOrEmpty($Artifacts)) { New-Item -Path (Get-Item $Artifacts).FullName -Name "tmp" -ItemType "directory" $tmp = Join-Path -Path (Get-Item $Artifacts).FullName -ChildPath "tmp" -$ModifiedModulesPath = Join-Path $Artifacts -ChildPath "ModifiedModule.txt" -$ModifiedModules = @() -if (Test-Path $ModifiedModulesPath) { - $ModifiedModules = Get-Content $ModifiedModulesPath +$TargetModulePath = Join-Path $Artifacts -ChildPath "TargetModule.txt" +$TargetModule = @() +if (Test-Path $TargetModulePath) { + $TargetModule = Get-Content $TargetModulePath } -Write-Host $ModifiedModules +Write-Host $TargetModule try { $AllPackages = Get-ChildItem -Path $Artifacts -Filter "*.nupkg" - if ($ModifiedModules.Length -eq 0) { - Write-Host "ModifiedModule.txt not finded, default expand all modules." - $ModifiedModules = $AllPackages.Name + if ($TargetModule.Length -eq 0) { + Write-Error "No target modules found." + exit 1 } foreach ($package in $AllPackages) { - foreach ($module in $ModifiedModules) { + foreach ($module in $TargetModule) { if (($package.Name -like "Az.$module.*.nupkg") -or ($package.Name -match '^Az(Preview)?\.\d+\.\d+\.\d+\.nupkg$')) { $module_name = $package.Name $zip_artifact = $package.FullName -replace ".nupkg$",".zip"