Skip to content

Commit ef14bdf

Browse files
Allow combining -Azure, -Unbranded, and -Mgmt in RegenPreview.ps1 (#10531)
`RegenPreview.ps1` rejected `-Azure`, `-Unbranded`, and `-Mgmt` as mutually exclusive, even though there's no reason a single run can't build and repackage multiple emitter artifacts. ### Changes - **Drop the mutual-exclusivity guard** between `-Azure`, `-Unbranded`, and `-Mgmt`. `-Spector` and OpenAI-mode exclusivity rules are unchanged. - **Display strings** for the "Mode:" banner and the "Regenerating N libraries (…)" line now render any combination of flags. Single-flag wording is preserved. - **Help comments** (`.DESCRIPTION`, the three `.PARAMETER` blocks, and a new `.EXAMPLE`) updated to document combinable flags. No changes were needed in the build/pack pipeline itself — `Filter-LibrariesByGenerator` already accumulates matches per switch, and the downstream `needsUnbranded` / `needsAzure` / `needsMgmt` analysis derives required builds from the union of selected libraries. So e.g.: ```powershell .\RegenPreview.ps1 -SdkLibraryRepoPath C:\repos\azure-sdk-for-net -Azure -Unbranded ``` now builds and repackages both the unbranded and Azure emitter artifacts (plus their NuGet generator framework packages) in a single run and regenerates libraries from both generators. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
1 parent 7005c50 commit ef14bdf

1 file changed

Lines changed: 30 additions & 30 deletions

File tree

packages/http-client-csharp/eng/scripts/RegenPreview.ps1

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
6. Restores all modified artifacts to original state
3636
3737
Generator Filtering (Azure SDK Mode only):
38-
- Use -Azure to regenerate only Azure-branded libraries (@azure-typespec/http-client-csharp)
39-
- Use -Unbranded to regenerate only unbranded libraries (@typespec/http-client-csharp)
40-
- Use -Mgmt to regenerate only management plane libraries (@azure-typespec/http-client-csharp-mgmt)
38+
- Use -Azure to regenerate Azure-branded libraries (@azure-typespec/http-client-csharp)
39+
- Use -Unbranded to regenerate unbranded libraries (@typespec/http-client-csharp)
40+
- Use -Mgmt to regenerate management plane libraries (@azure-typespec/http-client-csharp-mgmt)
41+
- Filters can be combined (e.g. -Azure -Unbranded) to regenerate libraries from multiple generators
4142
- Omit all filter parameters to regenerate all libraries (default)
4243
- Use -Select for interactive selection (can be combined with generator filters)
4344
@@ -51,18 +52,18 @@
5152
Not applicable in OpenAI mode.
5253
5354
.PARAMETER Azure
54-
Optional. Azure SDK Mode only. When specified, only regenerates libraries using the Azure generator (@azure-typespec/http-client-csharp).
55-
Mutually exclusive with Unbranded and Mgmt parameters.
55+
Optional. Azure SDK Mode only. When specified, regenerates libraries using the Azure generator (@azure-typespec/http-client-csharp).
56+
Can be combined with -Unbranded and/or -Mgmt to regenerate libraries from multiple generators.
5657
Not applicable in OpenAI mode.
5758
5859
.PARAMETER Unbranded
59-
Optional. Azure SDK Mode only. When specified, only regenerates libraries using the unbranded generator (@typespec/http-client-csharp).
60-
Mutually exclusive with Azure and Mgmt parameters.
60+
Optional. Azure SDK Mode only. When specified, regenerates libraries using the unbranded generator (@typespec/http-client-csharp).
61+
Can be combined with -Azure and/or -Mgmt to regenerate libraries from multiple generators.
6162
Not applicable in OpenAI mode.
6263
6364
.PARAMETER Mgmt
64-
Optional. Azure SDK Mode only. When specified, only regenerates libraries using the management plane generator (@azure-typespec/http-client-csharp-mgmt).
65-
Mutually exclusive with Azure and Unbranded parameters.
65+
Optional. Azure SDK Mode only. When specified, regenerates libraries using the management plane generator (@azure-typespec/http-client-csharp-mgmt).
66+
Can be combined with -Azure and/or -Unbranded to regenerate libraries from multiple generators.
6667
If no generator filter is specified, all libraries are regenerated.
6768
Not applicable in OpenAI mode.
6869
@@ -101,6 +102,10 @@
101102
# Regenerate only management plane libraries
102103
.\RegenPreview.ps1 -SdkLibraryRepoPath "C:\repos\azure-sdk-for-net" -Mgmt
103104
105+
.EXAMPLE
106+
# Regenerate both Azure-branded and unbranded libraries
107+
.\RegenPreview.ps1 -SdkLibraryRepoPath "C:\repos\azure-sdk-for-net" -Azure -Unbranded
108+
104109
.EXAMPLE
105110
# Regenerate Azure spector test scenarios using local changes
106111
.\RegenPreview.ps1 -SdkLibraryRepoPath "C:\repos\azure-sdk-for-net" -Spector
@@ -145,15 +150,6 @@ if ($isOpenAIMode) {
145150
Write-Error "The -Spector parameter is mutually exclusive with -Select, -Azure, -Unbranded, and -Mgmt."
146151
exit 1
147152
}
148-
149-
# In Azure SDK mode, validate filter parameters
150-
$generatorFilters = @($Azure, $Unbranded, $Mgmt)
151-
$activeFilters = @($generatorFilters | Where-Object { $_ }).Count
152-
153-
if ($activeFilters -gt 1) {
154-
Write-Error "Parameters -Azure, -Unbranded, and -Mgmt are mutually exclusive. Please specify only one."
155-
exit 1
156-
}
157153
}
158154

