Skip to content

Commit

Permalink
Merge pull request #17 from szeiger/wip/export-all-packages
Browse files Browse the repository at this point in the history
Export the split packages and create correct import versions for OSGi
  • Loading branch information
SethTisue authored Mar 21, 2017
2 parents 9239dcd + 7558933 commit 90de411
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,27 @@ val disablePublishing = Seq[Setting[_]](

disablePublishing // in root

/** Create an OSGi version range for standard Scala / Lightbend versioning
* schemes that describes binary compatible versions. */
def osgiVersionRange(version: String): String =
if(version contains '-') "${@}" // M, RC or SNAPSHOT -> exact version
else "${range;[==,=+)}" // Any binary compatible version

/** Create an OSGi Import-Package version specification. */
def osgiImport(pattern: String, version: String): String =
pattern + ";version=\"" + osgiVersionRange(version) + "\""

lazy val core = project.in(file("core")).settings(scalaModuleSettings).settings(scalaModuleOsgiSettings).settings(
name := "scala-parallel-collections",
OsgiKeys.exportPackage := Seq(s"scala.collection.parallel.*;version=${version.value}"),
OsgiKeys.exportPackage := Seq(
s"scala.collection.parallel.*;version=${version.value}",
// The first entry on the classpath is the project's target classes dir but sbt-osgi also passes all
// dependencies to bnd. Any "merge" strategy for split packages would include the classes from scala-library.
s"scala.collection;version=${version.value};-split-package:=first",
s"scala.collection.generic;version=${version.value};-split-package:=first"
),
// Use correct version for scala package imports
OsgiKeys.importPackage := Seq(osgiImport("scala*", scalaVersion.value), "*"),
mimaPreviousVersion := None,
headers := Map(
"scala" ->
Expand Down

0 comments on commit 90de411

Please sign in to comment.