mirror of
https://github.com/Ed94/gencpp.git
synced 2026-01-28 09:51:41 -08:00
corrections to c_library.cpp, package_release.ps1 working for all zips
This commit is contained in:
@@ -246,6 +246,7 @@ if ( $c_library )
|
||||
}
|
||||
Pop-Location
|
||||
|
||||
$includes = @( $path_c_library )
|
||||
$unit = join-path $path_c_library "gen.c"
|
||||
$executable = join-path $path_build "gen_c_library_test.exe"
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ $path_root = Get-ScriptRepoRoot
|
||||
$path_base = Join-Path $path_root base
|
||||
$path_base_build = Join-Path $path_base build
|
||||
$path_c_library = Join-Path $path_root gen_c_library
|
||||
$path_c_library_build = Join-Path $gen_c_library build
|
||||
$path_c_library_gen = Join-Path $gen_c_library gen
|
||||
$path_c_library_build = Join-Path $path_c_library build
|
||||
$path_c_library_gen = Join-Path $path_c_library gen
|
||||
$path_segmented = Join-Path $path_root gen_segmented
|
||||
$path_segmented_build = Join-Path $path_segmented build
|
||||
$path_segmented_gen = Join-Path $path_segmented gen
|
||||
@@ -28,8 +28,11 @@ if ( Test-Path $path_base_build) {
|
||||
if ( Test-Path $path_segmented_build) {
|
||||
Remove-Item $path_segmented_build -Recurse -Verbose
|
||||
}
|
||||
if ( Test-Path $path_c_library_build ) {
|
||||
Remove-Item $path_c_library_build -Recurse -Verbose
|
||||
}
|
||||
if ( Test-Path $path_c_library_gen ) {
|
||||
Remove-Item $path_segmented_gen -Recurse -Verbose
|
||||
Remove-Item $path_c_library_gen -Recurse -Verbose
|
||||
}
|
||||
if ( Test-Path $path_segmented_build) {
|
||||
Remove-Item $path_segmented_build -Recurse -Verbose
|
||||
|
||||
@@ -11,18 +11,18 @@ else {
|
||||
}
|
||||
|
||||
$path_root = Get-ScriptRepoRoot
|
||||
$path_docs = Join-Path $path_root docs
|
||||
$path_base = Join-Path $path_root base
|
||||
$path_c_library = Join-Path $path_root gen_c_library
|
||||
$path_c_library_gen = Join-Path $gen_c_library gen
|
||||
$path_segmented = Join-Path $path_root gen_segmented
|
||||
$path_segmented_gen = Join-Path $path_segmented gen
|
||||
$path_singleheader = Join-Path $path_root gen_singleheader
|
||||
$path_singleheader_gen = Join-Path $path_singleheader gen
|
||||
$path_unreal = Join-Path $path_root gen_unreal_engine
|
||||
$path_unreal_gen = Join-Path $path_unreal gen
|
||||
$path_release = Join-Path $path_root release
|
||||
$path_release_content = Join-Path $path_release content
|
||||
$path_docs = Join-Path $path_root docs
|
||||
$path_base = Join-Path $path_root base
|
||||
$path_c_library = Join-Path $path_root gen_c_library
|
||||
$path_c_library_gen = Join-Path $path_c_library gen
|
||||
$path_segmented = Join-Path $path_root gen_segmented
|
||||
$path_segmented_gen = Join-Path $path_segmented gen
|
||||
$path_singleheader = Join-Path $path_root gen_singleheader
|
||||
$path_singleheader_gen = Join-Path $path_singleheader gen
|
||||
$path_unreal = Join-Path $path_root gen_unreal_engine
|
||||
$path_unreal_gen = Join-Path $path_unreal gen
|
||||
$path_release = Join-Path $path_root release
|
||||
$path_release_content = Join-Path $path_release content
|
||||
|
||||
if ( -not(Test-Path $path_release) ) {
|
||||
New-Item -ItemType Directory -Path $path_release
|
||||
@@ -51,37 +51,40 @@ function prep-ReleaseContent()
|
||||
|
||||
# Singleheader
|
||||
prep-ReleaseContent
|
||||
Copy-Item -Path $path_singleheader\Readme.md -Destination $path_release_content\Readme.md
|
||||
Copy-Item -Path $path_singleheader_gen\gen.hpp -Destination $path_release_content\gen.hpp
|
||||
Copy-Item -Verbose -Path $path_singleheader\Readme.md -Destination $path_release_content
|
||||
Copy-Item -Verbose -Path $path_singleheader_gen\gen.hpp -Destination $path_release_content
|
||||
Compress-Archive -Path $path_release_content\* -DestinationPath $path_release\gencpp_singleheader.zip -Force
|
||||
Remove-Item -Path $path_release_content -Recurse
|
||||
|
||||
# Segmented
|
||||
prep-ReleaseContent
|
||||
Copy-Item -Path $path_segmented\Readme.md -Destination $path_release_content\Readme.md
|
||||
Copy-Item -Path $path_segmented_gen\* -Destination $path_release_content
|
||||
Copy-Item -Verbose -Path $path_segmented\Readme.md -Destination $path_release_content
|
||||
Copy-Item -Verbose -Path $path_segmented_gen\* -Destination $path_release_content
|
||||
Compress-Archive -Path $path_release_content\* -DestinationPath $path_release\gencpp_segmented.zip -Force
|
||||
Remove-Item -Path $path_release_content -Recurse
|
||||
|
||||
# Unreal
|
||||
prep-ReleaseContent
|
||||
Copy-Item -Path $path_unreal\Readme.md -Destination $path_release_content\Readme.md
|
||||
Copy-Item -Path $path_unreal_gen\* -Destination $path_release_content
|
||||
Copy-Item -Verbose -Path $path_unreal\Readme.md -Destination $path_release_content
|
||||
Copy-Item -Verbose -Path $path_unreal_gen\* -Destination $path_release_content
|
||||
Compress-Archive -Path $path_release_content\* -DestinationPath $path_release\gencpp_unreal.zip -Force
|
||||
Remove-Item -Path $path_release_content -Recurse
|
||||
|
||||
# C Library Singleheader
|
||||
prep-ReleaseContent
|
||||
Copy-Item -Path $path_c_library\Readme.md -Destination $path_release_content\Readme.md
|
||||
Copy-Item -Path $path_c_library_gen\gen_singleheader.hpp -Destination $path_release_content\gen.hpp
|
||||
Compress-Archive -Path $path_release_content\* -DestinationPath $path_release\gencpp_c11_singleheader.zip -Force
|
||||
Copy-Item -Verbose -Path $path_c_library\Readme.md -Destination $path_release_content
|
||||
Copy-Item -Verbose -Path $path_c_library_gen\gen_singleheader.h -Destination $path_release_content\gen.h
|
||||
Compress-Archive -Path $path_release_content\* -DestinationPath $path_release\gencpp_c11_singleheader.zip -Force
|
||||
Remove-Item -Path $path_release_content -Recurse
|
||||
|
||||
# C Library Segmented
|
||||
prep-ReleaseContent
|
||||
Copy-Item -Path $path_c_library\Readme.md -Destination $path_release_content\Readme.md
|
||||
Copy-Item -Path $path_unreal_gen\* -Destination $path_release_content
|
||||
Compress-Archive -Path $path_release_content\* -DestinationPath $path_release\gencpp_c11_segmented.zip -Force
|
||||
Copy-Item -Verbose -Path $path_c_library\Readme.md -Destination $path_release_content
|
||||
Copy-Item -Verbose -Path $path_c_library_gen\gen.dep.c -Destination $path_release_content
|
||||
Copy-Item -Verbose -Path $path_c_library_gen\gen.dep.h -Destination $path_release_content
|
||||
Copy-Item -Verbose -Path $path_c_library_gen\gen.c -Destination $path_release_content
|
||||
Copy-Item -Verbose -Path $path_c_library_gen\gen.h -Destination $path_release_content
|
||||
Compress-Archive -Path $path_release_content\* -DestinationPath $path_release\gencpp_c11_segmented.zip -Force
|
||||
Remove-Item -Path $path_release_content -Recurse
|
||||
|
||||
# Base
|
||||
@@ -102,11 +105,11 @@ New-Item -ItemType Directory -Force -Path "$path_release_content\dependencies"
|
||||
New-Item -ItemType Directory -Force -Path "$path_release_content\enums"
|
||||
New-Item -ItemType Directory -Force -Path "$path_release_content\helpers"
|
||||
|
||||
Get-ChildItem -Verbose -Path "$path_project\components\*" -Include *.cpp,*.hpp | Copy-Item -Destination "$path_release_content\components"
|
||||
Get-ChildItem -Verbose -Path "$path_project\components\gen\*" -Include *.cpp,*.hpp | Copy-Item -Destination "$path_release_content\components\gen"
|
||||
Get-ChildItem -Verbose -Path "$path_project\dependencies\*" -Include *.cpp,*.hpp | Copy-Item -Destination "$path_release_content\dependencies"
|
||||
Get-ChildItem -Verbose -Path "$path_project\enums\*" -Include *.csv | Copy-Item -Destination "$path_release_content\enums"
|
||||
Get-ChildItem -Verbose -Path "$path_project\helpers\*" -Include *.cpp,*.hpp | Copy-Item -Destination "$path_release_content\helpers"
|
||||
Get-ChildItem -Verbose -Path "$path_base\components\*" -Include *.cpp,*.hpp | Copy-Item -Verbose -Destination "$path_release_content\components"
|
||||
Get-ChildItem -Verbose -Path "$path_base\components\gen\*" -Include *.cpp,*.hpp | Copy-Item -Verbose -Destination "$path_release_content\components\gen"
|
||||
Get-ChildItem -Verbose -Path "$path_base\dependencies\*" -Include *.cpp,*.hpp | Copy-Item -Verbose -Destination "$path_release_content\dependencies"
|
||||
Get-ChildItem -Verbose -Path "$path_base\enums\*" -Include *.csv | Copy-Item -Verbose -Destination "$path_release_content\enums"
|
||||
Get-ChildItem -Verbose -Path "$path_base\helpers\*" -Include *.cpp,*.hpp | Copy-Item -Verbose -Destination "$path_release_content\helpers"
|
||||
|
||||
Compress-Archive -Path $path_release_content\** -DestinationPath $path_release\gencpp_base.zip -Force
|
||||
Remove-Item -Path $path_release_content -Recurse
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
[string] $format = $false
|
||||
|
||||
foreach ( $arg in $args )
|
||||
{
|
||||
if ( $arg -eq "format" )
|
||||
{
|
||||
$format = $true
|
||||
}
|
||||
}
|
||||
|
||||
[string[]] $include = 'gen.h'
|
||||
[string[]] $exclude
|
||||
|
||||
$path_root = git rev-parse --show-toplevel
|
||||
$path_project = Join-Path $path_root project
|
||||
$path_scripts = Join-Path $path_root scripts
|
||||
$path_helpers = Join-Path $path_scripts helpers
|
||||
$path_c_library = Join-Path $path_root gen_c_library
|
||||
$path_c_library_gen = Join-Path $path_c_library gen
|
||||
|
||||
$file_spec = Join-Path $path_c_library c_library.refactor
|
||||
|
||||
# Gather the files to be formatted.
|
||||
$targetFiles = @()
|
||||
$targetFiles += Get-ChildItem -Recurse -Path $path_c_library_gen -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName
|
||||
# $targetFiles += Get-ChildItem -Recurse -Path $path_project -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName
|
||||
# $targetFiles += Get-ChildItem -Recurse -Path $path_singleheader_comp -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName
|
||||
|
||||
# Format the files.
|
||||
$formatParams = @(
|
||||
'-i' # In-place
|
||||
'-style=file:./.clang-format' # Search for a .clang-format file in the parent directory of the source file.
|
||||
'-verbose'
|
||||
)
|
||||
|
||||
write-host "Beginning refactor...`n"
|
||||
|
||||
Write-Host $targetFiles
|
||||
|
||||
$refactorParams = @(
|
||||
"-debug",
|
||||
"-num=$($targetFiles.Count)"
|
||||
"-src=$($targetFiles)",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
$refactor = join-path $path_helpers refactor.exe
|
||||
write-host "& $refactor $refactorParams"
|
||||
& $refactor $refactorParams
|
||||
|
||||
Write-Host "`nRefactoring complete`n`n"
|
||||
|
||||
if ( $format -eq $true ) {
|
||||
Write-Host "Beginning format...`n"
|
||||
|
||||
& clang-format $formatParams $targetFiles
|
||||
|
||||
Write-Host "`nFormatting complete"
|
||||
}
|
||||
@@ -36,7 +36,7 @@ $formatParams = @(
|
||||
write-host "Beginning refactor...`n"
|
||||
|
||||
$refactorParams = @(
|
||||
"-debug",
|
||||
# "-debug",
|
||||
"-num=$($targetFiles.Count)"
|
||||
"-src=$($targetFiles)",
|
||||
"-spec=$($file_spec)"
|
||||
|
||||
Reference in New Issue
Block a user