Skip to content

Commit 89b2982

Browse files
authored
Remove the modules in the skip list of generation branch (#16314)
* Remove the modules in the skip list of generation branch * Add redirection of autorest's output stream * Add redirection of autorest's output stream * Add redirection of autorest's output stream * Add redirection of autorest's output stream Co-authored-by: wyunchi-ms <[email protected]>
1 parent 8b3b9db commit 89b2982

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

tools/PrepareAutorestModule.ps1

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $ChangedFiles = Get-Content -Path "$PSScriptRoot\..\FilesChanged.txt"
2121

2222
$ALL_MODULE = "ALL_MODULE"
2323

24-
$SKIP_MODULES = @("ContainerInstance", "ConnectedMachine")
24+
$SKIP_MODULES = @("ContainerInstance")
2525

2626
#Region Detect which module should be processed
2727
$ModuleSet = New-Object System.Collections.Generic.HashSet[string]
@@ -75,6 +75,8 @@ Copy-Item "$PSScriptRoot\..\src\*.props" $TmpFolder
7575
#EndRegion
7676

7777
#Region generate the code and make the struture same with main branch.
78+
$AutorestOutputDir = "$PSScriptRoot\..\artifacts\autorest"
79+
New-Item -ItemType Directory -Force -Path $AutorestOutputDir
7880
foreach ($Module in $ModuleList)
7981
{
8082
$ModuleFolder = "$PSScriptRoot\..\src\$Module\"
@@ -86,15 +88,11 @@ foreach ($Module in $ModuleList)
8688
continue
8789
}
8890
Set-Location -Path $ModuleFolder
89-
try
90-
{
91-
npx autorest --max-memory-size=8192
92-
}
93-
catch
94-
{
95-
Write-Host "Generating $currentModule with m3"
96-
npx autorest --use:@autorest/powershell@2.1.401 --max-memory-size=8192
97-
}
91+
92+
# Msbuild will regard autorest's output stream who contains "xx error xx:" as an fault by mistake.
93+
# We need to redirect output stream to file to avoid the mistake.
94+
npx autorest --max-memory-size=8192 > "$AutorestOutputDir\$Module.log"
95+
9896
./build-module.ps1
9997
Move-Generation2Master -SourcePath "$PSScriptRoot\..\src\$Module\" -DestPath $TmpFolder
10098
Remove-Item "$ModuleFolder\*" -Recurse -Force

0 commit comments

Comments
 (0)