mirror of
https://github.com/Ed94/refactor.git
synced 2025-07-02 03:41:06 -07:00
did some reorganization, build script changes
Moved header and source to code Changed all build scripts to just be powershell (preferred) Added clang format (but forgot that you cannot format zpl because it hangs clang format) Code changes: * Removed long names just using short names (there is an issue with the opts_compile...) * Removed zpl.refactored.h (its generated now when `.\build.ps1 test` is run * Modified zpl.h to just have the radix sort modification.
This commit is contained in:
63
scripts/refactor_and_format.ps1
Normal file
63
scripts/refactor_and_format.ps1
Normal file
@ -0,0 +1,63 @@
|
||||
[string[]] $include = '*.h', '*.hh', '*.hpp', '*.c', '*.cc', '*.cpp'
|
||||
[string[]] $exclude = '*.g.*', '*.refactor', 'bloat.refactored.hpp', 'refactor.refactored.cpp'
|
||||
|
||||
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_build = Join-Path $path_root build
|
||||
$path_test = Join-Path $path_root test
|
||||
$path_thirdparty = Join-Path $path_root thirdparty
|
||||
|
||||
$file_spec = Join-Path $path_test zpl.refactor
|
||||
$refactor = Join-Path $path_build refactor.exe
|
||||
|
||||
# Gather the files to be formatted.
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_thirdparty -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
|
||||
|
||||
write-host "Beginning refactor...`n"
|
||||
|
||||
$refactors = @(@())
|
||||
|
||||
foreach ( $file in $targetFiles )
|
||||
{
|
||||
$destination = Join-Path $path_test (Split-Path $file -leaf)
|
||||
$destination = $destination.Replace( '.h', '.refactored.h' )
|
||||
|
||||
$refactorParams = @(
|
||||
"-src=$($file)",
|
||||
"-dst=$($destination)"
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
$refactors += (Start-Process $refactor $refactorParams -NoNewWindow -PassThru)
|
||||
}
|
||||
|
||||
foreach ( $process in $refactors )
|
||||
{
|
||||
if ( $process )
|
||||
{
|
||||
$process.WaitForExit()
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`nRefactoring complete`n`n"
|
||||
|
||||
|
||||
# Can't format zpl library... (It hangs clang format)
|
||||
if ( $false )
|
||||
{
|
||||
Write-Host "Beginning format...`n"
|
||||
|
||||
# Format the files.
|
||||
$formatParams = @(
|
||||
'-i' # In-place
|
||||
'-style=file' # Search for a .clang-format file in the parent directory of the source file.
|
||||
'-verbose'
|
||||
)
|
||||
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_test -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
|
||||
clang-format $formatParams $targetFiles
|
||||
|
||||
Write-Host "`nFormatting complete"
|
||||
}
|
Reference in New Issue
Block a user