From 108ace12464c6ae861ff270e145fa8437a8cd65b Mon Sep 17 00:00:00 2001 From: Michael Yanni Date: Thu, 5 Dec 2019 22:06:14 -0800 Subject: [PATCH] Made Invoke-AutoRest take in a single $autoRestArguments parameter. --- eng/Generate.ps1 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/eng/Generate.ps1 b/eng/Generate.ps1 index f3b2a0db..1dab9c48 100644 --- a/eng/Generate.ps1 +++ b/eng/Generate.ps1 @@ -17,14 +17,9 @@ function Invoke-Block([scriptblock]$cmd) { } } -function Invoke-AutoRest($debugFlags, $requireFile, $outputFolder, $inputFile, $title, $namespace, $repoRoot) { +function Invoke-AutoRest($autoRestArguments, $repoRoot) { Invoke-Block { - $outputFlag = if($outputFolder) { "--output-folder=$outputFolder" } else { '' } - $inputFlag = if($inputFile) { "--input-file=$inputFile" } else { '' } - $titleFlag = if($title) { "--title=$title" } else { '' } - $namespaceFlag = if($namespace) { "--namespace=$namespace" } else { '' } - $requireFlag = if($requireFile) { "--require=$requireFile" } else { '' } - $command = "npx autorest-beta $debugFlags $requireFlag $outputFlag $inputFlag $titleFlag $namespaceFlag" + $command = "npx autorest-beta $autoRestArguments" $commandText = $command.Replace($repoRoot, "`$(SolutionDir)") Write-Host ">" $commandText @@ -47,7 +42,8 @@ foreach ($testName in $testNames) { $inputFile = Join-Path $testServerSwaggerPath "$testName.json" $namespace = $testName.Replace('-', '_') - Invoke-AutoRest $debugFlags $configurationPath -inputFile $inputFile -title $testName -namespace $namespace -repoRoot $repoRoot + $autoRestArguments = "$debugFlags --require=$configurationPath --input-file=$inputFile --title=$testName --namespace=$namespace" + Invoke-AutoRest $autoRestArguments $repoRoot } # Sample configuration @@ -58,5 +54,6 @@ foreach ($projectName in $projectNames) { $projectDirectory = Join-Path $sampleDirectory $projectName $configurationPath = Join-Path $projectDirectory 'readme.md' - Invoke-AutoRest $debugFlags $configurationPath -repoRoot $repoRoot + $autoRestArguments = "$debugFlags --require=$configurationPath" + Invoke-AutoRest $autoRestArguments $repoRoot } \ No newline at end of file