Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ common --tool_java_runtime_version=remotejdk_21
# compilation (and Turbine can't run Lombok), so disable header compilation.
build --java_header_compilation=false

# Stamping: workspace status provides STABLE_VERSION as YYYY.MMDD.HHMM
# (per-minute UTC, each component <65535 for MSI). Invoked as `bash` so it
# works on Linux/macOS and on Windows via Git bash (C:\Program Files\Git\bin\bash.exe).
# Stamping: workspace status provides STABLE_VERSION as YY.MM.N
# (per-minute UTC, N = (DD-1)*1440+HH*60+MM, fits MSI 255.255.65535 and
# macOS CFBundleVersion 1-3 integers). Invoked as `bash` so it works on
# Linux/macOS and on Windows via Git bash (C:\Program Files\Git\bin\bash.exe).
# Use --config=stamp or --stamp together with this command. The stamp config
# bundles both.
build:stamp --stamp
Expand Down
10 changes: 6 additions & 4 deletions java/com/cowlark/fluxengine/core/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
/* Provides the application version, supplied at build time via Bazel stamping.
*
* Bazel generates version.properties via scripts/version.bzl from
* STABLE_VERSION (scripts/workspace_status.sh as YYYY.MMDD.HHMM per-minute UTC,
* each component <65535 so valid for Windows MSI ProductVersion). The value is
* also available as -Dfluxengine.version if set; otherwise the properties file
* is read. When built without --stamp, falls back to 1.0.0-dev.
* STABLE_VERSION (scripts/workspace_status.sh as YY.MM.N per-minute UTC
* where N = (DD-1)*1440 + HH*60 + MM, fits MSI 255.255.65535 and macOS
* CFBundleVersion 1-3 integers). This is the same version passed to jpackage
* as --app-version, so Version.get() reports the installer version. The value
* is also available as -Dfluxengine.version if set; otherwise the properties
* file is read. When built without --stamp, falls back to 1.0.0-dev.
*/
public final class Version
{
Expand Down
3 changes: 2 additions & 1 deletion scripts/jpackage.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def _jpackage_impl(ctx):
# supplied via --resource-dir to avoid post-processing.
#
# Stamping: when stamp=True and --stamp is set, read STABLE_VERSION from
# the stable-status file (produced by scripts/workspace_status.sh via
# the stable-status file (produced by scripts/workspace_status.sh as
# YY.MM.N per-minute UTC, N = (DD-1)*1440+HH*60+MM, via
# `bash scripts/workspace_status.sh`, which works on Linux/macOS and on
# Windows via Git bash). Fall back to app_version (1.0.0) otherwise.
stamp_inputs = [ctx.info_file] if ctx.attr.stamp else []
Expand Down
7 changes: 6 additions & 1 deletion scripts/version.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
"""Generates version.properties containing fluxengine.version from Bazel stamp."""
"""Generates version.properties containing fluxengine.version from Bazel stamp.

STABLE_VERSION is produced by scripts/workspace_status.sh as YY.MM.N per-minute
UTC (N = (DD-1)*1440+HH*60+MM) and is used as jpackage --app-version, so
fluxengine.version matches the installer version.
"""

def _version_properties_impl(ctx):
out = ctx.actions.declare_file("version.properties")
Expand Down
18 changes: 14 additions & 4 deletions scripts/workspace_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@
# Uses bash from Git on Windows (C:\Program Files\Git\bin\bash.exe) as well as
# Linux/macOS. Produces STABLE_VERSION for jpackage and -Dfluxengine.version.
#
# Format YYYY.MMDD.HHMM (per-minute, UTC) e.g. 2026.0919.1430
# Each dotted component <65535 so valid for Windows MSI ProductVersion,
# Debian upstream_version and RPM Version.
echo "STABLE_VERSION $(date -u +%Y.%m%d.%H%M)"
# Format YY.MM.N (per-minute UTC) where N is minutes since start of month:
# N = (DD - 1) * 1440 + HH * 60 + MM, 0 <= N <= 44639
# e.g. 26.09.19 14:30 UTC -> N = 18*1440 + 14*60 + 30 = 26790 -> 26.9.26790
# Three components satisfy macOS CFBundleVersion (1-3 integers, 18 chars,
# jpackage on JDK 21 rejects >3), MSI ProductVersion 255.255.65535 (first
# <256, second <256, third <65535), Debian upstream_version and RPM Version,
# while preserving per-minute monotonicity.
YY=$(date -u +%y)
MM=$(date -u +%m)
DD=$(date -u +%d)
HH=$(date -u +%H)
MIN=$(date -u +%M)
N=$(( (10#$DD - 1) * 1440 + 10#$HH * 60 + 10#$MIN ))
echo "STABLE_VERSION $((10#$YY)).$((10#$MM)).$N"
echo "BUILD_TIMESTAMP $(date -u +%Y-%m-%dT%H:%M:%SZ)"
Loading