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

Additional tests and fix for #563. #566

Merged
merged 1 commit into from
Apr 29, 2015
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ object JDKPackagerHelper {
.map(c ⇒ Map("-appclass" -> c))
.getOrElse(Map.empty)

val vendorArg = if (maintainer.nonEmpty)
Map("-vendor" -> maintainer) else Map.empty

val descriptionArg = if (description.nonEmpty)
Map("-description" -> description) else Map.empty

// Make a setting?
val jvmOptsFile = (sourceDir ** JavaAppPackaging.appIniLocation).getPaths.headOption.map(file)

Expand All @@ -104,10 +110,8 @@ object JDKPackagerHelper {
"-srcdir" -> sourceDir.getAbsolutePath,
"-native" -> packageType,
"-outdir" -> outputDir.getAbsolutePath,
"-outfile" -> basename,
"-description" -> description,
"-vendor" -> maintainer
) ++ mainClassArg
"-outfile" -> basename
) ++ mainClassArg ++ vendorArg ++ descriptionArg

val singles = Seq(
s"-BappVersion=$version",
Expand Down
1 change: 1 addition & 0 deletions src/sbt-test/jdkpackager/test-package-image/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ TaskKey[Unit]("checkImage") <<= (target in JDKPackager, name, streams) map { (ba
case _ ⇒ ""
}
val expectedImage = base / "bundles" / (name + extension)
println(s"Checking for '${expectedImage.getAbsolutePath}'")
assert(expectedImage.exists, s"Expected image file to be found at '$expectedImage'")
}
1 change: 0 additions & 1 deletion src/sbt-test/jdkpackager/test-package-image/test
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Run the jdkpackager packaging
> jdkPackager:packageBin
> checkImage

16 changes: 16 additions & 0 deletions src/sbt-test/jdkpackager/test-package-minimal/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Tests plugin behavior when none of the metadata keys are set.

enablePlugins(JDKPackagerPlugin)

mainClass in Compile := Some("ExampleApp")

TaskKey[Unit]("checkImage") <<= (target in JDKPackager, name, streams) map { (base, name, streams) ⇒
val extension = sys.props("os.name").toLowerCase match {
case os if os.contains("mac") ⇒ ".app"
case os if os.contains("win") ⇒ ".exe"
case _ ⇒ ""
}
val expectedImage = base / "bundles" / (name + extension)
println(s"Checking for '${expectedImage.getAbsolutePath}'")
assert(expectedImage.exists, s"Expected image file to be found at '$expectedImage'")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
val pluginVersion = sys.props("project.version")
if (pluginVersion == null)
throw new RuntimeException(
"""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
else
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package test

object Test extends App {
println("SUCCESS!")
}
3 changes: 3 additions & 0 deletions src/sbt-test/jdkpackager/test-package-minimal/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Run the jdkpackager packaging
> jdkPackager:packageBin
> checkImage