sbt/main
bitloi e12b3c9b9a
[2.x] fix: Fixes script mode using Scala 3.x (#8900)
**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.
2026-03-14 23:28:34 -04:00
..
src [2.x] fix: Fixes script mode using Scala 3.x (#8900) 2026-03-14 23:28:34 -04:00
NOTICE Transfer copyright to Scala Center 2023-06-20 16:39:07 +02:00