File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
src/compiler/scala/tools/nsc Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1446,7 +1446,24 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
14461446
14471447 private def printArgs (sources : List [SourceFile ]): Unit = {
14481448 if (settings.printArgs.isSetByUser) {
1449- val argsFile = (settings.recreateArgs ::: sources.map(_.file.absolute.toString())).mkString(" " , " \n " , " \n " )
1449+ val saved = settings.printArgs.value
1450+ val argsFile = try {
1451+ val singleOuputDir : List [String ] = if (settings.d.value == settings.d.default) {
1452+ settings.outputDirs.getSingleOutput match {
1453+ case Some (file) =>
1454+ val jfile = file.file
1455+ if (jfile != null && ! java.nio.file.Files .isSameFile(jfile.toPath, java.nio.file.Paths .get(settings.d.value))) {
1456+ // A build tool must have used `settings.outDirs.setSingleOutput`, bypassing `-d`.
1457+ // Render that to the equivalent -d arguments.
1458+ " -d" :: jfile.toString :: Nil
1459+ } else Nil
1460+ case _ => Nil
1461+ }
1462+ } else Nil
1463+ (settings.recreateArgs ::: singleOuputDir ::: sources.map(_.file.absolute.toString())).mkString(" " , " \n " , " \n " )
1464+ } finally {
1465+ settings.printArgs.value = saved
1466+ }
14501467 settings.printArgs.value match {
14511468 case " -" =>
14521469 reporter.echo(argsFile)
You can’t perform that action at this time.
0 commit comments