From 1187f6fdcba335335f59ba83635f863e386770b9 Mon Sep 17 00:00:00 2001 From: max-ieremenko Date: Sun, 20 Oct 2024 15:26:59 +0200 Subject: [PATCH] clean up --- Build/build-ci.ps1 | 4 +- Build/build-locally.ps1 | 4 +- Build/build-tasks.ps1 | 98 ++++++++++++++-------------- Build/install-dependencies.ps1 | 22 +++---- Build/scripts/Get-ModuleVersion.ps1 | 2 +- Build/scripts/Install-DotNet.ps1 | 12 ++-- Build/tasks/build.ps1 | 4 +- Build/tasks/pack-global-tool.ps1 | 4 +- Build/tasks/pack-manual-download.ps1 | 6 +- Build/tasks/pack-ps-module.ps1 | 14 ++-- Build/tasks/pack-test.ps1 | 20 +++--- Build/tasks/test-ps-module.ps1 | 20 +++--- Build/tasks/third-party-notices.ps1 | 6 +- Build/tasks/unit-test.ps1 | 6 +- Build/tasks/update-example.ps1 | 4 +- 15 files changed, 113 insertions(+), 113 deletions(-) diff --git a/Build/build-ci.ps1 b/Build/build-ci.ps1 index f92e7f14..13320045 100644 --- a/Build/build-ci.ps1 +++ b/Build/build-ci.ps1 @@ -8,8 +8,8 @@ param ( $GithubToken ) -$ErrorActionPreference = "Stop" +$ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest -$file = Join-Path $PSScriptRoot "build-tasks.ps1" +$file = Join-Path $PSScriptRoot 'build-tasks.ps1' Invoke-Build -File $file -Task CiBuild -GithubToken $GithubToken \ No newline at end of file diff --git a/Build/build-locally.ps1 b/Build/build-locally.ps1 index c5849fba..434f77c4 100644 --- a/Build/build-locally.ps1 +++ b/Build/build-locally.ps1 @@ -1,8 +1,8 @@ #Requires -Version "7.0" #Requires -Modules @{ ModuleName="InvokeBuild"; ModuleVersion="5.11.3" } -$ErrorActionPreference = "Stop" +$ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest -$file = Join-Path $PSScriptRoot "build-tasks.ps1" +$file = Join-Path $PSScriptRoot 'build-tasks.ps1' Invoke-Build -File $file -Task LocalBuild \ No newline at end of file diff --git a/Build/build-tasks.ps1 b/Build/build-tasks.ps1 index d0ccb64e..bb21c5a4 100644 --- a/Build/build-tasks.ps1 +++ b/Build/build-tasks.ps1 @@ -12,16 +12,16 @@ task Pack PackGlobalTool, PackPowerShellModule, PackManualDownload, PackTest Enter-Build { $settings = @{ - sources = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../Sources")) - output = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../build-out")) - bin = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../Sources/bin")) - repository = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../ThirdPartyLibraries")) - examples = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../Examples")) - frameworks = "net6.0", "net8.0" + sources = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../Sources')) + output = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../build-out')) + bin = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../Sources/bin')) + repository = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../ThirdPartyLibraries')) + examples = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../Examples')) + frameworks = 'net6.0', 'net8.0' version = $( - $buildProps = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot "../Sources/Directory.Build.props")) - $packageVersion = (Select-Xml -Path $buildProps -XPath "Project/PropertyGroup/DefaultPackageVersion").Node.InnerText - assert $packageVersion "Package version not found" + $buildProps = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../Sources/Directory.Build.props')) + $packageVersion = (Select-Xml -Path $buildProps -XPath 'Project/PropertyGroup/DefaultPackageVersion').Node.InnerText + assert $packageVersion 'Package version not found' $packageVersion ) } @@ -39,42 +39,42 @@ task Clean { Get-ChildItem -Path $settings.sources -Filter bin -Directory -Recurse | Remove-Item -Recurse -Force Get-ChildItem -Path $settings.sources -Filter obj -Directory -Recurse | Remove-Item -Recurse -Force - $nodeModules = Join-Path $settings.sources "ThirdPartyLibraries.Npm.Demo\node_modules" + $nodeModules = Join-Path $settings.sources 'ThirdPartyLibraries.Npm.Demo\node_modules' if (Test-Path $nodeModules) { Remove-Item -Path $nodeModules -Recurse -Force } } task Build { - Invoke-Build -File "tasks/build.ps1" -SourcesPath $settings.sources + Invoke-Build -File 'tasks/build.ps1' -SourcesPath $settings.sources } task ThirdPartyNotices { Invoke-Build ` - -File "tasks/third-party-notices.ps1" ` - -AppPath (Join-Path $settings.bin "app/net6.0/ThirdPartyLibraries.dll") ` + -File 'tasks/third-party-notices.ps1' ` + -AppPath (Join-Path $settings.bin 'app/net6.0/ThirdPartyLibraries.dll') ` -Version $settings.version ` -SourcesPath $settings.sources ` -RepositoryPath $settings.repository ` - -OutPath (Join-Path $settings.output "ThirdNotices") ` + -OutPath (Join-Path $settings.output 'ThirdNotices') ` -GithubToken $GithubToken } task UnitTest { $builds = @() foreach ($framework in $settings.frameworks) { - $builds += @{ File = "tasks/unit-test.ps1"; BinPath = $settings.bin; Framework = $framework } + $builds += @{ File = 'tasks/unit-test.ps1'; BinPath = $settings.bin; Framework = $framework } } Build-Parallel $builds -ShowParameter Framework -MaximumBuilds 4 } task PackGlobalTool { - Invoke-Build -File "tasks/pack-global-tool.ps1" -SourcesPath $settings.sources -OutPath $settings.output + Invoke-Build -File 'tasks/pack-global-tool.ps1' -SourcesPath $settings.sources -OutPath $settings.output } task PackPowerShellModule { - Invoke-Build -File "tasks/pack-ps-module.ps1" ` + Invoke-Build -File 'tasks/pack-ps-module.ps1' ` -BinPath $settings.bin ` -Version $settings.version ` -OutPath $settings.output @@ -84,7 +84,7 @@ task PackManualDownload { $builds = @() foreach ($framework in $settings.frameworks) { $builds += @{ - File = "tasks/pack-manual-download.ps1" + File = 'tasks/pack-manual-download.ps1' BinPath = $settings.bin Version = $settings.version Framework = $framework @@ -96,13 +96,13 @@ task PackManualDownload { } task PackTest { - $packageList = Get-ChildItem -Path $settings.output -Recurse -File -Include "*.nupkg", "*.zip" | ForEach-Object { $_.FullName } - assert ($packageList -and $packageList.Length) "no packages found." + $packageList = Get-ChildItem -Path $settings.output -Recurse -File -Include '*.nupkg', '*.zip' | ForEach-Object { $_.FullName } + assert ($packageList -and $packageList.Length) 'no packages found.' $builds = @() foreach ($package in $packageList) { $builds += @{ - File = "tasks/pack-test.ps1" + File = 'tasks/pack-test.ps1' Path = $package } } @@ -113,31 +113,31 @@ task PackTest { task PsCoreTest { # show-powershell-images.ps1 $images = $( - "mcr.microsoft.com/powershell:7.0.0-ubuntu-18.04" - , "mcr.microsoft.com/powershell:7.0.1-ubuntu-18.04" - , "mcr.microsoft.com/powershell:7.0.2-ubuntu-18.04" - , "mcr.microsoft.com/powershell:7.0.3-ubuntu-18.04" - , "mcr.microsoft.com/powershell:7.1.0-ubuntu-18.04" - , "mcr.microsoft.com/powershell:7.1.1-ubuntu-20.04" - , "mcr.microsoft.com/powershell:7.1.2-ubuntu-20.04" - , "mcr.microsoft.com/powershell:7.1.3-ubuntu-20.04" - , "mcr.microsoft.com/powershell:7.1.4-ubuntu-20.04" - , "mcr.microsoft.com/powershell:7.1.5-ubuntu-20.04" - , "mcr.microsoft.com/powershell:7.2.0-ubuntu-20.04" - , "mcr.microsoft.com/powershell:7.2.1-ubuntu-20.04" - , "mcr.microsoft.com/powershell:7.2.2-ubuntu-20.04" - , "mcr.microsoft.com/powershell:7.3-ubuntu-20.04" - , "mcr.microsoft.com/powershell:7.4-ubuntu-20.04" - , "mcr.microsoft.com/powershell:preview-7.5-ubuntu-20.04") + 'mcr.microsoft.com/powershell:7.0.0-ubuntu-18.04' + , 'mcr.microsoft.com/powershell:7.0.1-ubuntu-18.04' + , 'mcr.microsoft.com/powershell:7.0.2-ubuntu-18.04' + , 'mcr.microsoft.com/powershell:7.0.3-ubuntu-18.04' + , 'mcr.microsoft.com/powershell:7.1.0-ubuntu-18.04' + , 'mcr.microsoft.com/powershell:7.1.1-ubuntu-20.04' + , 'mcr.microsoft.com/powershell:7.1.2-ubuntu-20.04' + , 'mcr.microsoft.com/powershell:7.1.3-ubuntu-20.04' + , 'mcr.microsoft.com/powershell:7.1.4-ubuntu-20.04' + , 'mcr.microsoft.com/powershell:7.1.5-ubuntu-20.04' + , 'mcr.microsoft.com/powershell:7.2.0-ubuntu-20.04' + , 'mcr.microsoft.com/powershell:7.2.1-ubuntu-20.04' + , 'mcr.microsoft.com/powershell:7.2.2-ubuntu-20.04' + , 'mcr.microsoft.com/powershell:7.3-ubuntu-20.04' + , 'mcr.microsoft.com/powershell:7.4-ubuntu-20.04' + , 'mcr.microsoft.com/powershell:preview-7.5-ubuntu-20.04') $builds = @() foreach ($image in $images) { exec { docker pull --quiet $image } $builds += @{ - File = "tasks/test-ps-module.ps1" - PowerShellPath = (Join-Path $settings.output "pwsh.zip") - TestPath = (Join-Path $settings.sources "ThirdPartyLibraries.PowerShell.IntegrationTest") + File = 'tasks/test-ps-module.ps1' + PowerShellPath = (Join-Path $settings.output 'pwsh.zip') + TestPath = (Join-Path $settings.sources 'ThirdPartyLibraries.PowerShell.IntegrationTest') ImageName = $image } } @@ -146,29 +146,29 @@ task PsCoreTest { } task UpdateExamples { - $appPath = Join-Path $settings.bin "app/net6.0/ThirdPartyLibraries.dll" + $appPath = Join-Path $settings.bin 'app/net6.0/ThirdPartyLibraries.dll' $builds = @() - $examples = Get-ChildItem -Path (Join-Path $settings.examples "third-party-notices-template") -Directory + $examples = Get-ChildItem -Path (Join-Path $settings.examples 'third-party-notices-template') -Directory foreach ($example in $examples) { $builds += @{ - File = "tasks/update-example.ps1" + File = 'tasks/update-example.ps1' AppPath = $appPath ExamplePath = $example.FullName RepositoryPath = $settings.repository - TemplatePath = (Join-Path $example.FullName "third-party-notices-template.txt") - ToFileName = "ThirdPartyNotices.txt" + TemplatePath = (Join-Path $example.FullName 'third-party-notices-template.txt') + ToFileName = 'ThirdPartyNotices.txt' } } - $example = Join-Path $settings.examples "export-to-csv" + $example = Join-Path $settings.examples 'export-to-csv' $builds += @{ - File = "tasks/update-example.ps1" + File = 'tasks/update-example.ps1' AppPath = $appPath ExamplePath = $example RepositoryPath = $settings.repository - TemplatePath = (Join-Path $example "export-template.txt") - ToFileName = "packages.csv" + TemplatePath = (Join-Path $example 'export-template.txt') + ToFileName = 'packages.csv' } Build-Parallel $builds -ShowParameter ExamplePath -MaximumBuilds 1 diff --git a/Build/install-dependencies.ps1 b/Build/install-dependencies.ps1 index f68a99f4..58466166 100644 --- a/Build/install-dependencies.ps1 +++ b/Build/install-dependencies.ps1 @@ -3,24 +3,24 @@ [CmdletBinding()] param ( [Parameter()] - [ValidateSet(".net", "InvokeBuild")] + [ValidateSet('.net', 'InvokeBuild')] [string[]] $List ) Set-StrictMode -Version Latest -$ErrorActionPreference = "Stop" +$ErrorActionPreference = 'Stop' -. (Join-Path $PSScriptRoot "scripts" "Get-ModuleVersion.ps1") +. (Join-Path $PSScriptRoot 'scripts' 'Get-ModuleVersion.ps1') -if (-not $List -or (".net" -in $List)) { - $install = Join-Path $PSScriptRoot "scripts/Install-DotNet.ps1" - & $install "6.0.418" - & $install (Get-Content -Raw (Join-Path $PSScriptRoot "../Sources/global.json") | ConvertFrom-Json).sdk.version +if (-not $List -or ('.net' -in $List)) { + $install = Join-Path $PSScriptRoot 'scripts/Install-DotNet.ps1' + & $install '6.0.418' + & $install (Get-Content -Raw (Join-Path $PSScriptRoot '../Sources/global.json') | ConvertFrom-Json).sdk.version } -if (-not $List -or ("InvokeBuild" -in $List)) { - $install = Join-Path $PSScriptRoot "scripts/Install-Module.ps1" - $version = Get-ModuleVersion "InvokeBuild" - & $install "InvokeBuild" $version +if (-not $List -or ('InvokeBuild' -in $List)) { + $install = Join-Path $PSScriptRoot 'scripts/Install-Module.ps1' + $version = Get-ModuleVersion 'InvokeBuild' + & $install 'InvokeBuild' $version } diff --git a/Build/scripts/Get-ModuleVersion.ps1 b/Build/scripts/Get-ModuleVersion.ps1 index 1acad35b..348d4f9b 100644 --- a/Build/scripts/Get-ModuleVersion.ps1 +++ b/Build/scripts/Get-ModuleVersion.ps1 @@ -5,7 +5,7 @@ function Get-ModuleVersion { $Name ) - $sources = Get-Content (Join-Path $PSScriptRoot "../build-ci.ps1") -Raw + $sources = Get-Content (Join-Path $PSScriptRoot '../build-ci.ps1') -Raw $tokens = $null $errors = $null $modules = [Management.Automation.Language.Parser]::ParseInput($sources, [ref]$tokens, [ref]$errors).ScriptRequirements.RequiredModules diff --git a/Build/scripts/Install-DotNet.ps1 b/Build/scripts/Install-DotNet.ps1 index d9d11fec..19e87d4c 100644 --- a/Build/scripts/Install-DotNet.ps1 +++ b/Build/scripts/Install-DotNet.ps1 @@ -31,7 +31,7 @@ if (Get-Command -Name dotnet -ErrorAction SilentlyContinue) { $versions = dotnet --list-sdks foreach ($installedVersion in $versions) { # 6.0.401 [C:\Program Files\dotnet\sdk] - $test = ($installedVersion -split " ")[0] + $test = ($installedVersion -split ' ')[0] if (Test-Version -Target $Version -Test $test) { Write-Output ".net sdk $test is alredy installed" @@ -40,15 +40,15 @@ if (Get-Command -Name dotnet -ErrorAction SilentlyContinue) { } } -$installDir = "C:\Program Files\dotnet" -$installScript = "dotnet-install.ps1" +$installDir = 'C:\Program Files\dotnet' +$installScript = 'dotnet-install.ps1' if ($IsLinux) { - $installDir = "/usr/share/dotnet" - $installScript = "dotnet-install.sh" + $installDir = '/usr/share/dotnet' + $installScript = 'dotnet-install.sh' } -$downloadDir = Join-Path ([System.IO.Path]::GetTempPath()) "install-dotnet" +$downloadDir = Join-Path ([System.IO.Path]::GetTempPath()) 'install-dotnet' if (Test-Path $downloadDir) { Remove-Item -Path $downloadDir -Recurse -Force } diff --git a/Build/tasks/build.ps1 b/Build/tasks/build.ps1 index f61160b2..028b8cd4 100644 --- a/Build/tasks/build.ps1 +++ b/Build/tasks/build.ps1 @@ -6,14 +6,14 @@ param( $SourcesPath ) -task Default DotnetRestore, DotnetBuild +task . DotnetRestore, DotnetBuild task DotnetRestore { exec { dotnet restore $SourcesPath } } task DotnetBuild { - $sln = Join-Path $SourcesPath "ThirdPartyLibraries.sln" + $sln = Join-Path $SourcesPath 'ThirdPartyLibraries.sln' exec { dotnet build $sln ` -t:Rebuild ` diff --git a/Build/tasks/pack-global-tool.ps1 b/Build/tasks/pack-global-tool.ps1 index 61e55916..85986a46 100644 --- a/Build/tasks/pack-global-tool.ps1 +++ b/Build/tasks/pack-global-tool.ps1 @@ -11,8 +11,8 @@ param( $OutPath ) -task Default { - $projectFile = Join-Path $SourcesPath "ThirdPartyLibraries/ThirdPartyLibraries.csproj" +task . { + $projectFile = Join-Path $SourcesPath 'ThirdPartyLibraries/ThirdPartyLibraries.csproj' exec { dotnet pack ` diff --git a/Build/tasks/pack-manual-download.ps1 b/Build/tasks/pack-manual-download.ps1 index a5e06fbd..bb27c80c 100644 --- a/Build/tasks/pack-manual-download.ps1 +++ b/Build/tasks/pack-manual-download.ps1 @@ -10,7 +10,7 @@ param( $Version, [Parameter(Mandatory = $true)] - [ValidateSet("net6.0", "net8.0")] + [ValidateSet('net6.0', 'net8.0')] [string] $Framework, @@ -20,8 +20,8 @@ param( $OutPath ) -task Default { - $lic = Join-Path $OutPath "ThirdNotices/*" +task . { + $lic = Join-Path $OutPath 'ThirdNotices/*' $destination = Join-Path $OutPath "ThirdPartyLibraries.$Version-$Framework.zip" $source = Join-Path $BinPath "app/$Framework/publish/*" diff --git a/Build/tasks/pack-ps-module.ps1 b/Build/tasks/pack-ps-module.ps1 index af157205..05cf8c19 100644 --- a/Build/tasks/pack-ps-module.ps1 +++ b/Build/tasks/pack-ps-module.ps1 @@ -15,10 +15,10 @@ param( $OutPath ) -task Default Copy, Clean, SetVersion, Zip +task . Copy, Clean, SetVersion, Zip Enter-Build { - $temp = Join-Path $OutPath "pwsh" + $temp = Join-Path $OutPath 'pwsh' } Exit-Build { @@ -26,7 +26,7 @@ Exit-Build { } task Copy { - Copy-Item -Path (Join-Path $BinPath "pwsh") -Destination $temp -Recurse + Copy-Item -Path (Join-Path $BinPath 'pwsh') -Destination $temp -Recurse } task Clean { @@ -35,13 +35,13 @@ task Clean { task SetVersion { # .psd1 set module version - $psdFile = Join-Path $temp "ThirdPartyLibraries.psd1" + $psdFile = Join-Path $temp 'ThirdPartyLibraries.psd1' $content = Get-Content -Path $psdFile -Raw - $content = $content -replace "3.2.1", $Version + $content = $content -replace '3.2.1', $Version Set-Content -Path $psdFile -Value $content } task Zip { - $lic = Join-Path $OutPath "ThirdNotices/*" - Compress-Archive -Path "$temp/*", $lic -DestinationPath (Join-Path $OutPath "pwsh.zip") + $lic = Join-Path $OutPath 'ThirdNotices/*' + Compress-Archive -Path "$temp/*", $lic -DestinationPath (Join-Path $OutPath 'pwsh.zip') } \ No newline at end of file diff --git a/Build/tasks/pack-test.ps1 b/Build/tasks/pack-test.ps1 index 677169a1..5eacfbdd 100644 --- a/Build/tasks/pack-test.ps1 +++ b/Build/tasks/pack-test.ps1 @@ -6,7 +6,7 @@ param( $Path ) -task Default Expand, TestLicenses +task . Expand, TestLicenses Enter-Build { $name = Split-Path $Path -Leaf @@ -24,28 +24,28 @@ task Expand { } task TestLicenses { - assert (Test-Path (Join-Path $temp "LICENSE")) "File LICENSE not found in $name" - assert (Test-Path (Join-Path $temp "ThirdPartyNotices.txt")) "File ThirdPartyNotices.txt not found in $name" - assert (Test-Path (Join-Path $temp "Licenses/MIT-license.txt")) "File Licenses/MIT-license.txt not found in $name" + assert (Test-Path (Join-Path $temp 'LICENSE')) "File LICENSE not found in $name" + assert (Test-Path (Join-Path $temp 'ThirdPartyNotices.txt')) "File ThirdPartyNotices.txt not found in $name" + assert (Test-Path (Join-Path $temp 'Licenses/MIT-license.txt')) "File Licenses/MIT-license.txt not found in $name" } task TestNuSpec { $ext = [System.IO.Path]::GetExtension($name) - if ($ext -eq ".nupkg") { + if ($ext -eq '.nupkg') { $nuspecFile = Get-ChildItem -Path $temp -Filter *.nuspec assert ($nuspecFile) ".nuspec not found in $name" [xml]$nuspec = Get-Content $nuspecFile - $ns = New-Object -TypeName "Xml.XmlNamespaceManager" -ArgumentList $nuspec.NameTable - $ns.AddNamespace("n", $nuspec.DocumentElement.NamespaceURI) + $ns = New-Object -TypeName 'Xml.XmlNamespaceManager' -ArgumentList $nuspec.NameTable + $ns.AddNamespace('n', $nuspec.DocumentElement.NamespaceURI) - $id = $nuspec.SelectNodes("n:package/n:metadata/n:id", $ns) + $id = $nuspec.SelectNodes('n:package/n:metadata/n:id', $ns) assert ($id) "id not found in $name" - $repository = $nuspec.SelectNodes("n:package/n:metadata/n:repository", $ns) + $repository = $nuspec.SelectNodes('n:package/n:metadata/n:repository', $ns) assert ($repository) "Repository element not found in $name" - if ([string]::IsNullOrWhiteSpace($nuspec.SelectNodes("n:package/n:metadata/n:repository/@commit", $ns).Value)) { + if ([string]::IsNullOrWhiteSpace($nuspec.SelectNodes('n:package/n:metadata/n:repository/@commit', $ns).Value)) { throw ("Repository commit attribute not found in $name") } } diff --git a/Build/tasks/test-ps-module.ps1 b/Build/tasks/test-ps-module.ps1 index 35f2aa6e..1957d97e 100644 --- a/Build/tasks/test-ps-module.ps1 +++ b/Build/tasks/test-ps-module.ps1 @@ -15,25 +15,25 @@ param ( $ImageName ) -task Default { - $nugetLocal = Join-Path $Env:USERPROFILE ".nuget\packages" - $userSecrets = Join-Path $Env:APPDATA "Microsoft\UserSecrets" +task . { + $nugetLocal = Join-Path $Env:USERPROFILE '.nuget\packages' + $userSecrets = Join-Path $Env:APPDATA 'Microsoft\UserSecrets' $runArgs = $( - "run" - , "--rm" - , "-v", "$($nugetLocal):/root/.nuget/packages:ro" - , "-v", "$($PowerShellPath):/pwsh.zip:ro" - , "-v", "$($TestPath):/sources:ro" + 'run' + , '--rm' + , '-v', "$($nugetLocal):/root/.nuget/packages:ro" + , '-v', "$($PowerShellPath):/pwsh.zip:ro" + , '-v', "$($TestPath):/sources:ro" ) if (Test-Path $userSecrets) { - $runArgs += $("-v", "$($userSecrets):/root/.microsoft/usersecrets:ro") + $runArgs += $('-v', "$($userSecrets):/root/.microsoft/usersecrets:ro") } $runArgs += $( $ImageName - , "pwsh", "-Command", "/sources/Test-App.ps1" + , 'pwsh', '-Command', '/sources/Test-App.ps1' ) exec { docker $runArgs } diff --git a/Build/tasks/third-party-notices.ps1 b/Build/tasks/third-party-notices.ps1 index 93432ceb..c84c4f77 100644 --- a/Build/tasks/third-party-notices.ps1 +++ b/Build/tasks/third-party-notices.ps1 @@ -28,12 +28,12 @@ param( $GithubToken ) -task Default Update, Validate, Generate, CopyLicense +task . Update, Validate, Generate, CopyLicense task Update { $runArgs = $() if ($GithubToken) { - $runArgs = "-github.com:personalAccessToken", $GithubToken + $runArgs = '-github.com:personalAccessToken', $GithubToken } exec { dotnet $AppPath update -appName ThirdPartyLibraries -source $SourcesPath -repository $RepositoryPath $runArgs } @@ -48,5 +48,5 @@ task Generate { } task CopyLicense { - Copy-Item -Path (Join-Path $SourcesPath "../LICENSE") -Destination $OutPath + Copy-Item -Path (Join-Path $SourcesPath '../LICENSE') -Destination $OutPath } diff --git a/Build/tasks/unit-test.ps1 b/Build/tasks/unit-test.ps1 index 21c3ba19..dd5e5d28 100644 --- a/Build/tasks/unit-test.ps1 +++ b/Build/tasks/unit-test.ps1 @@ -6,13 +6,13 @@ param ( $BinPath, [Parameter(Mandatory = $true)] - [ValidateSet("net6.0", "net8.0")] + [ValidateSet('net6.0', 'net8.0')] [string] $Framework ) -task Default { - $path = Join-Path $BinPath "test" $Framework +task . { + $path = Join-Path $BinPath 'test' $Framework $testList = Get-ChildItem -Path $path -Filter *.Test.dll ` | ForEach-Object { $_.FullName } assert $testList.Count "$Framework test list is empty" diff --git a/Build/tasks/update-example.ps1 b/Build/tasks/update-example.ps1 index af44c436..204d5e0c 100644 --- a/Build/tasks/update-example.ps1 +++ b/Build/tasks/update-example.ps1 @@ -25,14 +25,14 @@ param( $ToFileName ) -task Default { +task . { exec { dotnet $AppPath ` generate ` -appName ThirdPartyLibraries ` -repository $RepositoryPath ` -to $ExamplePath ` - -title "Third party libraries" ` + -title 'Third party libraries' ` -template $TemplatePath ` -toFileName $ToFileName }