Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

Commit cf768b5

Browse files
committed
Add javac tool args to javac invocation
Examines .java file header for "tool args" comments of the form `javac: -deprecation`.
1 parent 96c3c00 commit cf768b5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/main/scala/scala/tools/partest/nest/Runner.scala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner) {
111111
joinPaths(outDir :: testClassPath),
112112
"-J-Duser.language=en",
113113
"-J-Duser.country=US"
114-
) ++ files.map(_.getAbsolutePath)
114+
) ++ (toolArgsFor(files)("javac")
115+
) ++ (files.map(_.getAbsolutePath)
116+
)
115117

116118
pushTranscript(args mkString " ")
117119
val captured = StreamCapture(runCommand(args, logFile))
@@ -439,7 +441,12 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner) {
439441
perTest ++ perGroup
440442
}
441443

442-
def toolArgs(tool: String, split: Boolean = true): List[String] = {
444+
// inspect sources for tool args
445+
def toolArgs(tool: String, split: Boolean = true): List[String] =
446+
toolArgsFor(sources(testFile))(tool, split)
447+
448+
// inspect given files for tool args
449+
def toolArgsFor(files: List[File])(tool: String, split: Boolean = true): List[String] = {
443450
def argsplitter(s: String) = if (split) words(s) filter (_.nonEmpty) else List(s)
444451
def argsFor(f: File): List[String] = {
445452
import scala.util.matching.Regex
@@ -453,7 +460,7 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner) {
453460
} finally src.close()
454461
args.flatten map argsplitter getOrElse Nil
455462
}
456-
sources(testFile) flatMap argsFor
463+
files flatMap argsFor
457464
}
458465

459466
abstract class CompileRound {

0 commit comments

Comments
 (0)