Skip to content

Commit 159eb6a

Browse files
author
Charles O'Farrell
committed
Use Manifest version at runtime to reduce duplication
This use of "in Global" for build.sbt is not ideal, but I don't understand SBT enough to know why I need it.
1 parent 900be77 commit 159eb6a

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

Scalatron/src/scalatron/Version.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ package scalatron
55

66
object Version
77
{
8-
val VersionString = "0.9.9.1"
8+
val VersionString = Version.getClass.getPackage.getImplementationVersion
99
}

ScalatronCLI/src/scalatronRemote/Version.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
package scalatronRemote
55

66
object Version {
7-
val VersionString = "0.9.9.1" // version of this tool (not of remote server :-)
7+
val VersionString = Version.getClass.getPackage.getImplementationVersion // version of this tool (not of remote server :-)
88
}

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ organization := "Scalatron"
22

33
name := "Scalatron"
44

5-
version := "0.9.9.1"
5+
version in Global := "0.9.9.1"
66

77
scalaVersion := "2.9.1"

project/build.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ import AssemblyKeys._
77
object build extends Build {
88
def standardSettings = Defaults.defaultSettings ++ src ++ assemblySettings ++ Seq (
99
mergeStrategy in assembly := {_ => MergeStrategy.first}
10+
) ++ implVersion
11+
12+
lazy val implVersion = Seq (
13+
packageOptions <<= (version) map {
14+
scalatronVersion => Seq(Package.ManifestAttributes(
15+
("Implementation-Version", scalatronVersion)
16+
))
17+
}
1018
)
1119

1220
lazy val all = Project(

0 commit comments

Comments
 (0)