Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit 3c796f0

Browse files
committed
Fix OSGi madness.
The settings must be concatenated in this order, and `OsgiKeys.exportPackage` must be set correctly, or we somehow slurp in the whole scala library into the scala-continuations-library jar (and scala-compiler into scala-continuations-plugin).
1 parent 0e3eb35 commit 3c796f0

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

build.sbt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Settings._
22
import Keys.{`package` => packageTask }
3+
import com.typesafe.sbt.osgi.{OsgiKeys, SbtOsgi}
34

45
// plugin logic of build based on https://github.com/retronym/boxer
56

@@ -13,15 +14,16 @@ lazy val commonSettings = scalaModuleSettings ++ Seq(
1314

1415
lazy val root = project.in( file(".") ).settings( publishArtifact := false ).aggregate(plugin, library).settings(commonSettings : _*)
1516

16-
lazy val plugin = project settings (
17-
name := "scala-continuations-plugin",
18-
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value
17+
lazy val plugin = project settings (SbtOsgi.osgiSettings: _*) settings (
18+
name := "scala-continuations-plugin",
19+
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
20+
OsgiKeys.exportPackage := Seq(s"scala.tools.selectivecps;version=${version.value}")
1921
) settings (commonSettings : _*)
2022

2123
val pluginJar = packageTask in (plugin, Compile)
2224

2325
// TODO: the library project's test are really plugin tests, but we first need that jar
24-
lazy val library = project settings (
26+
lazy val library = project settings (SbtOsgi.osgiSettings: _*) settings (
2527
name := "scala-continuations-library",
2628
scalacOptions ++= Seq(
2729
// add the plugin to the compiler
@@ -38,5 +40,6 @@ lazy val library = project settings (
3840
testOptions += Tests.Argument(
3941
TestFrameworks.JUnit,
4042
s"-Dscala-continuations-plugin.jar=${pluginJar.value.getAbsolutePath}"
41-
)
43+
),
44+
OsgiKeys.exportPackage := Seq(s"scala.util.continuations;version=${version.value}")
4245
) settings (commonSettings : _*)

project/ContinuationsBuild.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object Settings {
1414

1515
val osgiVersion = version(_.replace('-', '.'))
1616

17-
lazy val scalaModuleSettings = SbtOsgi.osgiSettings ++ Seq(
17+
lazy val scalaModuleSettings = Seq(
1818
repoName := name.value,
1919

2020
scalaBinaryVersion := deriveBinaryVersion(scalaVersion.value, snapshotScalaBinaryVersion.value),
@@ -91,7 +91,6 @@ object Settings {
9191

9292
OsgiKeys.bundleSymbolicName := s"${organization.value}.${name.value}",
9393
OsgiKeys.bundleVersion := osgiVersion.value,
94-
OsgiKeys.exportPackage := Seq(s"*;version=${version.value}"),
9594
// Sources should also have a nice MANIFEST file
9695
packageOptions in packageSrc := Seq(
9796
Package.ManifestAttributes(

0 commit comments

Comments
 (0)