@@ -19,9 +19,27 @@ val disablePublishing = Seq[Setting[_]](
19
19
20
20
disablePublishing // in root
21
21
22
+ /** Create an OSGi version range for standard Scala / Lightbend versioning
23
+ * schemes that describes binary compatible versions. */
24
+ def osgiVersionRange (version : String ): String =
25
+ if (version contains '-' ) " ${@}" // M, RC or SNAPSHOT -> exact version
26
+ else " ${range;[==,=+)}" // Any binary compatible version
27
+
28
+ /** Create an OSGi Import-Package version specification. */
29
+ def osgiImport (pattern : String , version : String ): String =
30
+ pattern + " ;version=\" " + osgiVersionRange(version) + " \" "
31
+
22
32
lazy val core = project.in(file(" core" )).settings(scalaModuleSettings).settings(scalaModuleOsgiSettings).settings(
23
33
name := " scala-parallel-collections" ,
24
- OsgiKeys .exportPackage := Seq (s " scala.collection.parallel.*;version= ${version.value}" ),
34
+ OsgiKeys .exportPackage := Seq (
35
+ s " scala.collection.parallel.*;version= ${version.value}" ,
36
+ // The first entry on the classpath is the project's target classes dir but sbt-osgi also passes all
37
+ // dependencies to bnd. Any "merge" strategy for split packages would include the classes from scala-library.
38
+ s " scala.collection;version= ${version.value};-split-package:=first " ,
39
+ s " scala.collection.generic;version= ${version.value};-split-package:=first "
40
+ ),
41
+ // Use correct version for scala package imports
42
+ OsgiKeys .importPackage := Seq (osgiImport(" scala*" , scalaVersion.value), " *" ),
25
43
mimaPreviousVersion := None ,
26
44
headers := Map (
27
45
" scala" ->
0 commit comments