159155
# Import utility functions
@@ -175,14 +171,18 @@ if ($isOpenAIMode) {
175171
# Display active mode
176172
$modeText = if ($Spector) {
177173
"Regenerate Azure spector test scenarios"
174+
} elseif ($Azure -or $Unbranded -or $Mgmt) {
175+
$generatorNames = @()
176+
if ($Azure) { $generatorNames += "Azure" }
177+
if ($Unbranded) { $generatorNames += "Unbranded" }
178+
if ($Mgmt) { $generatorNames += "Management plane" }
179+
if ($Select) {
180+
"Regenerate $($generatorNames -join ', ') libraries (interactive selection)"
181+
} else {
182+
"Regenerate $($generatorNames -join ', ') libraries"
183+
}
178184
} elseif ($Select) {
179185
"Interactive library selection"
180-
} elseif ($Azure) {
181-
"Regenerate Azure SDK libraries only"
182-
} elseif ($Unbranded) {
183-
"Regenerate Unbranded libraries only"
184-
} elseif ($Mgmt) {
185-
"Regenerate Management plane libraries only"
186186
} else {
187187
"Regenerate ALL libraries"
188188
}
@@ -926,12 +926,12 @@ try {
926926
Write-Host "No libraries found matching the specified generator filter" -ForegroundColor Yellow
927927
Write-Host "Skipping regeneration step..." -ForegroundColor Gray
928928
} else {
929-
$filterText = if ($Azure) {
930-
" (Azure generator only)"
931-
} elseif ($Unbranded) {
932-
" (Unbranded generator only)"
933-
} elseif ($Mgmt) {
934-
" (Management plane generator only)"
929+
$filterParts = @()
930+
if ($Azure) { $filterParts += "Azure" }
931+
if ($Unbranded) { $filterParts += "Unbranded" }
932+
if ($Mgmt) { $filterParts += "Management plane" }
933+
$filterText = if ($filterParts.Count -gt 0) {
934+
" ($($filterParts -join ', ') generator$(if ($filterParts.Count -gt 1) { 's' } else { '' }) only)"
935935
} else {
936936
""
937937
}

0 commit comments

Comments
 (0)