scripts cleanup

This commit is contained in:
Edward R. Gonzalez 2024-06-30 21:53:48 -04:00
parent 331046f590
commit 2423d50407
3 changed files with 1 additions and 96 deletions

View File

@ -141,19 +141,16 @@ push-location $path_root
$path_font = join-path $path_code 'font'
$package_grime = join-path $path_code 'grime'
$package_fstash = join-path $path_font 'fontstash'
$package_VEFontCache = join-path $path_font 'VEFontCache'
$module_host = join-path $path_code 'host'
$module_sectr = join-path $path_code 'sectr'
if ($force){
mark-ModuleDirty $package_fstash
mark-ModuleDirty $package_VEFontCache
mark-ModuleDirty $package_grime
mark-ModuleDirty $module_sectr
mark-ModuleDirty $module_host
}
$pkg_fstash_dirty = check-ModuleForChanges $package_fstash
$pkg_VEFontCache_dirty = check-ModuleForChanges $package_VEFontCache
$pkg_grime_dirty = check-ModuleForChanges $package_grime
@ -173,7 +170,7 @@ push-location $path_root
function build-sectr
{
$should_build = (check-ModuleForChanges $module_sectr) -or $pkg_grime_dirty -or $pkg_fstash_dirty -or $pkg_VEFontCache_dirty
$should_build = (check-ModuleForChanges $module_sectr) -or $pkg_grime_dirty -or $pkg_VEFontCache_dirty
if ( -not( $should_build)) {
write-host 'Skipping sectr build, module up to date'
return $module_unchanged

View File

@ -1,84 +0,0 @@
cls
Write-Host "Reverse Build.ps1"
$ps_misc = join-path $PSScriptRoot 'helpers/misc.ps1'
. $ps_misc
$path_root = git rev-parse --show-toplevel
$path_code = Join-Path $path_root 'code'
$path_code_flattened = Join-Path $path_root 'code_flattened'
if (Test-Path $path_code_flattened) {
Remove-Item -Path $path_code_flattened -Recurse -Force -ErrorAction Ignore
}
New-Item -ItemType Directory -Path $path_code_flattened
# $whitelist_package = 'sectr'
function get-flattened-package
{
param(
[string]$pkg_name,
[string]$path_pkg_dir,
[string]$path_flattend_dir
)
$files = Get-ChildItem -Path $path_pkg_dir -File -Recurse
foreach ($file in $files)
{
if ($file.Name -eq '.ODIN_MONOLITHIC_PACKAGE') {
continue
}
# Read the file line by line to determine the package name, ignoring comments
$package_name = $null
Get-Content -Path $file.FullName | ForEach-Object {
if ($_ -notmatch '^\s*//')
{
if ($_ -match '^package\s+(\w+)$') {
$package_name = $Matches[1]
return $false
}
}
}
if ($pacakge_name -ne $pkg_name) {
Write-Host "Warning: The file $($file.FullName) does not contain a valid package declaration."
}
# Calculate relative path and prepend directory names to the file name
$relative_path = $file.FullName.Substring($path_pkg_dir.Length + 1)
$relative_dir = Split-Path $relative_path -Parent
$relative_dir = $relative_dir.Replace('\', '_').Replace('/', '_')
if ($relative_dir -ne '') {
$target_file_name = "$relative_dir" + "_" + $file.Name
} else {
$target_file_name = $file.Name
}
$target_file_path = Join-Path $path_flattend_dir $target_file_name
if (-not (Test-Path $target_file_path))
{ New-Item -ItemType SymbolicLink -Path $target_file_path -Value $file.FullName }
else
{ Write-Host "Warning: The link for $($file.FullName) already exists at $target_file_path. Skipping..." }
}
}
$path_pkg_gen = join-path $path_code 'gen'
$path_pkg_host = join-path $path_code 'host'
$path_pkg_sectr = join-path $path_code 'sectr'
$path_flattend_gen = join-path $path_code_flattened 'gen'
$path_flattend_host = join-path $path_code_flattened 'host'
$path_flattend_sectr = join-path $path_code_flattened 'sectr'
verify-path $path_flattend_gen
verify-path $path_flattend_host
verify-path $path_flattend_sectr
get-flattened-package 'gen' $path_pkg_gen $path_flattend_gen
get-flattened-package 'host' $path_pkg_host $path_flattend_host
get-flattened-package 'sectr' $path_pkg_sectr $path_flattend_sectr
Write-Host "Flattened directory structure for packages created successfully."

View File

@ -1,8 +0,0 @@
set-alias -Name 'build' -Value '.\build.ps1'
set-alias -Name 'buildclean' -Value '.\clean.ps1'
$path_root = git rev-parse --show-toplevel
$path_thirdparty = join-path $path_root 'thirdparty'
$path_odin = join-path $path_thirdparty 'Odin'
$env:odin = $path_odin