Modifiaitons to build script

I only keep the generated code_compiler_staged dir around if there are errors compiling
This commit is contained in:
2024-05-16 13:35:03 -04:00
parent 40ffed9538
commit 0527a033c8
3 changed files with 27 additions and 61 deletions

View File

@ -224,19 +224,19 @@ push-location $path_root
if ( $host_process_active ) {
write-host 'Skipping sectr_host build, process is active'
return
return $true
}
$dependencies_built = $script:sectr_build_code -ne $module_build_failed
if ( -not $dependencies_built ) {
write-host 'Skipping sectr_host build, dependencies failed to build'
return
return $false
}
$should_build = (check-ModuleForChanges $module_host) -or ( $script:sectr_build_code -eq $module_built )
if ( -not( $should_build)) {
write-host 'Skipping sectr_host build, module up to date'
return
return $true
}
if (test-path $pdb) {
@ -273,13 +273,32 @@ push-location $path_root
# $build_args += $flag_sanitize_address
# $build_args += $flag_sanitize_memory
if ( Test-Path $module_dll) {
$module_dll_pre_build_hash = get-filehash -path $module_dll -Algorithm MD5
}
Invoke-WithColorCodedOutput { & $odin_compiler $build_args }
if ( Test-Path $module_dll ) {
$module_dll_post_build_hash = get-filehash -path $module_dll -Algorithm MD5
}
$built = ($module_dll_pre_build_hash -eq $null) -or ($module_dll_pre_build_hash.Hash -ne $module_dll_post_build_hash.Hash)
if ( -not $built ) {
write-host 'Failed to build, marking module dirty'
mark-ModuleDirty $module_sectr
}
return $built
}
build-host
$host_build_code = build-sectr
Pop-Location # path_code
if ( test-path $path_code_compiler_staged ) { Remove-Item -Path $path_code_compiler_staged -Force -Recurse }
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,53 +0,0 @@
# Generates a more ergonomic filesystem organization for nagivating the codebase on windows using symbolic links
cls
write-host "Build.ps1"
$path_root = git rev-parse --show-toplevel
$path_code = join-path $path_root 'code'
$path_scripts = join-path $path_root 'scripts'
$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, maintain the directory structure in the virtual view
$relativePath = $file.FullName.Substring($path_code.Length + 1)
$linkPath = Join-Path $path_virtual_view $relativePath
$linkDir = Split-Path -Parent $linkPath
if (-not (Test-Path $linkDir)) {
New-Item -ItemType Directory -Path $linkDir -Force
}
New-Item -ItemType SymbolicLink -Path $linkPath -Value $file.FullName
}
}
Write-Host "Virtual view created successfully."