mirror of
https://github.com/Ed94/refactor.git
synced 2024-12-21 22:44:45 -08:00
Script additions and improvements, fix IO bug.
This commit is contained in:
parent
1b0c5d176c
commit
6e91555a20
@ -50,7 +50,7 @@ namespace IO
|
||||
|
||||
zpl_file_close( & src );
|
||||
}
|
||||
while ( path++, left--, left > 1 );
|
||||
while ( path++, left--, left > 0 );
|
||||
|
||||
uw persist_size = Largest_Src_Size * 2 + 8;
|
||||
|
||||
|
@ -29,7 +29,10 @@ if ( -not( Test-Path $path_build ) )
|
||||
$args_meson += "setup"
|
||||
$args_meson += $path_build
|
||||
|
||||
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
||||
# Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
||||
Push-Location $path_scripts
|
||||
& meson $args_meson
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
if ( $type )
|
||||
@ -39,14 +42,19 @@ if ( $type )
|
||||
$args_meson += $path_build
|
||||
$args_meson += "--buildtype $($type)"
|
||||
|
||||
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
||||
# Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
||||
Push-Location $path_scripts
|
||||
meson $args_meson
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
$args_ninja = @()
|
||||
$args_ninja += "-C"
|
||||
$args_ninja += $path_build
|
||||
|
||||
Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_root
|
||||
Push-Location $path_root
|
||||
ninja $args_ninja
|
||||
Pop-Location
|
||||
#endregion Regular Build
|
||||
|
||||
|
||||
@ -56,7 +64,8 @@ if ( $test -eq $true )
|
||||
write-host "`n`nBuilding Test`n"
|
||||
|
||||
# Refactor thirdparty libraries
|
||||
& (Join-Path $PSScriptRoot 'refactor_and_format.ps1')
|
||||
Invoke-Expression "& $(Join-Path $PSScriptRoot 'refactor_and_format.ps1') $args"
|
||||
|
||||
|
||||
$path_test = Join-Path $path_root test
|
||||
$path_test_build = Join-Path $path_test build
|
||||
@ -67,15 +76,17 @@ if ( $test -eq $true )
|
||||
$args_meson += "setup"
|
||||
$args_meson += $path_test_build
|
||||
|
||||
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_test
|
||||
Push-Location $path_test
|
||||
& meson $args_meson
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
$args_ninja = @()
|
||||
$args_ninja += "-C"
|
||||
$args_ninja += $path_test_build
|
||||
|
||||
write-host $args_ninja
|
||||
|
||||
Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_root
|
||||
Push-Location $path_root
|
||||
ninja $args_ninja
|
||||
Pop-Location
|
||||
#endregion Test Build
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
cls
|
||||
& (Join-Path $PSScriptRoot 'build.ci.ps1')
|
||||
Invoke-Expression "& $(Join-Path $PSScriptRoot 'build.ci.ps1') $args"
|
||||
|
@ -25,48 +25,43 @@ foreach ( $file in $targetFiles )
|
||||
}
|
||||
|
||||
|
||||
write-host "Beginning thirdpary refactor...`n"
|
||||
write-host "Beginning thirdpary refactor..."
|
||||
|
||||
$refactors = @(@())
|
||||
|
||||
if ( $false ){
|
||||
foreach ( $file in $targetFiles )
|
||||
if ( $args.Contains( "debug" ) )
|
||||
{
|
||||
$destination = Join-Path $path_test (Split-Path $file -leaf)
|
||||
$destination = $destination.Replace( '.h', '.refactored.h' )
|
||||
$refactorParams += "-debug"
|
||||
}
|
||||
|
||||
$refactorParams = @(
|
||||
"-src=$($file)",
|
||||
"-dst=$($destination)"
|
||||
"-src=$(Join-Path $path_thirdparty "zpl.h")",
|
||||
"-dst=$(Join-Path $path_test "zpl.refactored.h")",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
$refactors += (Start-Process $refactor $refactorParams -NoNewWindow -PassThru)
|
||||
& $refactor $refactorParams
|
||||
|
||||
$refactors = @(@())
|
||||
$file_spec = Join-Path $path_test "stb_image.refactor"
|
||||
|
||||
if ( $args.Contains( "debug" ) )
|
||||
{
|
||||
$refactorParams += "-debug"
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
$refactorParams = @(
|
||||
# "-debug",
|
||||
"-num=$($targetFiles.Count)"
|
||||
"-src=$($targetFiles)",
|
||||
"-dst=$($refactoredFiles)",
|
||||
"-src=$(Join-Path $path_thirdparty "stb_image.h")",
|
||||
"-dst=$(Join-Path $path_test "stb_image.refactored.h")",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
Start-Process $refactor $refactorParams -NoNewWindow -PassThru -Wait
|
||||
}
|
||||
& $refactor $refactorParams
|
||||
|
||||
foreach ( $process in $refactors )
|
||||
{
|
||||
if ( $process )
|
||||
{
|
||||
$process.WaitForExit()
|
||||
}
|
||||
}
|
||||
Write-Host "`nRefactoring complete`n"
|
||||
|
||||
Write-Host "`nRefactoring complete`n`n"
|
||||
|
||||
write-host "Beginning project refactor...`n"
|
||||
write-host "Beginning project refactor..."
|
||||
|
||||
# Gather the files to be formatted.
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
@ -74,8 +69,6 @@ $refactoredFiles = @()
|
||||
|
||||
$file_spec = Join-Path $path_test project.refactor
|
||||
|
||||
write-host "FILE SPEC:" $file_spec
|
||||
|
||||
foreach ( $file in $targetFiles )
|
||||
{
|
||||
$destination = Join-Path $path_test (Split-Path $file -leaf)
|
||||
@ -86,16 +79,20 @@ foreach ( $file in $targetFiles )
|
||||
}
|
||||
|
||||
$refactorParams = @(
|
||||
# "-debug",
|
||||
"-num=$($targetFiles.Count)"
|
||||
"-src=$($targetFiles)",
|
||||
"-dst=$($refactoredFiles)",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
Start-Process $refactor $refactorParams -NoNewWindow -PassThru -Wait
|
||||
if ( $args.Contains( "debug" ) )
|
||||
{
|
||||
$refactorParams += "-debug"
|
||||
}
|
||||
|
||||
write-host "`nRefactoring complete`n`n"
|
||||
& $refactor $refactorParams
|
||||
|
||||
write-host "`nRefactoring complete`n"
|
||||
|
||||
|
||||
# Can't format zpl library... (It hangs clang format)
|
||||
@ -115,3 +112,4 @@ clang-format $formatParams $targetFiles
|
||||
|
||||
Write-Host "`nFormatting complete"
|
||||
}
|
||||
|
||||
|
38
scripts/template_reafactor.ps1
Normal file
38
scripts/template_reafactor.ps1
Normal file
@ -0,0 +1,38 @@
|
||||
[string[]] $include = '*.h', '*.hh', '*.hpp', '*.c', '*.cc', '*.cpp'
|
||||
[string[]] $exclude = '*.g.*', '*.refactor'
|
||||
|
||||
# Change this to your root directory if needed.
|
||||
$path_root = $PSScriptRoot
|
||||
|
||||
# Change this to your desired destination
|
||||
$path_dest = $path_root
|
||||
|
||||
# Gather the files to be formatted.
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_root -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
$refactoredFiles = @()
|
||||
|
||||
foreach ( $file in $targetFiles )
|
||||
{
|
||||
$destination = Join-Path $path_dest (Split-Path $file -leaf)
|
||||
$destination = $destination.Replace( '.h', '.refactored.h' )
|
||||
$destination = $destination.Replace( '.c', '.refactored.c' )
|
||||
|
||||
$refactoredFiles += $destination
|
||||
}
|
||||
|
||||
|
||||
write-host "Beginning refactor...`n"
|
||||
|
||||
$refactors = @(@())
|
||||
|
||||
$refactorParams = @(
|
||||
# "-debug",
|
||||
"-num=$($targetFiles.Count)"
|
||||
"-src=$($targetFiles)",
|
||||
"-dst=$($refactoredFiles)",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
& $refactor $refactorParams
|
||||
|
||||
Write-Host "`nRefactoring complete`n`n"
|
Loading…
Reference in New Issue
Block a user