Skip to content

Commit

Permalink
Only install TypeSpec if code will be generated
Browse files Browse the repository at this point in the history
  • Loading branch information
alzimmermsft committed Nov 11, 2024
1 parent deabcd8 commit c0f1372
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
15 changes: 14 additions & 1 deletion eng/scripts/Compare-CurrentToCodegeneration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ if ($Directory) {
$path = $Directory
}

$swaggers = Get-ChildItem -Path $path -Filter "Update-Codegeneration.ps1" -Recurse
if ($swaggers.Count -eq 0) {
Write-Host "
===========================================
No Swagger files to regenerate
===========================================
"
exit 0
}


Write-Host "
===================================
Expand All @@ -33,7 +46,7 @@ Invoking Autorest code regeneration
"

foreach ($script in (Get-ChildItem -Path $path -Filter "Update-Codegeneration.ps1" -Recurse)) {
foreach ($script in $swaggers) {
Invoke-Expression $script.FullName
}

Expand Down
14 changes: 13 additions & 1 deletion eng/scripts/TypeSpec-Compare-CurrentToCodegeneration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ function Reset-Repository {
git clean -fd .
}

$tpsYamls = Get-ChildItem -Path $Directory -Filter "tsp-location.yaml" -Recurse
if ($tspYamls.Count -eq 0) {
Write-Host "
===========================================
No TypeSpec files to regenerate
===========================================
"
exit 0
}

Write-Host "
===========================================
Expand All @@ -43,7 +55,7 @@ Invoking tsp-client update
"

$failedSdk = $null
foreach ($tspLocationPath in (Get-ChildItem -Path $Directory -Filter "tsp-location.yaml" -Recurse)) {
foreach ($tspLocationPath in $tpsYamls) {
$sdkPath = (get-item $tspLocationPath).Directory.FullName
Write-Host "Generate SDK for $sdkPath"
Push-Location
Expand Down

0 comments on commit c0f1372

Please sign in to comment.