Added a script automatically generating a virtual view using symbol links of the codebase

So I can finally have some folders for organization
This commit is contained in:
Edward R. Gonzalez 2024-05-12 16:02:38 -04:00
parent 1b32fe916e
commit f693685d72
7 changed files with 81 additions and 6 deletions

View File

@ -19,6 +19,8 @@ indent_size = 4
[*.odin]
indent_style = tab
indent_size = 2
charset = utf-8
[*.{natvis, natstepfilter}]
indent_style = tab

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ build/**
logs
.ark
logs*.zip
code_virtual_view

View File

@ -17,7 +17,8 @@ The host module loads the main module & its memory. Hot-reloading it's dll when
The dependencies are:
* Odin Compiler
* Odin Compiler (Slightly custom)
* Added #region, #endregion directives support for editors
* Odin repo's base, core, and vendor(raylib) libaries
* An ini parser

View File

@ -169,8 +169,8 @@ push-location $path_root
# $build_args += $flag_micro_architecture_native
$build_args += $flag_use_separate_modules
$build_args += $flag_thread_count + $CoreCount_Physical
$build_args += $flag_optimize_none
# $build_args += $flag_optimize_minimal
# $build_args += $flag_optimize_none
$build_args += $flag_optimize_minimal
# $build_args += $flag_optimize_speed
# $build_args += $falg_optimize_aggressive
$build_args += $flag_debug
@ -251,8 +251,8 @@ push-location $path_root
# $build_args += $flag_micro_architecture_native
$build_args += $flag_use_separate_modules
$build_args += $flag_thread_count + $CoreCount_Physical
$build_args += $flag_optimize_none
# $build_args += $flag_optimize_minimal
# $build_args += $flag_optimize_none
$build_args += $flag_optimize_minimal
# $build_args += $flag_optimize_speed
# $build_args += $falg_optimize_aggressive
$build_args += $flag_debug

View File

@ -0,0 +1,61 @@
# Generates a more ergonomic filesystem organization for nagivating the codebase on windows using symbolic links
cls
write-host "Build.ps1"
$incremental_checks = Join-Path $PSScriptRoot 'helpers/incremental_checks.ps1'
. $incremental_checks
write-host 'incremental_checks.ps1 imported'
$ini_parser = join-path $PSScriptRoot 'helpers/ini.ps1'
. $ini_parser
write-host 'ini.ps1 imported'
$path_root = git rev-parse --show-toplevel
$path_code = join-path $path_root 'code'
$path_build = join-path $path_root 'build'
$path_scripts = join-path $path_root 'scripts'
$path_thirdparty = join-path $path_root 'thirdparty'
$path_toolchain = join-path $path_root 'toolchain'
$path_odin = join-path $path_toolchain 'odin'
$path_virtual_view = join-path $path_root 'code_virtual_view'
if (test-path $path_virtual_view) {
Remove-Item -Path $path_virtual_view -Recurse -Force -ErrorAction Ignore
}
New-Item -ItemType Directory -Path $path_virtual_view
$files = Get-ChildItem -Path $path_code -File -Recurse
foreach ($file in $files)
{
# Determine if the file name contains a namespace
$fileName = $file.Name
if ($fileName -match '^(.+?)_(.+)\.odin$')
{
# Extract namespace and actual file name
$namespace = $Matches[1]
$actualFileName = $Matches[2] + ".odin"
# Create a namespace directory in the virtual view if it doesn't exist
$namespaceDir = Join-Path $path_virtual_view $namespace
if (-not (Test-Path $namespaceDir)) {
New-Item -ItemType Directory -Path $namespaceDir
}
# Create a symbolic link in the namespace directory pointing to the original file
$targetFilePath = $file.FullName
$linkPath = Join-Path $namespaceDir $actualFileName
New-Item -ItemType SymbolicLink -Path $linkPath -Value $targetFilePath
}
else
{
# For files without a namespace, create a symbolic link in the root of the original code's path in virtual view
$linkPath = Join-Path $path_virtual_view $fileName
if (-not (Test-Path $linkPath)) {
New-Item -ItemType SymbolicLink -Path $linkPath -Value $file.FullName
}
}
}
Write-Host "Virtual view created successfully."

View File

@ -42,6 +42,11 @@ function Update-GitRepo
write-host "Cloining repo from $url to $path"
git clone $url $path
$path_scripts = join-path $path 'scripts'
push-locaiton $path_scripts
& .\build_and_run_gen_src_pass.ps1
pop-location
write-host "Building $url"
push-location $path
& "$build_command"
@ -66,6 +71,11 @@ function Update-GitRepo
write-host 'Pulling...'
git -C $path pull
$path_scripts = join-path $path 'scripts'
push-location $path_scripts
& .\build_and_run_gen_src_pass.ps1
pop-location
write-host "Building $url"
push-location $path
& $build_command

@ -1 +1 @@
Subproject commit e462116f9428c3a871663eae4363c8d7da35497e
Subproject commit 0d4069d2ea7aaf155b8c5d979fbbc590360314d0