aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-23 07:43:40 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-23 08:20:24 -0400
commit2ae852b73a8f1bdc076835c2ebbc3e33ab10cb91 (patch)
treeb28e6b3492a93c52c85399d3ad18c2b981fc6ddb
parentd08d5e3fe533fef482281f660177ec3f6c86b495 (diff)
Add version information to the build scripts
-rw-r--r--build.bat12
-rwxr-xr-xbuild.sh6
-rw-r--r--ci.bat4
3 files changed, 15 insertions, 7 deletions
diff --git a/build.bat b/build.bat
index 6582e0d..387210e 100644
--- a/build.bat
+++ b/build.bat
@@ -1,12 +1,18 @@
@echo off
setlocal enabledelayedexpansion
+
+
+for /f %%a in ('git rev-parse --short HEAD 2^>NUL') do set commit_hash=%%a
+for /f %%d in ('powershell -command "[DateTime]::UtcNow.ToString('yyyy-MM-dd')"') do set today=%%d
+set version=dev-%today%-%commit_hash%
+
if "%1" == "test" (
odin test tests -collection:src=src -debug -define:ODIN_TEST_THREADS=1 -define:ODIN_TEST_TRACK_MEMORY=false -extra-linker-flags:"/STACK:4000000,2000000"
) else if "%1" == "single_test" (
odin test tests -collection:src=src -define:ODIN_TEST_NAMES=%2 -define:ODIN_TEST_TRACK_MEMORY=false -debug -extra-linker-flags:"/STACK:4000000,2000000"
) else if "%1" == "debug" (
- odin build src\ -show-timings -microarch:native -collection:src=src -out:ols.exe -o:minimal -no-bounds-check -use-separate-modules -debug -extra-linker-flags:"/STACK:4000000,2000000"
+ odin build src\ -show-timings -microarch:native -collection:src=src -out:ols.exe -o:minimal -no-bounds-check -use-separate-modules -debug -extra-linker-flags:"/STACK:4000000,2000000" -define:VERSION=%version%-debug
) else (
- odin build src\ -show-timings -microarch:native -collection:src=src -out:ols.exe -o:speed -no-bounds-check -extra-linker-flags:"/STACK:4000000,2000000"
-)
+ odin build src\ -show-timings -microarch:native -collection:src=src -out:ols.exe -o:speed -no-bounds-check -extra-linker-flags:"/STACK:4000000,2000000" -define:VERSION=%version%
+)
diff --git a/build.sh b/build.sh
index 5700fdc..6168842 100755
--- a/build.sh
+++ b/build.sh
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
+VERSION="dev-$(date -u '+%Y-%m-%d')-$(git rev-parse --short HEAD)"
+
if [[ $1 == "single_test" ]]
then
shift
@@ -42,8 +44,8 @@ if [[ $1 == "debug" ]]
then
shift
- odin build src/ -show-timings -collection:src=src -out:ols -microarch:native -no-bounds-check -use-separate-modules -debug $@
+ odin build src/ -show-timings -collection:src=src -out:ols -microarch:native -no-bounds-check -use-separate-modules -define:VERSION=$VERSION-debug -debug $@
exit 0
fi
-odin build src/ -show-timings -collection:src=src -out:ols -microarch:native -no-bounds-check -o:speed $@
+odin build src/ -show-timings -collection:src=src -out:ols -microarch:native -no-bounds-check -o:speed -define:VERSION=$VERSION $@
diff --git a/ci.bat b/ci.bat
index 098eda1..2748241 100644
--- a/ci.bat
+++ b/ci.bat
@@ -2,8 +2,8 @@
setlocal enabledelayedexpansion
-for /f "tokens=1-3 delims=-" %%a in ('echo %date%') do set today=%%a-%%b-%%c
-set commit_hash=%GITHUB_SHA:~0,8%
+for /f %%a in ('git rev-parse --short HEAD 2^>NUL') do set commit_hash=%%a
+for /f %%d in ('powershell -command "[DateTime]::UtcNow.ToString('yyyy-MM-dd')"') do set today=%%d
set version=nightly-%today%-%commit_hash%
if "%1" == "CI" (