@@ -57,6 +57,17 @@ scalaVersionsByJvm in ThisBuild := {
5757  )
5858}
5959
60+ /**  Create an OSGi version range for standard Scala versioning
61+   * schemes that describes binary compatible versions. */  
62+ def  osgiVersionRange (version : String , requireMicro : Boolean  =  false ):  String  = 
63+   if (version contains '-' ) " ${@}" //  M, RC or SNAPSHOT -> exact version
64+   else  if (requireMicro) " ${range;[===,=+)}" //  At least the same micro version
65+   else  " ${range;[==,=+)}" //  Any binary compatible version
66+ 
67+ /**  Create an OSGi Import-Package version specification. */ 
68+ def  osgiImport (pattern : String , version : String , requireMicro : Boolean  =  false ):  String  = 
69+   pattern +  " ;version=\" " +  osgiVersionRange(version, requireMicro) +  " \" " 
70+ 
6071lazy  val  compat  =  MultiScalaCrossProject (JSPlatform , JVMPlatform )(
6172  " compat" 
6273  _.settings(scalaModuleSettings)
@@ -73,7 +84,14 @@ lazy val compat = MultiScalaCrossProject(JSPlatform, JVMPlatform)(
7384      }
7485    )
7586    .jvmSettings(
76-       OsgiKeys .exportPackage :=  Seq (s " scala.collection.compat.*;version= ${version.value}" ),
87+       OsgiKeys .exportPackage :=  {
88+         if  (scalaVersion.value.startsWith(" 2.13." 
89+           Seq (s " scala.collection.compat.*;version= ${version.value}" )
90+         else 
91+           Seq (s " scala.collection.compat.*;version= ${version.value},scala.jdk.*;version= ${version.value}" )
92+       },
93+       OsgiKeys .importPackage :=  Seq (osgiImport(" *" 
94+       OsgiKeys .privatePackage :=  Nil ,
7795      junit
7896    )
7997    .jsSettings(
0 commit comments