diff --git a/tools/Add-FolderOnPath.ps1 b/tools/Add-FolderOnPath.ps1 index 9a7a150ec..2c7f3ef9e 100644 --- a/tools/Add-FolderOnPath.ps1 +++ b/tools/Add-FolderOnPath.ps1 @@ -31,7 +31,7 @@ begin { } $Script:Slashes = $null - . $PSScriptRoot\private\Common.ps1 + . $PSScriptRoot\private\Common-Path.ps1 function Get-EnvVariable { [OutputType([string[]])] @@ -363,7 +363,7 @@ process { # Appends /tmp and /usr/local/bin paths to the $env:Path environment variable Add-FolderOnPath -Path /tmp, /usr/local/bin -Append - Or + # Or '/tmp', '/usr/local/bin' | Add-FolderOnPath -Append diff --git a/tools/Find-Todos.ps1 b/tools/Find-Todos.ps1 index 4d0075b78..183c548c7 100644 --- a/tools/Find-Todos.ps1 +++ b/tools/Find-Todos.ps1 @@ -26,7 +26,8 @@ Param( [Parameter(HelpMessage = 'Todo keywords regex pattern.')] [ValidateNotNullOrEmpty()] - [string] $TodoKeywordsPattern = ' (TODO|NOTE|FIXME|BUG|WARNING|CUR|FEATURE|TEST|FUTURE|CUR1|TMP|SEC) ' + [string] $TodoKeywordsPattern = ' (TODO|NOTE|FIXME|BUG|WARNING|CUR|FEATURE|TEST|FUTURE|' + + 'CUR1|TMP|SEC) ' ) Set-StrictMode -Version 3.0 diff --git a/tools/Invoke-Tests.ps1 b/tools/Invoke-Tests.ps1 index cb1db8676..3ad1a6d76 100644 --- a/tools/Invoke-Tests.ps1 +++ b/tools/Invoke-Tests.ps1 @@ -14,7 +14,7 @@ Param( Set-StrictMode -Version 3.0 -. $PSScriptRoot\private\Common.ps1 +. $PSScriptRoot\private\Common-Path.ps1 $Script:TotalElapsed = 0 $Script:AverageElapsed = 0 diff --git a/tools/Lint-TinyORM.ps1 b/tools/Lint-TinyORM.ps1 index 8fcb14382..b0df3ddfb 100644 --- a/tools/Lint-TinyORM.ps1 +++ b/tools/Lint-TinyORM.ps1 @@ -29,7 +29,7 @@ Param( [int] $QtVersion = 6, [Parameter(HelpMessage = 'Clean CMake build (remove everything inside the -BuildPath).')] - [switch] $Clean, + [switch] $CleanBuild, [Parameter(HelpMessage = 'Specifies the CMake build type.')] [ValidateSet('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel')] @@ -45,6 +45,10 @@ Param( Set-StrictMode -Version 3.0 +# Script variables section +# --- +Set-Variable STACK_NAME -Option Constant -Value $MyInvocation.MyCommand.Name + # Number of processes to spawn (value passed to the -j option) $Script:numberOfProcesses = $env:NUMBER_OF_PROCESSORS - 2 @@ -57,7 +61,7 @@ $Script:numberOfProcesses = $env:NUMBER_OF_PROCESSORS - 2 $FilesPaths = $null -eq $FilesPaths ? '.+?' : "(?:$($FilesPaths -join '|'))" $Files = $null -eq $Files ? '[\w_\-\+]+' : "(?:$($Files -join '|'))" -$Script:RegEx = "(?:examples|src|tests)[\\\/]+$FilesPaths[\\\/]+(?!mocs_)$($Files)\.cpp$" +$Script:RegEx = "[\\\/]+(?:examples|src|tests)[\\\/]+$FilesPaths[\\\/]+(?!mocs_)$($Files)\.cpp$" # Append the build type to the build path $BuildPath = $BuildPath.TrimEnd( @@ -71,7 +75,7 @@ if (-not (Test-Path $BuildPath)) { New-Item -Path $BuildPath -ItemType Directory | Out-Null } -Push-Location +Push-Location -StackName $STACK_NAME Set-Location -Path $BuildPath @@ -81,7 +85,7 @@ if (-not (Test-Path env:WindowsSDKLibVersion)) { } # Clean build -if ($Clean) { +if ($CleanBuild) { Remove-Item -Recurse -Force $BuildPath\* Write-Host "`nClean CMake $BuildType build`n" -ForegroundColor Green @@ -160,9 +164,10 @@ if (-not $SkipClazy) { & 'E:\dotfiles\bin\run-clazy-standalone.ps1' ` -checks="$Script:Checks" ` - -extra-arg-before='-Qunused-arguments' -header-filter='(orm|tom|migrations)/.+\.(h|hpp)$' ` + -extra-arg-before='-Qunused-arguments' ` + -header-filter='[\\\/]+(examples|orm|tests|tom)[\\\/]+.+\.(h|hpp)$' ` -j $Script:numberOfProcesses ` -p="$BuildPath" $Script:RegEx } -Pop-Location +Pop-Location -StackName $STACK_NAME diff --git a/tools/private/Common.ps1 b/tools/private/Common-Path.ps1 similarity index 99% rename from tools/private/Common.ps1 rename to tools/private/Common-Path.ps1 index f61c537a9..0f1f50571 100644 --- a/tools/private/Common.ps1 +++ b/tools/private/Common-Path.ps1 @@ -2,7 +2,6 @@ Set-StrictMode -Version 3.0 - # Get slashes by platform function Get-Slashes { [OutputType([string])] diff --git a/tools/qa-lint-tinyorm-qt5.ps1.example b/tools/qa-lint-tinyorm-qt5.ps1.example index 0f9369fd2..66f272f6e 100644 --- a/tools/qa-lint-tinyorm-qt5.ps1.example +++ b/tools/qa-lint-tinyorm-qt5.ps1.example @@ -20,7 +20,7 @@ Param( [switch] $SkipClazy, [Parameter(HelpMessage = 'Clean CMake build (remove everything inside the -BuildPath).')] - [switch] $Clean, + [switch] $CleanBuild, [Parameter(HelpMessage = 'Specifies the CMake build type.')] [ValidateSet('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel')] diff --git a/tools/qa-lint-tinyorm-qt6.ps1.example b/tools/qa-lint-tinyorm-qt6.ps1.example index e33203ac5..347d35f75 100644 --- a/tools/qa-lint-tinyorm-qt6.ps1.example +++ b/tools/qa-lint-tinyorm-qt6.ps1.example @@ -20,7 +20,7 @@ Param( [switch] $SkipClazy, [Parameter(HelpMessage = 'Clean CMake build (remove everything inside the -BuildPath).')] - [switch] $Clean, + [switch] $CleanBuild, [Parameter(HelpMessage = 'Specifies the CMake build type.')] [ValidateSet('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel')] diff --git a/tools/qtenv5.ps1.example b/tools/qtenv5.ps1.example index 568a4658a..903a8a9fc 100644 --- a/tools/qtenv5.ps1.example +++ b/tools/qtenv5.ps1.example @@ -1,3 +1,9 @@ +#!/usr/bin/env pwsh + +Set-StrictMode -Version 3.0 + Write-Host 'Setting up environment for Qt 5.15.2 usage...' -ForegroundColor Magenta + $env:Path = '\Qt\5.15.2\msvc2019_64\bin;' + $env:Path + . \dotfiles\bin\vcvars64.ps1 diff --git a/tools/qtenv6.ps1.example b/tools/qtenv6.ps1.example index 45dbcd955..876de00b7 100644 --- a/tools/qtenv6.ps1.example +++ b/tools/qtenv6.ps1.example @@ -1,4 +1,9 @@ -Write-Host 'Setting up environment for Qt 6.3.1 usage...' -ForegroundColor Magenta -$env:Path = '\Qt\6.3.1\msvc2019_64\bin;' + $env:Path -. \dotfiles\bin\vcvars64.ps1 +#!/usr/bin/env pwsh +Set-StrictMode -Version 3.0 + +Write-Host 'Setting up environment for Qt 6.3.2 usage...' -ForegroundColor Magenta + +$env:Path = '\Qt\6.3.2\msvc2019_64\bin;' + $env:Path + +. \dotfiles\bin\vcvars64.ps1 diff --git a/tools/run-clang-tidy.ps1 b/tools/run-clang-tidy.ps1 index 7932df885..ccb109489 100644 --- a/tools/run-clang-tidy.ps1 +++ b/tools/run-clang-tidy.ps1 @@ -1,3 +1,5 @@ +#!/usr/bin/env pwsh + Set-StrictMode -Version 3.0 if (-not (Test-Path .\compile_commands.json)) { diff --git a/tools/run-clazy-standalone b/tools/run-clazy-standalone index ebeec6e59..607a9043f 100755 --- a/tools/run-clazy-standalone +++ b/tools/run-clazy-standalone @@ -26,7 +26,7 @@ Example invocations. - Show diagnostics also from header files in include/orm/ folder. run-clazy-standalone.py -checks='level0,level1' \ - -header-filter='orm/.+\.(h|hpp)$' '.+\.cpp$' + -header-filter='/orm/.+\.(h|hpp)$' '.+\.cpp$' Compilation database setup: http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html diff --git a/tools/run-clazy-standalone.ps1 b/tools/run-clazy-standalone.ps1 index af6d26ad5..d445c9021 100644 --- a/tools/run-clazy-standalone.ps1 +++ b/tools/run-clazy-standalone.ps1 @@ -1,7 +1,9 @@ +#!/usr/bin/env pwsh + Set-StrictMode -Version 3.0 if (-not (Test-Path .\compile_commands.json)) { throw 'Compile database compile_commands.json doesn''t exist.' } -python.exe 'E:\dotfiles\python\run-clazy-standalone.py' @args +python.exe '\dotfiles\python\run-clazy-standalone.py' @args diff --git a/tools/vcvars32.ps1 b/tools/vcvars32.ps1 index 537b7cffa..6526e89f2 100644 --- a/tools/vcvars32.ps1 +++ b/tools/vcvars32.ps1 @@ -1,8 +1,10 @@ +#!/usr/bin/env pwsh + Param( [Parameter(Position = 0, HelpMessage = 'Visual Studio version.')] [ValidateNotNull()] [ValidatePattern('2019|2022')] - [Int]$Version = 2019 + [Int] $Version = 2022 ) Set-StrictMode -Version 3.0 @@ -16,4 +18,3 @@ Get-Content "$env:TEMP\vcvars32_$Version.tmp" | Foreach-Object { Set-Content "env:\$($matches[1])" $matches[2] } } - diff --git a/tools/vcvars64.ps1 b/tools/vcvars64.ps1 index db3617852..3ba2116d6 100644 --- a/tools/vcvars64.ps1 +++ b/tools/vcvars64.ps1 @@ -1,8 +1,10 @@ +#!/usr/bin/env pwsh + Param( [Parameter(Position = 0, HelpMessage = 'Visual Studio version.')] [ValidateNotNull()] [ValidatePattern('2019|2022')] - [Int]$Version = 2019 + [Int] $Version = 2022 ) Set-StrictMode -Version 3.0 @@ -16,4 +18,3 @@ Get-Content "$env:TEMP\vcvars64_$Version.tmp" | Foreach-Object { Set-Content "env:\$($matches[1])" $matches[2] } } -