@@ -107,20 +107,29 @@ credentials ++= {
107107}
108108
109109// sbt doesn't automatically load the content of the MANIFST.MF file, therefore
110- // we have to do it here by ourselves Furthermore, the version format in the
111- // MANIFEST.MF is `x.y.z. qualifier` but we need to replace the `qualifier` part
112- // with a unique identifier otherwise OSGi can't find out which nightly build
113- // is newest and therefore not all caches are updated with the correct version
114- // of a nightly.
110+ // we have to do it here by ourselves. Furthermore, the version format in the
111+ // MANIFEST.MF is `version. qualifier`, which means that we have to replace
112+ // `version` by the actual version and `qualifier` with a unique identifier
113+ // otherwise OSGi can't find out which nightly build is newest and therefore
114+ // not all caches are updated with the correct version of a nightly.
115115packageOptions in Compile in packageBin += {
116- val m = Using .fileInputStream(new java.io.File (" META-INF/ MANIFEST.MF" )) { in =>
116+ val m = Using .fileInputStream(new java.io.File (" MANIFEST.MF.prototype " )) { in =>
117117 val manifest = new java.util.jar.Manifest (in)
118118 val attr = manifest.getMainAttributes
119119 val key = " Bundle-Version"
120120 val versionSuffix = scalaBinaryVersion.value.replace('.' , '_' )
121+ // get the version but get rid of "-SNAPSHOT" suffix if it exists
122+ val v = {
123+ val v = version.value
124+ val i = v.lastIndexOf('-' )
125+ if (i > 0 )
126+ v.substring(0 , i)
127+ else
128+ v
129+ }
121130 val date = new java.text.SimpleDateFormat (" yyyyMMddHHmm" ).format(new java.util.Date )
122131 val sha = " git rev-parse --short HEAD" .!! .trim
123- attr.putValue(key, attr.getValue(key).replace(" qualifier" , s " $versionSuffix- $date- $sha" ))
132+ attr.putValue(key, attr.getValue(key).replace(" version. qualifier" , s " $v . $versionSuffix- $date- $sha" ))
124133 manifest
125134 }
126135 Package .JarManifest (m)
0 commit comments