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 #581 from francisdb/master
re #577 fix for running the bash file in a path with spaces
- Loading branch information
Showing
8 changed files
with
98 additions
and
6 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
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,39 @@ | ||
enablePlugins(LauncherJarPlugin) | ||
|
||
name := "launcher-jar-test" | ||
|
||
version := "0.1.0" | ||
|
||
// test dependencies sample | ||
libraryDependencies ++= Seq( | ||
"com.typesafe.akka" %% "akka-kernel" % "2.3.4" | ||
) | ||
|
||
TaskKey[Unit]("check-classpath") := { | ||
val dir = (stagingDirectory in Universal).value | ||
val bat = IO.read(dir / "bin" / "launcher-jar-test.bat") | ||
assert(bat contains "set \"APP_CLASSPATH=\"", "bat should set APP_CLASSPATH:\n" + bat) | ||
assert(bat contains "set \"APP_MAIN_CLASS=-jar %APP_LIB_DIR%\\launcher-jar-test.launcher-jar-test-0.1.0-launcher.jar\"", | ||
"bat should set APP_MAIN_CLASS:\n" + bat) | ||
val bash = IO.read(dir / "bin" / "launcher-jar-test") | ||
assert(bash contains "declare -r app_classpath=\"\"", "bash should declare app_classpath:\n" + bash) | ||
assert(bash contains "declare -a app_mainclass=(\"-jar\" \"$lib_dir/launcher-jar-test.launcher-jar-test-0.1.0-launcher.jar\")", | ||
"bash should declare app_mainclass:\n" + bash) | ||
val jar = new java.util.jar.JarFile(dir / "lib" / "launcher-jar-test.launcher-jar-test-0.1.0-launcher.jar") | ||
val attributes = jar.getManifest().getMainAttributes() | ||
assert(attributes.getValue("Class-Path").toString() contains "com.typesafe.akka.akka-actor", | ||
"MANIFEST Class-Path should contain akka-actor:\n" + attributes.getValue("Class-Path").toString()) | ||
assert(attributes.getValue("Main-Class").toString() contains "test.Test", | ||
"MANIFEST Main-Class should contain test.Test:\n" + attributes.getValue("Main-Class").toString()) | ||
jar close | ||
} | ||
|
||
TaskKey[Unit]("run-check") := { | ||
val dir = (stagingDirectory in Universal).value | ||
val cmd = if(System.getProperty("os.name").contains("Windows")){ | ||
Seq("cmd", "/c", (dir / "bin" / "launcher-jar-test.bat").getAbsolutePath) | ||
}else{ | ||
Seq((dir / "bin" / "launcher-jar-test").getAbsolutePath) | ||
} | ||
assert(Process(cmd).!! contains "SUCCESS!") | ||
} |
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")) |
19 changes: 19 additions & 0 deletions
19
src/sbt-test/jar/launcher-jar with spaces/src/main/scala/test/Test.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,19 @@ | ||
package test | ||
|
||
// use dependency library | ||
|
||
import akka.actor._ | ||
import akka.routing.RoundRobinRouter | ||
|
||
class PrintActor extends Actor{ | ||
def receive = { | ||
case msg => println(msg) | ||
} | ||
} | ||
|
||
object Test extends App { | ||
val system = ActorSystem("testSystem") | ||
val router = system.actorOf(Props[PrintActor]) | ||
router ! "SUCCESS!!" | ||
system.shutdown | ||
} |
21 changes: 21 additions & 0 deletions
21
src/sbt-test/jar/launcher-jar with spaces/src/templates/bat-template
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,21 @@ | ||
@echo off | ||
rem this template is minimal for test independent | ||
|
||
@setlocal enabledelayedexpansion | ||
@echo off | ||
|
||
set "@@APP_ENV_NAME@@_HOME=%~dp0\\.." | ||
|
||
set "APP_LIB_DIR=%@@APP_ENV_NAME@@_HOME%\lib\" | ||
|
||
set _JAVACMD=%JAVACMD% | ||
|
||
if "%_JAVACMD%"=="" ( | ||
if not "%JAVA_HOME%"=="" ( | ||
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe" | ||
) | ||
) | ||
|
||
@@APP_DEFINES@@ | ||
|
||
"%_JAVACMD%" -cp "%APP_CLASSPATH%" %APP_MAIN_CLASS% %* |
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 @@ | ||
# Run the staging and check the script. | ||
> stage | ||
$ exists target/universal/stage/lib/launcher-jar-test.launcher-jar-test-0.1.0-launcher.jar | ||
> check-classpath | ||
> run-check |
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