mirror of https://github.com/sbt/sbt.git
**Problem**
Scripts with scalaVersion 3.x in /*** */ and a shebang fail: -Xscript is
ignored by Scala 3, and the shebang line causes "Expected a toplevel
definition".
**Solution**
- Strip shebang when copying the script so the compiler never sees it.
- For Scala 3 only: do not add -Xscript; generate Main.scala wrapping the
script body in object Main { def main(...) = { ... } }; use it as the
single source and set run/mainClass to Main.
- For Scala 2: keep existing behavior (shebang stripped, -Xscript + script
base name).
- Use Def.uncached and ScalaArtifacts.isScala3(scalaVersion.value) so
embedded scalaVersion from /*** */ is respected.
|
||
|---|---|---|
| .. | ||
| src | ||
| NOTICE | ||