-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add addApp function to align with bash version (#1339)
Co-authored-by: Nepomuk Seiler <muuki88@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
38 additions
and
1 deletion.
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,23 @@ | ||
enablePlugins(JavaAppPackaging, AshScriptPlugin) | ||
|
||
name := "simple-app" | ||
|
||
version := "0.1.0" | ||
|
||
bashScriptExtraDefines ++= Seq("""addApp "info"""", """addApp "help"""") | ||
|
||
TaskKey[Unit]("scriptCheck") := { | ||
val startScript = (stagingDirectory in Universal).value / "bin" / executableScriptName.value | ||
val options = IO.read(startScript) | ||
assert(options contains """addApp "info"""", "Script doesn't contain app setting:\n" + options) | ||
assert(options contains """addApp "help"""", "Script doesn't contain app setting:\n" + options) | ||
} | ||
|
||
TaskKey[Unit]("runCheck") := { | ||
val cwd = (stagingDirectory in Universal).value | ||
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath) | ||
val output = (sys.process.Process(cmd, cwd).!!).replaceAll("\n", "") | ||
|
||
assert(output.contains("info"), s"Application did not receive residual arg 'info'") | ||
assert(output.contains("help"), s"Application did not receive residual arg 'help'") | ||
} |
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/ash/add-app-settings/src/main/scala/MainApp.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 MainApp extends App { | ||
println(args.mkString("|")) | ||
} |
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/bin/simple-app | ||
> scriptCheck | ||
> runCheck |