Created
March 13, 2014 11:49
-
-
Save hfs/9526953 to your computer and use it in GitHub Desktop.
sbt-native-packager: Append timestamp to version of Debian package for snapshots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version := "0.2-SNAPSHOT" | |
// If the version ends with "-SNAPSHOT", let the Debian version end with | |
// "~SNAPSHOT~yyyyMMddHHmmss". This way updates of the snapshot version can be | |
// detected by the package manager. Also the tilde "~" sorts before anything | |
// else when comparing version numbers. This way "1.0" will be regarded newer | |
// than "1.0~beta". | |
version in Debian <<= (version) { (v) => | |
if (v.endsWith("-SNAPSHOT")) { | |
val timestampFormat = new java.text.SimpleDateFormat("yyyyMMddHHmmss"); | |
timestampFormat.setTimeZone(java.util.TimeZone.getTimeZone("UTC")); | |
val now = timestampFormat.format(new java.util.Date()); | |
v.replace("-SNAPSHOT", "~SNAPSHOT~" + now) | |
} else { | |
v | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment