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 {
72
72
val classpathSeparator = File .pathSeparator
73
73
74
74
@ sharable val javaOption = raw """ -J(.*) """ .r
75
-
75
+ @ sharable val scalaOption = raw """ @.* """ .r
76
+ @ sharable val colorOption = raw """ -color:.* """ .r
76
77
@ tailrec
77
78
def process (args : List [String ], settings : Settings ): Settings = args match
78
79
case Nil =>
@@ -98,6 +99,10 @@ object MainGenericRunner {
98
99
process(tail, settings.withSave)
99
100
case (o @ javaOption(striped)) :: tail =>
100
101
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))
101
106
case arg :: tail =>
102
107
val line = Try (Source .fromFile(arg).getLines.toList).toOption.flatMap(_.headOption)
103
108
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:
13
13
assert(rest.size >= 2 , s " internal error: rest == Array( ${rest.mkString(" ," )}) " )
14
14
15
15
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
16
18
val scriptArgs = rest.drop(2 )
17
19
var saveJar = false
18
20
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:
52
52
assertEquals(expectedOutput, output)
53
53
scriptArgs()
54
54
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
+
55
62
def version () =
56
63
val output = CoursierScalaTests .csCmd(" -version" )
57
64
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"
30
30
31
31
# exec here would prevent onExit from being called, leaving terminal in unusable state
32
32
compilerJavaClasspathArgs
33
+ [ -z " ${ConEmuPID-} " -o -n " ${cygwin-} " ] && export MSYSTEM= PWD= # workaround for #12405
33
34
eval " \" $JAVACMD \" " " -classpath \" $jvm_cp_args \" " " dotty.tools.MainGenericRunner" " -classpath \" $jvm_cp_args \" " " $@ "
34
35
scala_exit_status=$?
35
36
You can’t perform that action at this time.
0 commit comments