-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from mdedetrich/add-test-for-packageWithJvmJar
Fix packageWithJVMJar := true not working on Windows
- Loading branch information
Showing
4 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
lazy val test08 = (project in file ("")).enablePlugins(SbtOsgi) | ||
|
||
organization := "com.typesafe.sbt" | ||
|
||
name := "sbt-osgi-test" | ||
|
||
version := "1.2.3" | ||
|
||
libraryDependencies += "org.osgi" % "org.osgi.core" % "4.3.0" % "provided" | ||
|
||
osgiSettings | ||
|
||
OsgiKeys.packageWithJVMJar := true | ||
|
||
TaskKey[Unit]("verifyBundleActivator") := { | ||
val activator = OsgiKeys.bundleActivator.value | ||
if (activator.isDefined) | ||
sys.error("Expected bundle-activator to be None, but was %s!" format activator) | ||
} | ||
|
||
TaskKey[Unit]("verifyBundleSymbolicName") := { | ||
val name = OsgiKeys.bundleSymbolicName.value | ||
if (name != "com.typesafe.sbt.osgi.test") | ||
sys.error("Expected bundle-symbolic-name to be %s, but was %s!".format("com.typesafe.sbt.osgi.test", name)) | ||
} | ||
|
||
TaskKey[Unit]("verifyBundleRequiredExecutionEnvironment") := { | ||
val re = OsgiKeys.bundleRequiredExecutionEnvironment.value | ||
if (re.nonEmpty) | ||
sys.error("Expected bundleRequiredExecutionEnvironment to be Nil, but was %s!" format re) | ||
} | ||
|
||
TaskKey[Unit]("verifyBundleVerion") := { | ||
val version = OsgiKeys.bundleVersion.value | ||
if (version != "1.2.3") | ||
sys.error("Expected bundle-version to be %s, but was %s!".format("1.2.3", version)) | ||
} | ||
|
||
TaskKey[Unit]("verifyDynamicImportPackage") := { | ||
val pkg = OsgiKeys.dynamicImportPackage.value | ||
if (!pkg.isEmpty) | ||
sys.error("Expected dynamic-import-package to be empty, but was %s!" format pkg) | ||
} | ||
|
||
TaskKey[Unit]("verifyExportPackage") := { | ||
val pkg = OsgiKeys.exportPackage.value | ||
if (!pkg.isEmpty) | ||
sys.error("Expected export-package to be empty, but was %s!" format pkg) | ||
} | ||
|
||
TaskKey[Unit]("verifyImportPackage") := { | ||
val pkg = OsgiKeys.importPackage.value | ||
if (pkg != Seq("*")) | ||
sys.error("Expected import-package to be %s, but was %s!".format(Seq("*"), pkg)) | ||
} | ||
|
||
TaskKey[Unit]("verifyFragmentHost") := { | ||
val host = OsgiKeys.fragmentHost.value | ||
if (host != None) | ||
sys.error("Expected fragment-host to be None, but was %s!" format host) | ||
} | ||
|
||
TaskKey[Unit]("verifyPrivatePackage") := { | ||
val pkg = OsgiKeys.privatePackage.value | ||
if (pkg != Seq("com.typesafe.sbt.osgi.test.*")) | ||
sys.error("Expected private-package to be %s, but was %s!".format(Seq("com.typesafe.sbt.osgi.test.*"), pkg)) | ||
} | ||
|
||
TaskKey[Unit]("verifyRequireBundle") := { | ||
val bundle = OsgiKeys.requireBundle.value | ||
if (!bundle.isEmpty) | ||
sys.error("Expected require-bundle to be empty, but was %s!" format bundle) | ||
} |
5 changes: 5 additions & 0 deletions
5
src/sbt-test/sbt-osgi/test-08-packageWithJVMJar/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sys.props.get("plugin.version") match { | ||
case Some(x) => addSbtPlugin("com.github.sbt" % "sbt-osgi" % x) | ||
case _ => sys.error("""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Default settings | ||
> verifyBundleActivator | ||
> verifyBundleSymbolicName | ||
> verifyBundleVerion | ||
> verifyBundleRequiredExecutionEnvironment | ||
> verifyDynamicImportPackage | ||
> verifyExportPackage | ||
> verifyImportPackage | ||
> verifyFragmentHost | ||
> verifyPrivatePackage | ||
> verifyRequireBundle | ||
|
||
# Existence of JAR file | ||
> osgiBundle | ||
$ exists target/scala-2.12/sbt-osgi-test_2.12-1.2.3.jar |