-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the -jvm-debug and -h flags in the ash template (#1630)
* Add bash and ash tests for the -jvm-debug and -h flags * Add missing functions to the ash template * replace bash syntax with ash compatible one * Revert "Fixes remote debug connections closing (#1546)" This reverts commit 665e4e2. * fix sbt 2.0 cross-build for new tests --------- Co-authored-by: Muki Seiler <muuki88@users.noreply.github.com>
- Loading branch information
Showing
18 changed files
with
164 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,15 @@ | ||
enablePlugins(JavaAppPackaging, AshScriptPlugin) | ||
|
||
name := "script-debug" | ||
|
||
version := "0.1.0" | ||
|
||
TaskKey[Unit]("runCheck") := { | ||
val cwd = (Universal / stagingDirectory).value | ||
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath, "-jvm-debug", "0") | ||
val output = (sys.process.Process(cmd, cwd).!!).replaceAll("\n", "") | ||
|
||
assert(output.contains("Listening for transport dt_socket at address:"), | ||
"Application did not start in debug mode: \n" + output) | ||
assert(output.contains("SUCCESS!"), "Application did not run successfully: \n" + output) | ||
} |
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.github.sbt" % "sbt-native-packager" % sys.props("project.version")) |
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 MainApp extends App { | ||
println("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,4 @@ | ||
# Run the staging and check the script. | ||
> stage | ||
$ exists target/**/universal/stage/bin/script-debug | ||
> runCheck |
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,26 @@ | ||
enablePlugins(JavaAppPackaging, AshScriptPlugin) | ||
|
||
name := "script-help" | ||
|
||
version := "0.1.0" | ||
|
||
TaskKey[Unit]("runCheck") := { | ||
val cwd = (Universal / stagingDirectory).value | ||
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath, "-h") | ||
|
||
val buffer = new StringBuffer | ||
val code = sys.process.Process(cmd, cwd).run(scala.sys.process.BasicIO(false, buffer, None)).exitValue() | ||
assert(code == 1, "Exit code for -h was not 1: " + code) | ||
|
||
val output = buffer.toString.replaceAll("\n", "") | ||
|
||
val expectedHelpSamples = Seq( | ||
"-h | -help", "print this message", | ||
"-jvm-debug", | ||
"JAVA_OPTS", | ||
"special option" | ||
) | ||
|
||
assert(expectedHelpSamples.forall(output.contains(_)), | ||
s"Application did not print the correct help message: \n" + output) | ||
} |
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.github.sbt" % "sbt-native-packager" % sys.props("project.version")) |
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 MainApp extends App { | ||
println("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,4 @@ | ||
# Run the staging and check the script. | ||
> stage | ||
$ exists target/**/universal/stage/bin/script-help | ||
> runCheck |
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,17 @@ | ||
import java.net.ServerSocket | ||
|
||
enablePlugins(JavaAppPackaging) | ||
|
||
name := "script-debug" | ||
|
||
version := "0.1.0" | ||
|
||
TaskKey[Unit]("runCheck") := { | ||
val cwd = (Universal / stagingDirectory).value | ||
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath, "-jvm-debug", "0") | ||
val output = (sys.process.Process(cmd, cwd).!!).replaceAll("\n", "") | ||
|
||
assert(output.contains("Listening for transport dt_socket at address:"), | ||
"Application did not start in debug mode: \n" + output) | ||
assert(output.contains("SUCCESS!"), "Application did not run successfully: \n" + output) | ||
} |
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.github.sbt" % "sbt-native-packager" % sys.props("project.version")) |
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 MainApp extends App { | ||
println("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,4 @@ | ||
# Run the staging and check the script. | ||
> stage | ||
$ exists target/**/universal/stage/bin/script-debug | ||
> runCheck |
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,26 @@ | ||
enablePlugins(JavaAppPackaging) | ||
|
||
name := "script-help" | ||
|
||
version := "0.1.0" | ||
|
||
TaskKey[Unit]("runCheck") := { | ||
val cwd = (Universal / stagingDirectory).value | ||
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath, "-h") | ||
|
||
val buffer = new StringBuffer | ||
val code = sys.process.Process(cmd, cwd).run(scala.sys.process.BasicIO(false, buffer, None)).exitValue() | ||
assert(code == 1, "Exit code for -h was not 1: " + code) | ||
|
||
val output = buffer.toString.replaceAll("\n", "") | ||
|
||
val expectedHelpSamples = Seq( | ||
"-h | -help", "print this message", | ||
"-jvm-debug", | ||
"JAVA_OPTS", | ||
"special option" | ||
) | ||
|
||
assert(expectedHelpSamples.forall(output.contains(_)), | ||
s"Application did not print the correct help message: \n" + output) | ||
} |
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.github.sbt" % "sbt-native-packager" % sys.props("project.version")) |
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 MainApp extends App { | ||
println("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,4 @@ | ||
# Run the staging and check the script. | ||
> stage | ||
$ exists target/**/universal/stage/bin/script-help | ||
> runCheck |