@@ -91,20 +91,29 @@ lazy val scalariform = (project
91
91
libraryDependencies ++= scala2_11Dependencies.value,
92
92
libraryDependencies += " org.scalatest" %% " scalatest" % " 3.0.1" % " test" ,
93
93
// sbt doesn't automatically load the content of the MANIFST.MF file, therefore
94
- // we have to do it here by ourselves Furthermore, the version format in the
95
- // MANIFEST.MF is `x.y.z. qualifier` but we need to replace the `qualifier` part
96
- // with a unique identifier otherwise OSGi can't find out which nightly build
97
- // is newest and therefore not all caches are updated with the correct version
98
- // of a nightly.
94
+ // we have to do it here by ourselves. Furthermore, the version format in the
95
+ // MANIFEST.MF is `version. qualifier`, which means that we have to replace
96
+ // `version` by the actual version and `qualifier` with a unique identifier
97
+ // otherwise OSGi can't find out which nightly build is newest and therefore
98
+ // not all caches are updated with the correct version of a nightly.
99
99
packageOptions in Compile in packageBin += {
100
- val m = Using .fileInputStream(file( " scalariform/META-INF/ MANIFEST.MF" )) { in =>
100
+ val m = Using .fileInputStream(new java.io. File ( " MANIFEST.MF.prototype " )) { in =>
101
101
val manifest = new java.util.jar.Manifest (in)
102
102
val attr = manifest.getMainAttributes
103
103
val key = " Bundle-Version"
104
104
val versionSuffix = scalaBinaryVersion.value.replace('.' , '_' )
105
+ // get the version but get rid of "-SNAPSHOT" suffix if it exists
106
+ val v = {
107
+ val v = version.value
108
+ val i = v.lastIndexOf('-' )
109
+ if (i > 0 )
110
+ v.substring(0 , i)
111
+ else
112
+ v
113
+ }
105
114
val date = new java.text.SimpleDateFormat (" yyyyMMddHHmm" ).format(new java.util.Date )
106
115
val sha = " git rev-parse --short HEAD" .!! .trim
107
- attr.putValue(key, attr.getValue(key).replace(" qualifier" , s " $versionSuffix- $date- $sha" ))
116
+ attr.putValue(key, attr.getValue(key).replace(" version. qualifier" , s " $v . $versionSuffix- $date- $sha" ))
108
117
manifest
109
118
}
110
119
Package .JarManifest (m)
0 commit comments