Skip to content

Commit bcfdf4a

Browse files
authored
Update Track1CodeCheck.ps1 (Azure#18220)
1 parent 0547834 commit bcfdf4a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

eng/scripts/Track1CodeCheck.ps1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ try {
133133
& npm install -g autorest
134134
}
135135

136+
# Running autorest first time to avoid C# version conflict
137+
& autorest https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/common-types/resource-management/v2/types.json --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=../temp
138+
136139
# Invoke AutoRest
137140
Write-Output "Start code-gen"
141+
$commandList = @()
138142
foreach ($metaData in $mataPath) {
139143
$metaDataContent = ''
140144
try {
@@ -164,9 +168,11 @@ try {
164168
LogError "MetaData $metaData content not correct, you may need to re-run sdk\<RP_Name>\generate.ps1"
165169
}
166170
else {
167-
Write-Output "Ready to execute: autorest $readme --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=$path --use:@microsoft.azure/autorest.csharp@2.3.90"
171+
$command = "Ready to execute: autorest $readme --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=$path"
172+
Write-Output $command
173+
$commandList += $command
168174
Invoke-Block {
169-
& autorest $readme --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=$path --use:@microsoft.azure/autorest.csharp@2.3.90
175+
& autorest $readme --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=$path
170176
}
171177
}
172178
}
@@ -194,8 +200,10 @@ try {
194200
Write-Host "============================"
195201
LogError "Discrepancy detected between generated code in PR and reference generation. Please note, the files in the Generated folder should not be modified OR adding/excluding files. You may need to re-run sdk<RP_Name>\generate.ps1."
196202
Write-Host "============================"
197-
Write-Host "For reference, we are using this command for the code check: " -ForegroundColor red -BackgroundColor white
198-
Write-Host " autorest https://github.com/<Repo_Name>/azure-rest-api-specs/blob/<Commit_Id>/specification/<RP_Name>/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=<SDK_Repo_Path>/sdk --use:@microsoft.azure/autorest.csharp@2.3.90" -ForegroundColor red -BackgroundColor white
203+
Write-Host "For reference, we are using following commands for the code check: " -ForegroundColor red -BackgroundColor white
204+
$commandList | ForEach-Object {
205+
Write-Host $_ -ForegroundColor red -BackgroundColor white
206+
}
199207
}
200208
}
201209
finally {

0 commit comments

Comments
 (0)