revisited and synchronized pwsh scripts in tools/

[skip ci]
This commit is contained in:
silverqx
2023-02-04 17:44:32 +01:00
parent b5e4e835c1
commit 6acc2859b3
14 changed files with 44 additions and 22 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -2,7 +2,6 @@
Set-StrictMode -Version 3.0
# Get slashes by platform
function Get-Slashes {
[OutputType([string])]

View File

@@ -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')]

View File

@@ -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')]

View File

@@ -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 = '<your_path_here>\Qt\5.15.2\msvc2019_64\bin;' + $env:Path
. <your_path_here>\dotfiles\bin\vcvars64.ps1

View File

@@ -1,4 +1,9 @@
Write-Host 'Setting up environment for Qt 6.3.1 usage...' -ForegroundColor Magenta
$env:Path = '<your_path_here>\Qt\6.3.1\msvc2019_64\bin;' + $env:Path
. <your_path_here>\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 = '<your_path_here>\Qt\6.3.2\msvc2019_64\bin;' + $env:Path
. <your_path_here>\dotfiles\bin\vcvars64.ps1

View File

@@ -1,3 +1,5 @@
#!/usr/bin/env pwsh
Set-StrictMode -Version 3.0
if (-not (Test-Path .\compile_commands.json)) {

View File

@@ -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

View File

@@ -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 '<your_path_here>\dotfiles\python\run-clazy-standalone.py' @args

View File

@@ -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]
}
}

View File

@@ -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]
}
}