Skip to content

Fix snapshot version naming and trim build hygiene#1772

Merged
tfenne merged 3 commits into
devfrom
tf_fix_snapshot_versioning
Apr 25, 2026
Merged

Fix snapshot version naming and trim build hygiene#1772
tfenne merged 3 commits into
devfrom
tf_fix_snapshot_versioning

Conversation

@tfenne
Copy link
Copy Markdown
Member

@tfenne tfenne commented Apr 25, 2026

Summary

  • Snapshot versions now reflect the next planned release rather than the previous one. The build computes the next semver from the most recent release tag plus a declared nextVersionBump ("x" / "x.x" / "x.x.x" for major / minor / patch). Snapshots are named <nextVersion>-<shortHash>-SNAPSHOT (e.g. 5.0.0-abc1234-SNAPSHOT) — including a 7-char hash makes each snapshot a distinct, pinnable artifact.
  • Release builds (-Drelease=true) now require HEAD to be on a semver tag and the working tree to be clean; the tag is the published version. nextVersionBump is informational on release — the tag is authoritative.
  • nextVersionBump is set to "x" since the next planned release is a major one (5.0.0).
  • Removes the dead .travis.yml and build.xml (Ant) — CI is on GitHub Actions and the Gradle build has been the source of truth for years. Drops the matching /htsjdk.version.properties .gitignore entry.
  • CONTRIBUTING.md "Version Numbering" and "Publishing a Release" sections rewritten to describe the new model.

Why

Previously the build appended -SNAPSHOT to git describe output, so every snapshot between releases was named after the previous release (e.g. 4.3.0-3-gabcdef0-SNAPSHOT) — the opposite of Maven convention, where SNAPSHOTs are previews of the next version. This made it impossible to publish, say, a 5.0.0-SNAPSHOT ahead of cutting 5.0.0.

Test plan

  • ./gradlew -q printVersion from a non-tagged commit prints <nextVersion>-<7charHash>-SNAPSHOT
  • nextVersionBump set to "x" / "x.x" / "x.x.x" produces 5.0.0 / 4.4.0 / 4.3.1 from current dev tip (lastTag=4.3.0)
  • Bad bump value fails with a clear error
  • -Drelease=true on a non-tagged commit fails with "HEAD is not on a tagged commit"
  • -Drelease=true on a tagged commit with a dirty working tree fails with "working tree has uncommitted changes"
  • -Drelease=true on a tagged, clean commit prints just the tag (e.g. 5.0.0)
  • CI green

tfenne added 3 commits April 25, 2026 07:32
Previously the build appended "-SNAPSHOT" to git-describe output, so all
snapshots between releases were named after the *previous* release (e.g.
"4.3.0-3-gabcdef0-SNAPSHOT"), the opposite of Maven convention where SNAPSHOTs
are previews of the next release.

The fix: declare a `nextVersionBump` ("x" / "x.x" / "x.x.x") at the top of
build.gradle, and compute the next semver from the most recent release tag
plus that bump. Snapshots are then named "<nextVersion>-<shortHash>-SNAPSHOT"
(e.g. "5.0.0-23c681a8dc-SNAPSHOT"); including the hash makes each snapshot a
distinct, pinnable artifact.

Release builds (-Drelease=true) require HEAD to be on a semver tag and the
working tree to be clean; the tag is the version (nextVersionBump is ignored
on release — the tag is authoritative).

nextVersionBump is set to "x" since the next release will be a major one.
CI is on GitHub Actions (.github/workflows/tests.yml); Travis hasn't been used
in years and Travis-CI.org no longer offers free OSS minutes anyway. The Ant
build.xml has been superseded by the Gradle build for as long as anyone can
remember. Nothing in the repo references either file.

Also drops the matching /htsjdk.version.properties .gitignore entry, which
was an artifact of the Ant build.
GitHub's actions/checkout defaults to a shallow clone (fetch-depth: 1) with no
tags fetched, so palantir/git-version's `versionDetails().lastTag` returned an
abbreviated commit hash instead of "4.3.0", which the new semver parser
correctly rejected. Set fetch-depth: 0 on all three checkout steps.
@tfenne tfenne merged commit 62c308d into dev Apr 25, 2026
3 checks passed
@tfenne tfenne deleted the tf_fix_snapshot_versioning branch April 25, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant