Restructured the codebase yet again but this time with compiler support for monlithic packages

So no need to stage generate symbolic links in a flat directory for the compiler
This commit is contained in:
Edward R. Gonzalez 2024-05-16 17:27:15 -04:00
parent 0527a033c8
commit b30f3c3466
75 changed files with 24 additions and 97 deletions

View File

@ -17,8 +17,9 @@ The host module loads the main module & its memory. Hot-reloading it's dll when
The dependencies are:
* Odin Compiler (Slightly custom)
* Odin Compiler (Slightly custom [fork](https://github.com/Ed94/Odin))
* Added #region, #endregion directives support for editors
* I added support for 'monlithic packages' or 'uniform-across-subdirectories packages'. It allows me to organize the main package with sub-directoreis.
* Odin repo's base, core, and vendor(raylib) libaries
* An ini parser
* backtrace

View File

@ -62,7 +62,7 @@ import "core:time"
thread_sleep :: time.sleep
import "core:prof/spall"
import rl "vendor:raylib"
import sectr "../."
import sectr "../sectr"
VArena :: sectr.VArena
varena_init :: sectr.varena_init
fatal :: sectr.fatal

View File

View File

@ -425,15 +425,16 @@ ui_spacer :: proc( label : string ) -> (widget : UI_Widget) {
return
}
// UI_ScrollBox {
// using widget : UI_Widget,
// scroll_bar : UI_Widget,
// content : UI_Widget,
// }
UI_ScrollBox :: struct {
using widget : UI_Widget,
scroll_bar : UI_Widget,
content : UI_Widget,
}
// ui_scroll_box :: proc( label : string ) -> (scroll_box : UI_ScrollBox) {
// }
ui_scroll_box :: proc( label : string, flags : UI_BoxFlags ) -> (scroll_box : UI_ScrollBox) {
fatal("NOT IMPLEMENTED")
return
}
// ui_scrollable_view( )
@ -481,7 +482,10 @@ ui_text_tabs :: proc( label : string, flags : UI_BoxFlags = {} ) -> UI_Widget
return { box, signal }
}
ui_text_wrap_panel :: proc( label : string, flags : UI_BoxFlags = {} )
ui_text_wrap_panel :: proc( parent : ^UI_Widget )
{
fatal("NOT IMPLEMENTED")
}
#endregion("Text")
#region("Vertical Box")

View File

@ -11,7 +11,7 @@
"enable_fake_methods": true,
"enable_format": false,
"enable_hover": true,
"enable_semantic_tokens": false,
"enable_semantic_tokens": true,
"enable_snippets": false,
"enable_references": true,
"thread_pool_count": 10,

View File

@ -117,18 +117,13 @@ push-location $path_root
function build-prototype
{
$gen_staged_compiler_codebase = join-path $PSScriptRoot 'gen_staged_compiler_codebase.ps1'
$path_code_compiler_staged = join-path $path_root 'code_compiler_staged'
. $gen_staged_compiler_codebase
push-location $path_code_compiler_staged
push-location $path_code
$project_name = 'sectr'
write-host "`nBuilding Sectr Prototype`n"
$module_host = join-path $path_code_compiler_staged 'host'
$module_sectr = $path_code_compiler_staged
$module_host = join-path $path_code 'host'
$module_sectr = join-path $path_code 'sectr'
$pkg_collection_thirdparty = 'thirdparty=' + $path_thirdparty
@ -152,8 +147,8 @@ push-location $path_root
}
write-host 'Building Sectr Module'
$module_dll = join-path $path_build ( $project_name + '.dll' )
$pdb = join-path $path_build ( $project_name + '.pdb' )
$script:module_dll = join-path $path_build ( $project_name + '.dll' )
$pdb = join-path $path_build ( $project_name + '.pdb' )
if (test-path $pdb) {
remove-item $pdb
@ -167,7 +162,7 @@ push-location $path_root
$build_args = @()
$build_args += $command_build
$build_args += '.'
$build_args += './sectr'
$build_args += $flag_build_mode_dll
$build_args += $flag_output_path + $module_dll
$build_args += ($flag_collection + $pkg_collection_thirdparty)
@ -290,15 +285,9 @@ push-location $path_root
}
return $built
}
$host_build_code = build-sectr
$host_build_code = build-host
Pop-Location # path_code
if ( test-path $path_code_compiler_staged ) {
if ( ($host_build_code -ne $module_build_failed) -and ($script:sectr_build_code -ne $module_build_failed) ) {
Remove-Item -Path $path_code_compiler_staged -Force -Recurse
}
}
}
build-prototype
pop-location # path_root

View File

@ -1,67 +0,0 @@
cls
Write-Host "Reverse Build.ps1"
$path_root = git rev-parse --show-toplevel
$path_code = Join-Path $path_root 'code'
$path_code_compiler_staged = Join-Path $path_root 'code_compiler_staged'
if (Test-Path $path_code_compiler_staged) {
Remove-Item -Path $path_code_compiler_staged -Recurse -Force -ErrorAction Ignore
}
New-Item -ItemType Directory -Path $path_code_compiler_staged
$whitelist_package = 'sectr'
$files = Get-ChildItem -Path $path_code -File -Recurse
foreach ($file in $files)
{
# Read the file line by line to determine the package name, ignoring comments
$packageName = $null
Get-Content -Path $file.FullName | ForEach-Object {
if ($_ -notmatch '^\s*//')
{
if ($_ -match '^package\s+(\w+)$') {
$packageName = $Matches[1]
return $false
}
}
}
if ($packageName)
{
# Calculate relative path and prepend directory names to the file name
$relativePath = $file.FullName.Substring($path_code.Length + 1)
$relativeDir = Split-Path $relativePath -Parent
$relativeDir = $relativeDir.Replace('\', '_').Replace('/', '_')
if ($relativeDir -ne '') {
$targetFileName = "$relativeDir" + "_" + $file.Name
} else {
$targetFileName = $file.Name
}
# Determine target directory based on the package name
if ($packageName -eq $whitelist_package) {
$targetDir = $path_code_compiler_staged
} else {
$targetDir = Join-Path $path_code_compiler_staged $packageName
if (-not (Test-Path $targetDir)) {
New-Item -ItemType Directory -Path $targetDir
}
}
$targetFilePath = Join-Path $targetDir $targetFileName
# Check if the target file path already exists and handle it accordingly
if (-not (Test-Path $targetFilePath)) {
New-Item -ItemType SymbolicLink -Path $targetFilePath -Value $file.FullName
} else {
Write-Host "Warning: The link for $($file.FullName) already exists at $targetFilePath. Skipping..."
}
}
else {
Write-Host "Warning: The file $($file.FullName) does not contain a valid package declaration."
}
}
Write-Host "Compiler staged directory structure created successfully."