-
Notifications
You must be signed in to change notification settings - Fork 443
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 #442 from tartakynov/custom-main-windows
#415 custom mainclass for Windows
- Loading branch information
Showing
6 changed files
with
49 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
enablePlugins(JavaAppPackaging) | ||
|
||
name := "test-custom-main" | ||
|
||
version := "0.1.0" | ||
|
||
mainClass in Compile := Some("Main") | ||
|
||
TaskKey[Unit]("check-app-main") <<= (packageBin in Universal, streams) map { (zipFile, streams) => | ||
val process = sbt.Process("target/universal/stage/bin/test-custom-main.bat") | ||
val out = (process!!) | ||
if (out.trim != "App Main Method") error("unexpected output: " + out) | ||
() | ||
} | ||
|
||
TaskKey[Unit]("check-custom-main") <<= (packageBin in Universal, streams) map { (zipFile, streams) => | ||
val process = sbt.Process("target/universal/stage/bin/test-custom-main.bat", Seq("-main", "CustomMain")) | ||
val out = (process!!) | ||
if (out.trim != "Custom Main Method") error("unexpected output: " + out) | ||
() | ||
} | ||
|
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-native-packager" % sys.props("project.version")) |
3 changes: 3 additions & 0 deletions
3
src/sbt-test/windows/test-custom-main/src/main/scala/CustomMain.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 @@ | ||
object CustomMain extends App { | ||
println("Custom Main Method") | ||
} |
3 changes: 3 additions & 0 deletions
3
src/sbt-test/windows/test-custom-main/src/main/scala/Main.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 @@ | ||
object Main extends App { | ||
println("App Main Method") | ||
} |
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,7 @@ | ||
# Stage the distribution and ensure main class can be run. | ||
> stage | ||
$ exists target/universal/stage/bin/ | ||
$ exists target/universal/stage/bin/test-custom-main.bat | ||
> check-app-main | ||
> check-custom-main | ||
|