-
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.
fix support for top-level
main
methods in Scala 3 (#1592)
* correctly escape app_mainclass variable * add scripted test * add ash test * use sbt 1.9.9 for top-level-main test * actually run command-line-settings test * don't `eval` everything but only `$residual_args` in ash-template * correct escaping of scary shell meta characters in ash-template * check more scary metacharacters, factor escaping out into a function * test more crazy edge cases * avoid some backslashes * more shell nasty! * improve `checkComplexResidual` test * fix an expansion that doesn't work in `ash`
- Loading branch information
1 parent
37fcec3
commit cb29893
Showing
14 changed files
with
67 additions
and
8 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
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
$ exists target/universal/stage/bin/command-line-app | ||
> checkSystemProperty | ||
> checkResidual | ||
> checkComplexResidual |
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,16 @@ | ||
import com.typesafe.sbt.packager.Compat._ | ||
|
||
enablePlugins(AshScriptPlugin) | ||
|
||
name := "top-level-main" | ||
|
||
version := "0.1.0" | ||
|
||
scalaVersion := "3.3.3" | ||
|
||
TaskKey[Unit]("runCheck") := { | ||
val cwd = (stagingDirectory in Universal).value | ||
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath) | ||
val output = sys.process.Process(cmd, cwd).!! | ||
assert(output contains "SUCCESS!", "Output didn't contain success: " + 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 @@ | ||
sbt.version=1.9.9 |
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,2 @@ | ||
def main(args: Array[String]): Unit = | ||
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,3 @@ | ||
# Run the staging and check the script. | ||
> stage | ||
> 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,16 @@ | ||
import com.typesafe.sbt.packager.Compat._ | ||
|
||
enablePlugins(JavaAppPackaging) | ||
|
||
name := "top-level-main" | ||
|
||
version := "0.1.0" | ||
|
||
scalaVersion := "3.3.3" | ||
|
||
TaskKey[Unit]("runCheck") := { | ||
val cwd = (stagingDirectory in Universal).value | ||
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath) | ||
val output = sys.process.Process(cmd, cwd).!! | ||
assert(output contains "SUCCESS!", "Output didn't contain success: " + 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 @@ | ||
sbt.version=1.9.9 |
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")) |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/bash/top-level-main/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,2 @@ | ||
def main(args: Array[String]) = | ||
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,3 @@ | ||
# Run the staging and check the script. | ||
> stage | ||
> runCheck |