From 9f280f3daadaa70a35c5a143442793854bd6d452 Mon Sep 17 00:00:00 2001 From: Corey Ryan Dean Date: Thu, 14 May 2026 09:06:59 -0500 Subject: [PATCH] align(release): ship the archives publish already promises --- ReadMe.md | 4 ++-- publish.bat | 16 ++++++++++++++++ publish.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 2adb57e..f8d750c 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -138,10 +138,10 @@ cd blitz-forge ./scripts/bootstrap_macos.sh # one-time: installs cmake/ninja/llvm and runtime deps via Homebrew ./compile.sh # builds bin/blitzcc, bin/runtime.dylib, bin/linker.dylib ./test.sh # runs tests/*.bb against -target macos-arm64 -./publish.sh # produce a redistributable archive +./publish.sh # stage release/ and write release/blitzforge-macos-arm64.zip ``` -Build artifacts land in [`bin/`](bin) and a redistributable archive in `release/`. +Build artifacts land in [`bin/`](bin), a staged [`release/`](release) directory, and a redistributable ZIP archive such as `release/blitzforge-macos-arm64.zip` or `release/blitzforge-windows-x64.zip`. The compiler accepts an explicit `-target` flag (`host`, `windows-x86`, or `macos-arm64`). On macOS hosts, `host` and `macos-arm64` are equivalent; cross-compiling to a foreign target is rejected up-front rather than producing a broken artifact. Until a native macOS runtime is wired up, `./test.sh` validates the full compile/translate/assemble pipeline and explicitly **skips** the in-process execution smoke with a clear "alpha stub runtime" notice — so a stub runtime can never be silently mistaken for a working one. diff --git a/publish.bat b/publish.bat index 16f269c..f36a76b 100644 --- a/publish.bat +++ b/publish.bat @@ -2,6 +2,8 @@ setlocal for %%I in ("%~dp0.") do set "ROOTDIR=%%~fI" +set "ARCHIVE_BASENAME=blitzforge-windows-x64" +set "ARCHIVE_PATH=%ROOTDIR%\release\%ARCHIVE_BASENAME%.zip" call "%ROOTDIR%\compile.bat" @@ -33,4 +35,18 @@ if exist "%ROOTDIR%\..\..\extras\vscode-blitz-forge" ( REM Create a README.txt file echo "BlitzForge is a compiler for an enhanced version of the Blitz3D language. It is a fork of the Blitz3D compiler and adds support for the BlitzForge commands and syntax. You can develop with BlitzForge in Visual Studio Code by installing the .vsix extension. Press Ctrl+Shift+P and search for vsix to install the extension." > "%ROOTDIR%\release\README.txt" +set "PACKAGE_TMP=%TEMP%\blitzforge-package-%RANDOM%-%RANDOM%" +set "PACKAGE_ROOT=%PACKAGE_TMP%\%ARCHIVE_BASENAME%" +mkdir "%PACKAGE_ROOT%" +xcopy /E /Y /I "%ROOTDIR%\release\*" "%PACKAGE_ROOT%\" >nul +if exist "%ARCHIVE_PATH%" del /Q "%ARCHIVE_PATH%" +powershell -NoProfile -Command "Compress-Archive -Path '%PACKAGE_ROOT%' -DestinationPath '%ARCHIVE_PATH%' -CompressionLevel Optimal" +if errorlevel 1 ( + rd /S /Q "%PACKAGE_TMP%" + endlocal + exit /b 1 +) +rd /S /Q "%PACKAGE_TMP%" +echo Created release archive: "%ARCHIVE_PATH%" + endlocal diff --git a/publish.sh b/publish.sh index a493907..2dfd05e 100755 --- a/publish.sh +++ b/publish.sh @@ -4,6 +4,39 @@ set -euo pipefail ROOTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" RELEASE_DIR="${ROOTDIR}/release" +host_archive_basename() { + case "$(uname -s)" in + Darwin) echo "blitzforge-macos-arm64" ;; + Linux) echo "blitzforge-linux-host" ;; + *) echo "blitzforge-unix-host" ;; + esac +} + +create_zip_archive() { + local source_parent="$1" + local source_name="$2" + local archive_path="$3" + + if command -v zip >/dev/null 2>&1; then + ( + cd "${source_parent}" + zip -qr "${archive_path}" "${source_name}" + ) + return + fi + + if command -v python3 >/dev/null 2>&1; then + ( + cd "${source_parent}" + python3 -m zipfile -c "${archive_path}" "${source_name}" + ) + return + fi + + echo "Unable to create release archive: install zip or python3." >&2 + exit 1 +} + "${ROOTDIR}/compile.sh" rm -rf "${RELEASE_DIR}" @@ -25,3 +58,15 @@ BlitzForge is a compiler for an enhanced version of the Blitz3D language. It is a fork of the Blitz3D compiler and adds support for BlitzForge commands and syntax. You can develop with BlitzForge in Visual Studio Code by installing the bundled .vsix extension. EOF + +ARCHIVE_BASENAME="$(host_archive_basename)" +ARCHIVE_PATH="${RELEASE_DIR}/${ARCHIVE_BASENAME}.zip" +PACKAGE_TMPDIR="$(mktemp -d "${TMPDIR:-/tmp}/blitzforge-package.XXXXXX")" +trap 'rm -rf "${PACKAGE_TMPDIR}"' EXIT +PACKAGE_ROOT="${PACKAGE_TMPDIR}/${ARCHIVE_BASENAME}" +mkdir -p "${PACKAGE_ROOT}" +rsync -a "${RELEASE_DIR}/" "${PACKAGE_ROOT}/" +rm -f "${ARCHIVE_PATH}" +create_zip_archive "${PACKAGE_TMPDIR}" "${ARCHIVE_BASENAME}" "${ARCHIVE_PATH}" + +echo "Created release archive: ${ARCHIVE_PATH}"