File tree Expand file tree Collapse file tree 4 files changed +16
-1
lines changed
test-coursier/dotty/tools/coursier Expand file tree Collapse file tree 4 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,8 @@ object MainGenericRunner {
7272 val classpathSeparator = File .pathSeparator
7373
7474 @ sharable val javaOption = raw """ -J(.*) """ .r
75-
75+ @ sharable val scalaOption = raw """ @.* """ .r
76+ @ sharable val colorOption = raw """ -color:.* """ .r
7677 @ tailrec
7778 def process (args : List [String ], settings : Settings ): Settings = args match
7879 case Nil =>
@@ -98,6 +99,10 @@ object MainGenericRunner {
9899 process(tail, settings.withSave)
99100 case (o @ javaOption(striped)) :: tail =>
100101 process(tail, settings.withJavaArgs(striped).withScalaArgs(o))
102+ case (o @ scalaOption(_* )) :: tail =>
103+ process(tail, settings.withScalaArgs(o))
104+ case (o @ colorOption(_* )) :: tail =>
105+ process(tail, settings.withScalaArgs(o))
101106 case arg :: tail =>
102107 val line = Try (Source .fromFile(arg).getLines.toList).toOption.flatMap(_.headOption)
103108 if arg.endsWith(" .scala" ) || arg.endsWith(" .sc" ) || (line.nonEmpty && raw " #!.*scala " .r.matches(line.get)) then
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ object Main:
1313 assert(rest.size >= 2 , s " internal error: rest == Array( ${rest.mkString(" ," )}) " )
1414
1515 val file = File (rest(1 ))
16+ // write script path to script.path property, so called script can see it
17+ sys.props(" script.path" ) = file.toPath.toAbsolutePath.toString
1618 val scriptArgs = rest.drop(2 )
1719 var saveJar = false
1820 var invokeFlag = true // by default, script main method is invoked
Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ class CoursierScalaTests:
5252 assertEquals(expectedOutput, output)
5353 scriptArgs()
5454
55+ def scriptPath () =
56+ val scriptPath = scripts(" /scripting" ).find(_.getName == " showArgs.sc" ).get.absPath
57+ val args = scriptPath
58+ val output = CoursierScalaTests .csCmd(args* )
59+ assertTrue(output.startsWith(" script.path:" ))
60+ scriptPath()
61+
5562 def version () =
5663 val output = CoursierScalaTests .csCmd(" -version" )
5764 assertTrue(output.mkString(" \n " ).contains(sys.env(" DOTTY_BOOTSTRAPPED_VERSION" )))
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ source "$PROG_HOME/bin/common"
3030
3131# exec here would prevent onExit from being called, leaving terminal in unusable state
3232compilerJavaClasspathArgs
33+ [ -z " ${ConEmuPID-} " -o -n " ${cygwin-} " ] && export MSYSTEM= PWD= # workaround for #12405
3334eval " \" $JAVACMD \" " " -classpath \" $jvm_cp_args \" " " dotty.tools.MainGenericRunner" " -classpath \" $jvm_cp_args \" " " $@ "
3435scala_exit_status=$?
3536
You can’t perform that action at this time.
0 commit comments