Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export the split packages and create correct import versions for OSGi #17

Merged
merged 1 commit into from
Mar 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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