-
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.
handle .* in fail on classes excluded mode
- Loading branch information
Showing
9 changed files
with
103 additions
and
4 deletions.
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
77 changes: 77 additions & 0 deletions
77
src/sbt-test/sbt-osgi/test-08-failOnClassesExcludedFromJarStar/build.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,77 @@ | ||
lazy val test01 = (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.bundleActivator := Some("com.typesafe.sbt.osgi.test.internal.Activator") | ||
|
||
OsgiKeys.dynamicImportPackage := Seq("scala.*") | ||
|
||
|
||
// we set an explicit internal package | ||
OsgiKeys.privatePackage := Seq("com.typesafe.sbt.osgi.test.internal") | ||
|
||
// we set what to export one specific one | ||
OsgiKeys.exportPackage := Seq("com.typesafe.sbt.osgi.test.exportme.*") | ||
|
||
// yet we "forget" on purpose to decide what to do about undecided! | ||
// however we also enable the fail setting: | ||
OsgiKeys.failOnUndecidedPackage := true | ||
|
||
|
||
OsgiKeys.bundleRequiredExecutionEnvironment := Seq("JavaSE-1.7", "JavaSE-1.8") | ||
|
||
apiURL := Some(url("http://typesafe.com")) | ||
|
||
licenses += ("license" -> url("http://license.license")) | ||
|
||
|
||
TaskKey[Unit]("verify-bundle") <<= OsgiKeys.bundle map { file => | ||
import java.io.IOException | ||
import java.util.zip.ZipFile | ||
import scala.io.Source | ||
val newLine = System.getProperty("line.separator") | ||
val zipFile = new ZipFile(file) | ||
// Verify manifest | ||
val manifestIn = zipFile.getInputStream(zipFile.getEntry("META-INF/MANIFEST.MF")) | ||
try { | ||
val lines = Source.fromInputStream(manifestIn).getLines().toList | ||
val allLines = lines mkString newLine | ||
val butWas = newLine + "But was:" + newLine + allLines | ||
if (!(lines contains "Bundle-Activator: com.typesafe.sbt.osgi.test.internal.Activator")) | ||
error("Expected 'Bundle-Activator: com.typesafe.sbt.osgi.test.internal.Activator' in manifest!" + butWas) | ||
if (!(lines contains "Bundle-Description: sbt-osgi-test")) | ||
sys.error("Expected 'Bundle-Description: sbt-osgi-test' in manifest!" + butWas) | ||
if (!(lines contains "Bundle-DocURL: http://typesafe.com")) | ||
sys.error("Expected 'Bundle-DocURL: http://typesafe.com' in manifest!" + butWas) | ||
if (!(lines contains "Bundle-License: http://license.license;description=license")) | ||
sys.error("Expected 'Bundle-License: http://license.license;description=license' in manifest!" + butWas) | ||
if (!(lines contains "Bundle-Name: sbt-osgi-test")) | ||
sys.error("Expected 'Bundle-Name: sbt-osgi-test' in manifest!" + butWas) | ||
if (!(lines contains "Bundle-RequiredExecutionEnvironment: JavaSE-1.7,JavaSE-1.8")) | ||
sys.error("Expected 'Bundle-RequiredExecutionEnvironment: JavaSE-1.7,JavaSE-1.8' in manifest!" + butWas) | ||
if (!(lines contains "Bundle-Vendor: com.typesafe.sbt")) | ||
sys.error("Expected 'Bundle-Vendor: com.typesafe.sbt' in manifest!" + butWas) | ||
if (!(lines contains "Bundle-SymbolicName: com.typesafe.sbt.osgi.test")) | ||
error("Expected 'Bundle-SymbolicName: com.typesafe.sbt.osgi.test' in manifest!" + butWas) | ||
if (!(lines contains "Bundle-Version: 1.2.3")) | ||
error("Expected 'Bundle-Version: 1.2.3' in manifest!" + butWas) | ||
if (!(lines contains "DynamicImport-Package: scala.*")) | ||
error("Expected 'DynamicImport-Package: scala.*' in manifest!" + butWas) | ||
if (!(lines exists (_ containsSlice "Export-Package: com.typesafe.sbt.osgi.test"))) | ||
error("Expected 'Export-Package: com.typesafe.sbt.osgi.test' in manifest!" + butWas) | ||
if (!(lines exists (l => (l containsSlice "org.osgi.framework") && (l containsSlice "Import-Package: ")))) | ||
error("""Expected 'Import-Package: ' and 'org.osgi.framework' in manifest!""" + butWas) | ||
if (!(lines contains "Private-Package: com.typesafe.sbt.osgi.test.internal")) | ||
error("Expected 'Private-Package: com.typesafe.sbt.osgi.test.internal' in manifest!" + butWas) | ||
} catch { | ||
case e: IOException => error("Expected to be able to read the manifest, but got exception!" + newLine + e) | ||
} finally manifestIn.close() | ||
} |
1 change: 1 addition & 0 deletions
1
src/sbt-test/sbt-osgi/test-08-failOnClassesExcludedFromJarStar/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 @@ | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % sys.props("project.version")) |
3 changes: 3 additions & 0 deletions
3
...OnClassesExcludedFromJarStar/src/main/scala/com/typesafe/sbt/osgi/test/exportme/Foo.scala
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,3 @@ | ||
package com.typesafe.sbt.osgi.test.exportme | ||
|
||
class Foo |
11 changes: 11 additions & 0 deletions
11
...sesExcludedFromJarStar/src/main/scala/com/typesafe/sbt/osgi/test/internal/Activator.scala
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,11 @@ | ||
package com.typesafe.sbt.osgi.test | ||
package internal | ||
|
||
import org.osgi.framework._ | ||
|
||
class Activator extends BundleActivator { | ||
|
||
def start(context: BundleContext): Unit = () | ||
|
||
def stop(context: BundleContext): Unit = () | ||
} |
3 changes: 3 additions & 0 deletions
3
...esExcludedFromJarStar/src/main/scala/com/typesafe/sbt/osgi/test/undecided/Undecided.scala
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,3 @@ | ||
package com.typesafe.sbt.osgi.test.undecided | ||
|
||
class Undecided |
1 change: 1 addition & 0 deletions
1
src/sbt-test/sbt-osgi/test-08-failOnClassesExcludedFromJarStar/test
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 @@ | ||
-> verify-bundle |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
version in ThisBuild := "0.9.0" | ||
version in ThisBuild := "0.9.1" | ||
|