From f116f0250330a2e32a8d32af43c0484986384679 Mon Sep 17 00:00:00 2001 From: Edward Gonzalez Date: Thu, 6 Aug 2026 14:18:09 -0400 Subject: [PATCH] Starter stuff --- .editorconfig | 42 +++++++++++++++++++++++++ .gitignore | 0 scripts/build.ps1 | 12 +++++++ scripts/helpers/misc.ps1 | 67 ++++++++++++++++++++++++++++++++++++++++ scripts/update_deps.ps1 | 0 5 files changed, 121 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 scripts/build.ps1 create mode 100644 scripts/helpers/misc.ps1 create mode 100644 scripts/update_deps.ps1 diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e7a1882 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,42 @@ +root = true + +[*.s] +indent_style = tab +indent_size = 2 + +[*.asm] +indent_style = tab +indent_size = 2 + +[*.refactor] +indent_style = space +indent_size = 4 + +[*.md] +indent_style = space +indent_size = 4 + +[*.h] +indent_style = tab +indent_size = 2 + +[*.c] +indent_style = tab +indent_size = 2 + +[*.{ps1, psm1}] +indent_style = tab +indent_size = 4 + +[*.odin] +indent_style = tab +indent_size = 2 +charset = utf-8 + +[*.{natvis, natstepfilter}] +indent_style = tab +indent_size = 4 + +[*.lua] +indent_style = tab +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/scripts/build.ps1 b/scripts/build.ps1 new file mode 100644 index 0000000..4371d82 --- /dev/null +++ b/scripts/build.ps1 @@ -0,0 +1,12 @@ +$path_root = split-path -Path $PSScriptRoot -Parent +$path_build = join-path $path_root 'build' +$path_part_1 = join-path $path_root 'part_1' +$path_scripts = join-path $path_root 'scripts' +$path_toolchain = join-path $path_root 'toolchain' + +if ((test-path $path_build) -eq $false) { + new-item -itemtype directory -path $path_build +} + + + diff --git a/scripts/helpers/misc.ps1 b/scripts/helpers/misc.ps1 new file mode 100644 index 0000000..51fa476 --- /dev/null +++ b/scripts/helpers/misc.ps1 @@ -0,0 +1,67 @@ +function clone-gitrepo { param( [string] $path, [string] $url ) + if (test-path $path) { + # git -C $path pull + } + else { + Write-Host "Cloning $url ..." + git clone --recursive $url $path + } +} + +function Update-GitRepo +{ + param( [string] $path, [string] $url, [string] $build_command ) + + if ( $build_command -eq $null ) { + write-host "Attempted to call Update-GitRepo without build_command specified" + return + } + + $repo_name = $url.Split('/')[-1].Replace('.git', '') + + $last_built_commit = join-path $path_build "last_built_commit_$repo_name.txt" + if ( -not(test-path -Path $path)) + { + write-host "Cloining repo from $url to $path" + git clone $url $path + + write-host "Building $url" + push-location $path + & "$build_command" + pop-location + + git -C $path rev-parse HEAD | out-file $last_built_commit + $script:binaries_dirty = $true + write-host + return + } + + git -C $path fetch + $latest_commit_hash = git -C $path rev-parse '@{u}' + $last_built_hash = if (Test-Path $last_built_commit) { Get-Content $last_built_commit } else { "" } + + if ( $latest_commit_hash -eq $last_built_hash ) { + write-host + return + } + + write-host "Build out of date for: $path, updating" + write-host 'Pulling...' + git -C $path pull + + write-host "Building $url" + push-location $path + & $build_command + pop-location + + $latest_commit_hash | out-file $last_built_commit + $script:binaries_dirty = $true + write-host +} + +function verify-path { param( $path ) + if (test-path $path) {return $true} + + new-item -ItemType Directory -Path $path + return $false +} diff --git a/scripts/update_deps.ps1 b/scripts/update_deps.ps1 new file mode 100644 index 0000000..e69de29