From 838f9aa5459529708e1232101c3809e300654710 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 23 Jul 2021 12:24:36 -0500 Subject: [PATCH 01/13] [build.ps1] Add config filename option - Fixes https://github.com/Azure/azure-sdk-for-go/issues/15128 --- eng/scripts/build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index 1284974235f6..bb11d134f10b 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -1,5 +1,5 @@ #Requires -Version 7.0 -param($filter, [switch]$clean, [switch]$vet, [switch]$generate, [switch]$skipBuild) +param($filter, [switch]$clean, [switch]$vet, [switch]$generate, [switch]$skipBuild, $config = "autorest.md") . $PSScriptRoot/meta_generation.ps1 @@ -36,7 +36,7 @@ $keys | ForEach-Object { $sdks[$_] } | ForEach-Object { if ($_.generate) { Write-Host "##[command]Executing autorest.go in " $_.path - $autorestPath = $_.path + "/autorest.md" + $autorestPath = $_.path + "/" + $config if (ShouldGenerate-AutorestConfig $autorestPath) { Generate-AutorestConfig $autorestPath From 73ae0e48d6478585e63a463fe93ba488ace51b5a Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 23 Jul 2021 12:32:59 -0500 Subject: [PATCH 02/13] [build.ps1] Add outputFolder option - Fixes https://github.com/Azure/azure-sdk-for-go/issues/15127 --- eng/scripts/build.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index bb11d134f10b..c210ec2380fd 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -1,5 +1,5 @@ #Requires -Version 7.0 -param($filter, [switch]$clean, [switch]$vet, [switch]$generate, [switch]$skipBuild, $config = "autorest.md") +param([string]$filter, [switch]$clean, [switch]$vet, [switch]$generate, [switch]$skipBuild, [string]$config = "autorest.md", [string]$outputFolder) . $PSScriptRoot/meta_generation.ps1 @@ -44,7 +44,9 @@ $keys | ForEach-Object { $sdks[$_] } | ForEach-Object { } $autorestVersion = "@autorest/go@4.0.0-preview.23" - $outputFolder = $_.path + if ($outputFolder -eq '') { + $outputFolder = $_.path + } $root = $_.root autorest --use=$autorestVersion --go --track2 --go-sdk-folder=$root --output-folder=$outputFolder --file-prefix="zz_generated_" --clear-output-folder=false $autorestPath if ($removeAutorestFile) { From 601e4e2380b509ca5dadc1c6b4f08a5b0ca3a192 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 23 Jul 2021 13:01:43 -0500 Subject: [PATCH 03/13] [build.ps1] Remove unncessary indirection - Part of https://github.com/Azure/azure-sdk-for-go/issues/15102 --- eng/scripts/build.ps1 | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index c210ec2380fd..9fd1cfd8c224 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -11,12 +11,7 @@ $sdks = @{}; foreach ($sdk in (./eng/scripts/get_module_dirs.ps1 -serviceDir 'sdk/...')) { $name = $sdk | split-path -leaf $sdks[$name] = @{ - 'path' = $sdk; - 'clean' = $clean; - 'vet' = $vet; - 'generate' = $generate; - 'skipBuild' = $skipBuild; - 'root' = $root; + 'path' = $sdk; } } @@ -29,12 +24,12 @@ if (![string]::IsNullOrWhiteSpace($filter)) { $keys | ForEach-Object { $sdks[$_] } | ForEach-Object { Push-Location $_.path - if ($_.clean) { + if ($clean) { Write-Host "##[command]Executing go clean -v ./... in " $_.path go clean -v ./... } - if ($_.generate) { + if ($generate) { Write-Host "##[command]Executing autorest.go in " $_.path $autorestPath = $_.path + "/" + $config @@ -47,19 +42,18 @@ $keys | ForEach-Object { $sdks[$_] } | ForEach-Object { if ($outputFolder -eq '') { $outputFolder = $_.path } - $root = $_.root autorest --use=$autorestVersion --go --track2 --go-sdk-folder=$root --output-folder=$outputFolder --file-prefix="zz_generated_" --clear-output-folder=false $autorestPath if ($removeAutorestFile) { Remove-Item $autorestPath } } - if (!$_.skipBuild) { + if (!$skipBuild) { Write-Host "##[command]Executing go build -v ./... in " $_.path go build -x -v ./... Write-Host "##[command]Build Complete!" } - if ($_.vet) { + if ($vet) { Write-Host "##[command]Executing go vet ./... in " $_.path go vet ./... } From 4f081bc341ac96d5cc158a5a8465c6a0b8b12b3b Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 23 Jul 2021 13:06:24 -0500 Subject: [PATCH 04/13] Fix inconsistent spacing --- eng/scripts/build.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index 9fd1cfd8c224..68649d1eba15 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -2,6 +2,7 @@ param([string]$filter, [switch]$clean, [switch]$vet, [switch]$generate, [switch]$skipBuild, [string]$config = "autorest.md", [string]$outputFolder) . $PSScriptRoot/meta_generation.ps1 +. $PSScriptRoot/get_module_dirs.ps1 $startingDirectory = Get-Location $root = Resolve-Path ($PSScriptRoot + "/../..") @@ -47,16 +48,19 @@ $keys | ForEach-Object { $sdks[$_] } | ForEach-Object { Remove-Item $autorestPath } } + if (!$skipBuild) { Write-Host "##[command]Executing go build -v ./... in " $_.path go build -x -v ./... Write-Host "##[command]Build Complete!" } + if ($vet) { Write-Host "##[command]Executing go vet ./... in " $_.path go vet ./... } + Pop-Location } From fcf7db43b82095301dc94f1a3c796b9beb142665 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 23 Jul 2021 13:16:30 -0500 Subject: [PATCH 05/13] [build.ps1] Use finally to always return to current directory --- eng/scripts/build.ps1 | 69 ++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index 68649d1eba15..dc720b3e2095 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -22,46 +22,49 @@ if (![string]::IsNullOrWhiteSpace($filter)) { $keys = $keys.Where( { $_ -match $filter }) } -$keys | ForEach-Object { $sdks[$_] } | ForEach-Object { - Push-Location $_.path +try { + $keys | ForEach-Object { $sdks[$_] } | ForEach-Object { + Push-Location $_.path - if ($clean) { - Write-Host "##[command]Executing go clean -v ./... in " $_.path - go clean -v ./... - } + if ($clean) { + Write-Host "##[command]Executing go clean -v ./... in " $_.path + go clean -v ./... + } - if ($generate) { - Write-Host "##[command]Executing autorest.go in " $_.path - $autorestPath = $_.path + "/" + $config + if ($generate) { + Write-Host "##[command]Executing autorest.go in " $_.path + $autorestPath = $_.path + "/" + $config - if (ShouldGenerate-AutorestConfig $autorestPath) { - Generate-AutorestConfig $autorestPath - $removeAutorestFile = $true - } + if (ShouldGenerate-AutorestConfig $autorestPath) { + Generate-AutorestConfig $autorestPath + $removeAutorestFile = $true + } - $autorestVersion = "@autorest/go@4.0.0-preview.23" - if ($outputFolder -eq '') { - $outputFolder = $_.path + $autorestVersion = "@autorest/go@4.0.0-preview.23" + if ($outputFolder -eq '') { + $outputFolder = $_.path + } + autorest --use=$autorestVersion --go --track2 --go-sdk-folder=$root --output-folder=$outputFolder --file-prefix="zz_generated_" --clear-output-folder=false $autorestPath + if ($removeAutorestFile) { + Remove-Item $autorestPath + } } - autorest --use=$autorestVersion --go --track2 --go-sdk-folder=$root --output-folder=$outputFolder --file-prefix="zz_generated_" --clear-output-folder=false $autorestPath - if ($removeAutorestFile) { - Remove-Item $autorestPath - } - } - if (!$skipBuild) { - Write-Host "##[command]Executing go build -v ./... in " $_.path - go build -x -v ./... - Write-Host "##[command]Build Complete!" + if (!$skipBuild) { + Write-Host "##[command]Executing go build -v ./... in " $_.path + go build -x -v ./... + Write-Host "##[command]Build Complete!" - } + } - if ($vet) { - Write-Host "##[command]Executing go vet ./... in " $_.path - go vet ./... - } + if ($vet) { + Write-Host "##[command]Executing go vet ./... in " $_.path + go vet ./... + } - Pop-Location + Pop-Location + } } - -Set-Location $startingDirectory +finally { + Set-Location $startingDirectory +} \ No newline at end of file From 98870a0692dd172f0ebab2f8586a06f0cb76bf53 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 23 Jul 2021 13:21:45 -0500 Subject: [PATCH 06/13] [build.ps1] Refactor structure --- eng/scripts/build.ps1 | 77 ++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index dc720b3e2095..cd172cb2a062 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -4,6 +4,45 @@ param([string]$filter, [switch]$clean, [switch]$vet, [switch]$generate, [switch] . $PSScriptRoot/meta_generation.ps1 . $PSScriptRoot/get_module_dirs.ps1 +function Process-Sdk ($path) { + if ($clean) { + Write-Host "##[command]Executing go clean -v ./... in " $path + go clean -v ./... + } + + if ($generate) { + Write-Host "##[command]Executing autorest.go in " $path + $autorestPath = $path + "/" + $config + + if (ShouldGenerate-AutorestConfig $autorestPath) { + Generate-AutorestConfig $autorestPath + $removeAutorestFile = $true + } + + $autorestVersion = "@autorest/go@4.0.0-preview.23" + if ($outputFolder -eq '') { + $outputFolder = $path + } + autorest --use=$autorestVersion --go --track2 --go-sdk-folder=$root --output-folder=$outputFolder --file-prefix="zz_generated_" --clear-output-folder=false $autorestPath + if ($removeAutorestFile) { + Remove-Item $autorestPath + } + } + + if (!$skipBuild) { + Write-Host "##[command]Executing go build -v ./... in " $path + go build -x -v ./... + Write-Host "##[command]Build Complete!" + + } + + if ($vet) { + Write-Host "##[command]Executing go vet ./... in " $path + go vet ./... + } + +} + $startingDirectory = Get-Location $root = Resolve-Path ($PSScriptRoot + "/../..") Set-Location $root @@ -25,43 +64,7 @@ if (![string]::IsNullOrWhiteSpace($filter)) { try { $keys | ForEach-Object { $sdks[$_] } | ForEach-Object { Push-Location $_.path - - if ($clean) { - Write-Host "##[command]Executing go clean -v ./... in " $_.path - go clean -v ./... - } - - if ($generate) { - Write-Host "##[command]Executing autorest.go in " $_.path - $autorestPath = $_.path + "/" + $config - - if (ShouldGenerate-AutorestConfig $autorestPath) { - Generate-AutorestConfig $autorestPath - $removeAutorestFile = $true - } - - $autorestVersion = "@autorest/go@4.0.0-preview.23" - if ($outputFolder -eq '') { - $outputFolder = $_.path - } - autorest --use=$autorestVersion --go --track2 --go-sdk-folder=$root --output-folder=$outputFolder --file-prefix="zz_generated_" --clear-output-folder=false $autorestPath - if ($removeAutorestFile) { - Remove-Item $autorestPath - } - } - - if (!$skipBuild) { - Write-Host "##[command]Executing go build -v ./... in " $_.path - go build -x -v ./... - Write-Host "##[command]Build Complete!" - - } - - if ($vet) { - Write-Host "##[command]Executing go vet ./... in " $_.path - go vet ./... - } - + Process-Sdk $_.path Pop-Location } } From e607697b142f854cfe1e7585d85ee6c15d33a717 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 23 Jul 2021 13:22:19 -0500 Subject: [PATCH 07/13] Fix unrelated change --- eng/scripts/build.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index cd172cb2a062..49d304b0a277 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -2,7 +2,6 @@ param([string]$filter, [switch]$clean, [switch]$vet, [switch]$generate, [switch]$skipBuild, [string]$config = "autorest.md", [string]$outputFolder) . $PSScriptRoot/meta_generation.ps1 -. $PSScriptRoot/get_module_dirs.ps1 function Process-Sdk ($path) { if ($clean) { From adebe93da2f2815341d7211aebeac67d6d6828d8 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Fri, 23 Jul 2021 15:22:39 -0500 Subject: [PATCH 08/13] Make get_module_dirs have a top level function and invoke it from build.ps1 --- eng/scripts/build.ps1 | 4 +++- eng/scripts/get_module_dirs.ps1 | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index 49d304b0a277..fdc16f498ec6 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -2,6 +2,8 @@ param([string]$filter, [switch]$clean, [switch]$vet, [switch]$generate, [switch]$skipBuild, [string]$config = "autorest.md", [string]$outputFolder) . $PSScriptRoot/meta_generation.ps1 +. $PSScriptRoot/get_module_dirs.ps1 + function Process-Sdk ($path) { if ($clean) { @@ -47,7 +49,7 @@ $root = Resolve-Path ($PSScriptRoot + "/../..") Set-Location $root $sdks = @{}; -foreach ($sdk in (./eng/scripts/get_module_dirs.ps1 -serviceDir 'sdk/...')) { +foreach ($sdk in (Get-ModuleDirs 'sdk/...')) { $name = $sdk | split-path -leaf $sdks[$name] = @{ 'path' = $sdk; diff --git a/eng/scripts/get_module_dirs.ps1 b/eng/scripts/get_module_dirs.ps1 index 5404ea45a7a7..2acd65df46bc 100644 --- a/eng/scripts/get_module_dirs.ps1 +++ b/eng/scripts/get_module_dirs.ps1 @@ -2,14 +2,20 @@ Param( [string] $serviceDir ) -$modDirs = [Collections.Generic.List[String]]@() +function Get-ModuleDirs ([string] $serviceDir) { + $modDirs = [Collections.Generic.List[String]]@() -# find each module directory under $serviceDir -Get-Childitem -recurse -path $serviceDir -filter go.mod | foreach-object { - $cdir = $_.Directory - Write-Host "Adding $cdir to list of module paths" - $modDirs.Add($cdir) + # find each module directory under $serviceDir + Get-Childitem -recurse -path $serviceDir -filter go.mod | foreach-object { + $cdir = $_.Directory + Write-Host "Adding $cdir to list of module paths" + $modDirs.Add($cdir) + } + + # return the list of module directories + return $modDirs } -# return the list of module directories -return $modDirs +if ($MyInvocation.InvocationName -ne ".") { + Get-ModuleDirs $serviceDir +} \ No newline at end of file From 7bfe8babc694923e7f211d7f491ec147fc340636 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Mon, 26 Jul 2021 10:39:53 -0500 Subject: [PATCH 09/13] Update eng/scripts/build.ps1 Co-authored-by: Rick Winter --- eng/scripts/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index fdc16f498ec6..ff481bb7414e 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -71,4 +71,4 @@ try { } finally { Set-Location $startingDirectory -} \ No newline at end of file +} From 1238b3e3e45630f12bdd3928c6a888a37cd48192 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Mon, 26 Jul 2021 10:40:01 -0500 Subject: [PATCH 10/13] Update eng/scripts/get_module_dirs.ps1 Co-authored-by: Rick Winter --- eng/scripts/get_module_dirs.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/get_module_dirs.ps1 b/eng/scripts/get_module_dirs.ps1 index 2acd65df46bc..be3f43ef5813 100644 --- a/eng/scripts/get_module_dirs.ps1 +++ b/eng/scripts/get_module_dirs.ps1 @@ -18,4 +18,4 @@ function Get-ModuleDirs ([string] $serviceDir) { if ($MyInvocation.InvocationName -ne ".") { Get-ModuleDirs $serviceDir -} \ No newline at end of file +} From 428d589ed1a616a5d8e4a1915faf3f8ac507bfa1 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Mon, 26 Jul 2021 12:44:50 -0500 Subject: [PATCH 11/13] Update eng/scripts/build.ps1 Co-authored-by: Sean Kane <68240067+seankane-msft@users.noreply.github.com> --- eng/scripts/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index ff481bb7414e..7e281ccf28d5 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -31,7 +31,7 @@ function Process-Sdk ($path) { } if (!$skipBuild) { - Write-Host "##[command]Executing go build -v ./... in " $path + Write-Host "##[command]Executing go build -x -v ./... in " $path go build -x -v ./... Write-Host "##[command]Build Complete!" From 3c8dbd749706546914a9036de685f1ddb72c7da1 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Mon, 26 Jul 2021 13:56:27 -0500 Subject: [PATCH 12/13] Update eng/scripts/get_module_dirs.ps1 Co-authored-by: Ben Broderick Phillips --- eng/scripts/get_module_dirs.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/scripts/get_module_dirs.ps1 b/eng/scripts/get_module_dirs.ps1 index be3f43ef5813..70068b99ea15 100644 --- a/eng/scripts/get_module_dirs.ps1 +++ b/eng/scripts/get_module_dirs.ps1 @@ -6,7 +6,7 @@ function Get-ModuleDirs ([string] $serviceDir) { $modDirs = [Collections.Generic.List[String]]@() # find each module directory under $serviceDir - Get-Childitem -recurse -path $serviceDir -filter go.mod | foreach-object { + Get-ChildItem -recurse -path $serviceDir -filter go.mod | ForEach-Object { $cdir = $_.Directory Write-Host "Adding $cdir to list of module paths" $modDirs.Add($cdir) From ef524e0ace4b178322e378c030af3ccefa278ed0 Mon Sep 17 00:00:00 2001 From: Chris Hamons Date: Mon, 26 Jul 2021 14:46:18 -0500 Subject: [PATCH 13/13] Convert all existing powershell code to 4 space standard --- eng/scripts/create_go_workspace.ps1 | 10 +++++----- eng/scripts/get_module_dirs.ps1 | 22 +++++++++++----------- eng/scripts/get_test_dirs.ps1 | 16 ++++++++-------- eng/scripts/scoped_discover.ps1 | 8 ++++---- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/eng/scripts/create_go_workspace.ps1 b/eng/scripts/create_go_workspace.ps1 index fae45b1b76f4..8cd8f4a9b0dc 100644 --- a/eng/scripts/create_go_workspace.ps1 +++ b/eng/scripts/create_go_workspace.ps1 @@ -4,9 +4,9 @@ # GO_WORKSPACE_PATH <- location of copied sources directory # GO_PATH <- The value that should be set for the GO_PATH environment variable Param( - [string] $goWorkSpaceDir, - [string] $orgOrUser = "Azure", - [string] $repo = "azure-sdk-for-go" + [string] $goWorkSpaceDir, + [string] $orgOrUser = "Azure", + [string] $repo = "azure-sdk-for-go" ) $repoRoot = Resolve-Path "$PSScriptRoot/../../" @@ -24,6 +24,6 @@ Write-Host "Root of new Go Workspace is $goWorkSpaceDir" Copy-Item -Container -Recurse -Path "$repoRoot/*" -Destination $CreatedGoWorkspaceSrc return New-Object PSObject -Property @{ - GO_WORKSPACE_PATH = Resolve-Path $CreatedGoWorkspaceSrc - GO_PATH = Resolve-Path $goWorkSpaceDir + GO_WORKSPACE_PATH = Resolve-Path $CreatedGoWorkspaceSrc + GO_PATH = Resolve-Path $goWorkSpaceDir } diff --git a/eng/scripts/get_module_dirs.ps1 b/eng/scripts/get_module_dirs.ps1 index 70068b99ea15..2033f8ca3947 100644 --- a/eng/scripts/get_module_dirs.ps1 +++ b/eng/scripts/get_module_dirs.ps1 @@ -1,21 +1,21 @@ Param( - [string] $serviceDir + [string] $serviceDir ) function Get-ModuleDirs ([string] $serviceDir) { - $modDirs = [Collections.Generic.List[String]]@() + $modDirs = [Collections.Generic.List[String]]@() - # find each module directory under $serviceDir - Get-ChildItem -recurse -path $serviceDir -filter go.mod | ForEach-Object { - $cdir = $_.Directory - Write-Host "Adding $cdir to list of module paths" - $modDirs.Add($cdir) - } + # find each module directory under $serviceDir + Get-ChildItem -recurse -path $serviceDir -filter go.mod | ForEach-Object { + $cdir = $_.Directory + Write-Host "Adding $cdir to list of module paths" + $modDirs.Add($cdir) + } - # return the list of module directories - return $modDirs + # return the list of module directories + return $modDirs } if ($MyInvocation.InvocationName -ne ".") { - Get-ModuleDirs $serviceDir + Get-ModuleDirs $serviceDir } diff --git a/eng/scripts/get_test_dirs.ps1 b/eng/scripts/get_test_dirs.ps1 index 0ad6b8136616..dc03bf6c94a2 100644 --- a/eng/scripts/get_test_dirs.ps1 +++ b/eng/scripts/get_test_dirs.ps1 @@ -1,20 +1,20 @@ Param( - [string] $serviceDir + [string] $serviceDir ) $testDirs = [Collections.Generic.List[String]]@() # find each directory under $serviceDir that contains Go test files Get-Childitem -recurse -path $serviceDir -filter *_test.go | foreach-object { - $cdir = $_.Directory - $tests = Select-String -Path $_ 'Test' -AllMatches + $cdir = $_.Directory + $tests = Select-String -Path $_ 'Test' -AllMatches - if ($tests.Count -gt 0) { - if (!$testDirs.Contains($cdir)) { - Write-Host "Adding $cdir to list of test directories" - $testDirs.Add($cdir) + if ($tests.Count -gt 0) { + if (!$testDirs.Contains($cdir)) { + Write-Host "Adding $cdir to list of test directories" + $testDirs.Add($cdir) + } } - } } # return the list of test directories diff --git a/eng/scripts/scoped_discover.ps1 b/eng/scripts/scoped_discover.ps1 index d7ed7e9213d5..87e8b5dce36f 100644 --- a/eng/scripts/scoped_discover.ps1 +++ b/eng/scripts/scoped_discover.ps1 @@ -1,12 +1,12 @@ Param( - [string] $serviceDir = "" + [string] $serviceDir = "" ) -if($serviceDir){ - $targetDir = "$PSScriptRoot/../../sdk/$serviceDir" +if ($serviceDir) { + $targetDir = "$PSScriptRoot/../../sdk/$serviceDir" } else { - $targetDir = "$PSScriptRoot/../../sdk" + $targetDir = "$PSScriptRoot/../../sdk" } $path = Resolve-Path -Path $targetDir