mirror of
https://github.com/Ed94/refactor.git
synced 2025-06-16 19:51:49 -07:00
Setup new test and sucessfuly compiles!
This commit is contained in:
@ -51,7 +51,7 @@ Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_root
|
||||
#endregion Regular Build
|
||||
|
||||
|
||||
if ( $test -eq $true -and (Test-Path $path_build) )
|
||||
if ( $test -eq $true )
|
||||
{
|
||||
#region Test Build
|
||||
write-host "`n`nBuilding Test`n"
|
||||
@ -68,12 +68,12 @@ if ( $test -eq $true -and (Test-Path $path_build) )
|
||||
$args_meson += "setup"
|
||||
$args_meson += $path_test_build
|
||||
|
||||
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
||||
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_test
|
||||
}
|
||||
|
||||
$args_ninja = @()
|
||||
$args_ninja += "-C"
|
||||
$args_ninja += $path_build
|
||||
$args_ninja += $path_test_build
|
||||
|
||||
Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_test
|
||||
#endregion Test Build
|
||||
|
@ -12,3 +12,10 @@ if ( Test-Path $path_test_build )
|
||||
{
|
||||
Remove-Item $path_test_build -Recurse
|
||||
}
|
||||
|
||||
[string[]] $include = '*.h', '*.hpp', '*.cpp'
|
||||
[string[]] $exclude =
|
||||
|
||||
$files = Get-ChildItem -Recurse -Path $path_test -Include $include -Exclude $exclude
|
||||
|
||||
Remove-Item $files
|
||||
|
@ -1,5 +1,5 @@
|
||||
[string[]] $include = 'refactor.cpp' #'*.c', '*.cc', '*.cpp'
|
||||
# [stirng[]] $exclude =
|
||||
# [string[]] $exclude =
|
||||
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_proj = Join-Path $path_root project
|
||||
|
@ -1,4 +1,4 @@
|
||||
project( 'refactor', 'c', 'cpp', default_options : ['buildtype=debug'] )
|
||||
project( 'refactor', 'c', 'cpp', default_options : ['buildtype=release'] )
|
||||
|
||||
# add_global_arguments('-E', language : 'cpp')
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
[string[]] $include = '*.h', '*.hh', '*.hpp', '*.c', '*.cc', '*.cpp'
|
||||
[string[]] $exclude = '*.g.*', '*.refactor', 'bloat.refactored.hpp', 'refactor.refactored.cpp'
|
||||
[string[]] $exclude = '*.g.*', '*.refactor'
|
||||
|
||||
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_build = Join-Path $path_root build
|
||||
$path_project = Join-Path $path_root project
|
||||
$path_test = Join-Path $path_root test
|
||||
$path_thirdparty = Join-Path $path_root thirdparty
|
||||
|
||||
@ -11,27 +12,48 @@ $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)
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_thirdparty -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
$refactoredFiles = @()
|
||||
|
||||
|
||||
write-host "Beginning refactor...`n"
|
||||
|
||||
$refactors = @(@())
|
||||
|
||||
# TODO: Change this to support refactoring the other files in the project directory.
|
||||
# It needs two runs, one for the regular files, one for the zpl header.
|
||||
foreach ( $file in $targetFiles )
|
||||
{
|
||||
$destination = Join-Path $path_test (Split-Path $file -leaf)
|
||||
$destination = $destination.Replace( '.h', '.refactored.h' )
|
||||
|
||||
$destination = $destination.Replace( '.c', '.refactored.c' )
|
||||
|
||||
$refactoredFiles += $destination
|
||||
}
|
||||
|
||||
|
||||
write-host "Beginning thirdpary refactor...`n"
|
||||
|
||||
$refactors = @(@())
|
||||
|
||||
if ( $false ){
|
||||
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)
|
||||
}
|
||||
}
|
||||
else {
|
||||
$refactorParams = @(
|
||||
"-src=$($file)",
|
||||
"-dst=$($destination)"
|
||||
"-debug",
|
||||
"-num=$($targetFiles.Count)"
|
||||
"-src=$($targetFiles)",
|
||||
"-dst=$($refactoredFiles)",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
$refactors += (Start-Process $refactor $refactorParams -NoNewWindow -PassThru)
|
||||
Start-Process $refactor $refactorParams -NoNewWindow -PassThru -Wait
|
||||
}
|
||||
|
||||
foreach ( $process in $refactors )
|
||||
@ -44,10 +66,40 @@ foreach ( $process in $refactors )
|
||||
|
||||
Write-Host "`nRefactoring complete`n`n"
|
||||
|
||||
write-host "Beginning project refactor...`n"
|
||||
|
||||
# Gather the files to be formatted.
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
$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)
|
||||
$destination = $destination.Replace( '.hpp', '.refactored.hpp' )
|
||||
$destination = $destination.Replace( '.cpp', '.refactored.cpp' )
|
||||
|
||||
$refactoredFiles += $destination
|
||||
}
|
||||
|
||||
$refactorParams = @(
|
||||
"-debug",
|
||||
"-num=$($targetFiles.Count)"
|
||||
"-src=$($targetFiles)",
|
||||
"-dst=$($refactoredFiles)",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
Start-Process $refactor $refactorParams -NoNewWindow -PassThru -Wait
|
||||
|
||||
write-host "`nRefactoring complete`n`n"
|
||||
|
||||
|
||||
# Can't format zpl library... (It hangs clang format)
|
||||
if ( $false )
|
||||
{
|
||||
if ( $false ) {
|
||||
Write-Host "Beginning format...`n"
|
||||
|
||||
# Format the files.
|
||||
|
Reference in New Issue
Block a user