public virtual String buildCompilerInvocation(String command, bool alt) { command = command.Expand(); var magicPrefix = "scalac "; if (!command.StartsWith(magicPrefix)) { println("scalac: compiler command must start from \"" + magicPrefix + "\""); return null; } command = command.Substring(magicPrefix.Length); var javaParts = command.Split(' ').Where(part => part.StartsWith("-D")).ToList(); var javaNoDefaults = javaParts.Contains("-Dnodefault") || javaParts.Contains("-Dnodefaults"); javaParts = javaParts.Where(part => part != "-Dnodefault" && part != "-Dnodefaults").ToList(); if (!javaNoDefaults) javaParts = Enumerable.Concat(defaultJavaopts.Split(' '), javaParts).ToList(); javaParts.ToList().ForEach(part => { if (part.StartsWith("-Dno")) { var negation = "-D" + part.Substring(4); javaParts.Remove(part); javaParts.Remove(negation); } }); var javaOpts = String.Join(" ", javaParts.ToArray()); if (Config.sublime) javaOpts += " -Djline.terminal=scala.tools.jline.UnsupportedTerminal"; var scalaParts = command.Split(' ').Where(part => !part.StartsWith("-D")).ToList(); var scalaNoDefaults = scalaParts.Contains("-nodefault") || scalaParts.Contains("-nodefaults"); scalaParts = scalaParts.Where(part => part != "-nodefault" && part != "-nodefaults").ToList(); if (!scalaNoDefaults) scalaParts = Enumerable.Concat(defaultScalaopts.Split(' '), scalaParts).ToList(); scalaParts.ToList().ForEach(part => { if (part.StartsWith("-no")) { var negation = "-" + part.Substring(3); scalaParts.Remove(part); scalaParts.Remove(negation); } }); var scalaOpts = String.Join(" ", scalaParts.ToArray()); var f_classpathConfig = new FileInfo("%SCRIPTS_HOME%/scalac.classpath".Expand()); var useBootClasspath = f_classpathConfig.Exists && File.ReadAllText(f_classpathConfig.FullName) == "boot"; var nobootTemplate = @"%JAVA_HOME%\bin\java.exe -cp ""$CLASSPATH$"" $JAVAOPTS$ scala.tools.nsc.Main $SCALAOPTS$"; var bootTemplate = @"%JAVA_HOME%\bin\java.exe -Xbootclasspath/a:""$CLASSPATH$"" $JAVAOPTS$ scala.tools.nsc.Main $SCALAOPTS$"; command = useBootClasspath ? bootTemplate : nobootTemplate; command = command.Replace("$CLASSPATH$", inferScalaClasspath(alt)); command = command.Replace("$JAVAOPTS$", javaOpts); command = command.Replace("$SCALAOPTS$", scalaOpts); // println(command); return command.Expand(); }