forked from Hyperion/HyperionOS
moved stuff to src/ from test/ and made better build scripts
This commit is contained in:
44
tools/build.ps1
Normal file
44
tools/build.ps1
Normal file
@@ -0,0 +1,44 @@
|
||||
$testRoot = Join-Path $PSScriptRoot "..\src"
|
||||
$buildRoot = Join-Path $PSScriptRoot "..\Build"
|
||||
|
||||
$testRoot = Resolve-Path $testRoot
|
||||
|
||||
# Clean Build folder
|
||||
if (Test-Path $buildRoot) {
|
||||
Remove-Item -LiteralPath $buildRoot -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $buildRoot | Out-Null
|
||||
|
||||
Write-Host "Building from $testRoot"
|
||||
Write-Host "Output to $buildRoot"
|
||||
Write-Host ""
|
||||
|
||||
# Each top-level folder in test/
|
||||
Get-ChildItem -Path $testRoot -Directory | ForEach-Object {
|
||||
|
||||
$folderRoot = $_.FullName
|
||||
Write-Host "== Package: $($_.Name) =="
|
||||
|
||||
# Walk files inside this folder
|
||||
Get-ChildItem -Path $folderRoot -File -Recurse | ForEach-Object {
|
||||
|
||||
$src = $_.FullName
|
||||
$rel = $src.Substring($folderRoot.Length).TrimStart("\")
|
||||
$dst = Join-Path $buildRoot $rel
|
||||
$dstDir = Split-Path $dst
|
||||
|
||||
if (-not (Test-Path $dstDir)) {
|
||||
New-Item -ItemType Directory -Path $dstDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Processing: $rel"
|
||||
Write-Host " > Copying"
|
||||
Copy-Item -LiteralPath $src -Destination $dst -Force
|
||||
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "Build complete."
|
||||
57
tools/buildMini.ps1
Normal file
57
tools/buildMini.ps1
Normal file
@@ -0,0 +1,57 @@
|
||||
$testRoot = Join-Path $PSScriptRoot "..\src"
|
||||
$buildRoot = Join-Path $PSScriptRoot "..\Build"
|
||||
|
||||
$testRoot = Resolve-Path $testRoot
|
||||
|
||||
# Clean Build folder
|
||||
if (Test-Path $buildRoot) {
|
||||
Remove-Item -LiteralPath $buildRoot -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $buildRoot | Out-Null
|
||||
|
||||
Write-Host "Building from $testRoot"
|
||||
Write-Host "Output to $buildRoot"
|
||||
Write-Host ""
|
||||
|
||||
# Each top-level folder in test/
|
||||
Get-ChildItem -Path $testRoot -Directory | ForEach-Object {
|
||||
|
||||
$folderRoot = $_.FullName
|
||||
Write-Host "== Package: $($_.Name) =="
|
||||
|
||||
# Walk files inside this folder
|
||||
Get-ChildItem -Path $folderRoot -File -Recurse | ForEach-Object {
|
||||
|
||||
$src = $_.FullName
|
||||
$rel = $src.Substring($folderRoot.Length).TrimStart("\")
|
||||
$dst = Join-Path $buildRoot $rel
|
||||
$dstDir = Split-Path $dst
|
||||
|
||||
if (-not (Test-Path $dstDir)) {
|
||||
New-Item -ItemType Directory -Path $dstDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Processing: $rel"
|
||||
|
||||
# Read first 3 lines
|
||||
$header = Get-Content $src -TotalCount 3 -ErrorAction SilentlyContinue
|
||||
|
||||
if ($header -match "--:Minify:--") {
|
||||
Write-Host " > Minifying"
|
||||
$content = luamin -f "$src"
|
||||
|
||||
# UTF8 encoding without BOM because it breaks lua
|
||||
$utf8NoBOM = New-Object System.Text.UTF8Encoding($false)
|
||||
[System.IO.File]::WriteAllText($dst, $content, $utf8NoBOM)
|
||||
}
|
||||
else {
|
||||
Write-Host " > Copying"
|
||||
Copy-Item -LiteralPath $src -Destination $dst -Force
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "Build complete."
|
||||
108
tools/buildMiniTest.ps1
Normal file
108
tools/buildMiniTest.ps1
Normal file
@@ -0,0 +1,108 @@
|
||||
$testRoot = Join-Path $PSScriptRoot "..\src"
|
||||
$buildRoot = Join-Path $PSScriptRoot "..\Build"
|
||||
|
||||
$testRoot = Resolve-Path $testRoot
|
||||
|
||||
# Clean Build folder
|
||||
if (Test-Path $buildRoot) {
|
||||
Remove-Item -LiteralPath $buildRoot -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $buildRoot | Out-Null
|
||||
|
||||
Write-Host "Building from $testRoot"
|
||||
Write-Host "Output to $buildRoot"
|
||||
Write-Host ""
|
||||
|
||||
# Each top-level folder in test/
|
||||
Get-ChildItem -Path $testRoot -Directory | ForEach-Object {
|
||||
|
||||
$folderRoot = $_.FullName
|
||||
Write-Host "== Package: $($_.Name) =="
|
||||
|
||||
# Walk files inside this folder
|
||||
Get-ChildItem -Path $folderRoot -File -Recurse | ForEach-Object {
|
||||
|
||||
$src = $_.FullName
|
||||
$rel = $src.Substring($folderRoot.Length).TrimStart("\")
|
||||
$dst = Join-Path $buildRoot $rel
|
||||
$dstDir = Split-Path $dst
|
||||
|
||||
if (-not (Test-Path $dstDir)) {
|
||||
New-Item -ItemType Directory -Path $dstDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Processing: $rel"
|
||||
|
||||
# Read first 3 lines
|
||||
$header = Get-Content $src -TotalCount 3 -ErrorAction SilentlyContinue
|
||||
|
||||
if ($header -match "--:Minify:--") {
|
||||
Write-Host " > Minifying"
|
||||
$content = luamin -f "$src"
|
||||
|
||||
# UTF8 encoding without BOM because it breaks lua
|
||||
$utf8NoBOM = New-Object System.Text.UTF8Encoding($false)
|
||||
[System.IO.File]::WriteAllText($dst, $content, $utf8NoBOM)
|
||||
}
|
||||
else {
|
||||
Write-Host " > Copying"
|
||||
Copy-Item -LiteralPath $src -Destination $dst -Force
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "Build complete."
|
||||
|
||||
$testRoot = Join-Path $PSScriptRoot "..\test"
|
||||
$buildRoot = Join-Path $PSScriptRoot "..\Build"
|
||||
|
||||
$testRoot = Resolve-Path $testRoot
|
||||
|
||||
Write-Host "Building from $testRoot"
|
||||
Write-Host "Output to $buildRoot"
|
||||
Write-Host ""
|
||||
|
||||
# Each top-level folder in test/
|
||||
Get-ChildItem -Path $testRoot -Directory | ForEach-Object {
|
||||
|
||||
$folderRoot = $_.FullName
|
||||
Write-Host "== Package: $($_.Name) =="
|
||||
|
||||
# Walk files inside this folder
|
||||
Get-ChildItem -Path $folderRoot -File -Recurse | ForEach-Object {
|
||||
|
||||
$src = $_.FullName
|
||||
$rel = $src.Substring($folderRoot.Length).TrimStart("\")
|
||||
$dst = Join-Path $buildRoot $rel
|
||||
$dstDir = Split-Path $dst
|
||||
|
||||
if (-not (Test-Path $dstDir)) {
|
||||
New-Item -ItemType Directory -Path $dstDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Processing: $rel"
|
||||
|
||||
# Read first 3 lines
|
||||
$header = Get-Content $src -TotalCount 3 -ErrorAction SilentlyContinue
|
||||
|
||||
if ($header -match "--:Minify:--") {
|
||||
Write-Host " > Minifying"
|
||||
$content = luamin -f "$src"
|
||||
|
||||
# UTF8 encoding without BOM because it breaks lua
|
||||
$utf8NoBOM = New-Object System.Text.UTF8Encoding($false)
|
||||
[System.IO.File]::WriteAllText($dst, $content, $utf8NoBOM)
|
||||
}
|
||||
else {
|
||||
Write-Host " > Copying"
|
||||
Copy-Item -LiteralPath $src -Destination $dst -Force
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "Build complete."
|
||||
83
tools/buildTest.ps1
Normal file
83
tools/buildTest.ps1
Normal file
@@ -0,0 +1,83 @@
|
||||
$testRoot = Join-Path $PSScriptRoot "..\src"
|
||||
$buildRoot = Join-Path $PSScriptRoot "..\Build"
|
||||
|
||||
$testRoot = Resolve-Path $testRoot
|
||||
|
||||
# Clean Build folder
|
||||
if (Test-Path $buildRoot) {
|
||||
Remove-Item -LiteralPath $buildRoot -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $buildRoot | Out-Null
|
||||
|
||||
Write-Host "Building from $testRoot"
|
||||
Write-Host "Output to $buildRoot"
|
||||
Write-Host ""
|
||||
|
||||
# Each top-level folder in test/
|
||||
Get-ChildItem -Path $testRoot -Directory | ForEach-Object {
|
||||
|
||||
$folderRoot = $_.FullName
|
||||
Write-Host "== Package: $($_.Name) =="
|
||||
|
||||
# Walk files inside this folder
|
||||
Get-ChildItem -Path $folderRoot -File -Recurse | ForEach-Object {
|
||||
|
||||
$src = $_.FullName
|
||||
$rel = $src.Substring($folderRoot.Length).TrimStart("\")
|
||||
$dst = Join-Path $buildRoot $rel
|
||||
$dstDir = Split-Path $dst
|
||||
|
||||
if (-not (Test-Path $dstDir)) {
|
||||
New-Item -ItemType Directory -Path $dstDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Processing: $rel"
|
||||
Write-Host " > Copying"
|
||||
Copy-Item -LiteralPath $src -Destination $dst -Force
|
||||
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "Build complete."
|
||||
|
||||
|
||||
$testRoot = Join-Path $PSScriptRoot "..\test"
|
||||
$buildRoot = Join-Path $PSScriptRoot "..\Build"
|
||||
|
||||
$testRoot = Resolve-Path $testRoot
|
||||
|
||||
Write-Host "Building from $testRoot"
|
||||
Write-Host "Output to $buildRoot"
|
||||
Write-Host ""
|
||||
|
||||
# Each top-level folder in test/
|
||||
Get-ChildItem -Path $testRoot -Directory | ForEach-Object {
|
||||
|
||||
$folderRoot = $_.FullName
|
||||
Write-Host "== Package: $($_.Name) =="
|
||||
|
||||
# Walk files inside this folder
|
||||
Get-ChildItem -Path $folderRoot -File -Recurse | ForEach-Object {
|
||||
|
||||
$src = $_.FullName
|
||||
$rel = $src.Substring($folderRoot.Length).TrimStart("\")
|
||||
$dst = Join-Path $buildRoot $rel
|
||||
$dstDir = Split-Path $dst
|
||||
|
||||
if (-not (Test-Path $dstDir)) {
|
||||
New-Item -ItemType Directory -Path $dstDir -Force | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Processing: $rel"
|
||||
|
||||
Write-Host " > Copying"
|
||||
Copy-Item -LiteralPath $src -Destination $dst -Force
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
Write-Host "Build complete."
|
||||
@@ -1,47 +0,0 @@
|
||||
-- tar_list.lua
|
||||
-- List all paths stored in a TAR file (no extraction)
|
||||
|
||||
local function octal_to_number(str)
|
||||
str = str:gsub("%z", ""):match("^%s*(.-)%s*$")
|
||||
return tonumber(str, 8) or 0
|
||||
end
|
||||
|
||||
local file = ({...})[1]
|
||||
if not file then
|
||||
print("Usage: tar_list <tarfile>")
|
||||
return
|
||||
end
|
||||
|
||||
local f = fs.open(file, "r")
|
||||
local tar = f.readAll()
|
||||
f.close()
|
||||
|
||||
local i = 1
|
||||
local len = #tar
|
||||
|
||||
while i + 512 <= len do
|
||||
local header = tar:sub(i, i + 511)
|
||||
|
||||
if header:match("^\0+$") then break end
|
||||
|
||||
-- Extract raw name & prefix
|
||||
local name = header:sub(1, 100):gsub("%z.*","")
|
||||
local prefix = header:sub(346, 500):gsub("%z.*","")
|
||||
|
||||
local size = octal_to_number(header:sub(125, 136))
|
||||
i = i + 512
|
||||
|
||||
-- Skip file contents
|
||||
local pad = (512 - (size % 512)) % 512
|
||||
i = i + size + pad
|
||||
|
||||
local full
|
||||
if prefix ~= "" then
|
||||
full = prefix .. "/" .. name
|
||||
else
|
||||
full = name
|
||||
end
|
||||
|
||||
-- Print exactly what Windows Explorer stored
|
||||
print(full)
|
||||
end
|
||||
Reference in New Issue
Block a user