diff options
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/ant/templates/tool-unix.tmpl | 5 | ||||
-rw-r--r-- | src/compiler/scala/tools/ant/templates/tool-windows.tmpl | 10 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Main.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/Properties.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala | 29 |
5 files changed, 27 insertions, 36 deletions
diff --git a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl index 913a747e48..2233056bb3 100644 --- a/src/compiler/scala/tools/ant/templates/tool-unix.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-unix.tmpl @@ -70,7 +70,4 @@ if $cygwin; then BOOT_CLASSPATH=`cygpath --path --$format "$BOOT_CLASSPATH"` fi -ILASM=`which ilasm 2>/dev/null` -[ -x "$ILASM" ] || ILASM="" - -${JAVACMD:=java} ${JAVA_OPTS:=@javaflags@} -Xbootclasspath/a:"$BOOT_CLASSPATH" -cp "$EXTENSION_CLASSPATH" -Dscala.home="$SCALA_HOME" -Denv.classpath="$CLASSPATH" -Dilasm.tool="$ILASM" @properties@ @class@ @toolflags@ "$@@" +${JAVACMD:=java} ${JAVA_OPTS:=@javaflags@} -Xbootclasspath/a:"$BOOT_CLASSPATH" -cp "$EXTENSION_CLASSPATH" -Dscala.home="$SCALA_HOME" -Denv.classpath="$CLASSPATH" @properties@ @class@ @toolflags@ "$@@" diff --git a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl index 0809b2c117..492614d238 100644 --- a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl +++ b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl @@ -34,10 +34,6 @@ rem We use the value of the JAVA_OPTS environment variable if defined set _JAVA_OPTS=%JAVA_OPTS%
if "%_JAVA_OPTS%"=="" set _JAVA_OPTS=@javaflags@
-rem We use the value of the ILASM environment variable if defined
-set _ILASM=%ILASM%
-if "%_ILASM%"=="" call :find_ilasm ilasm.exe
-
set _EXTENSION_CLASSPATH=@extclasspath@
if "%_EXTENSION_CLASSPATH%"=="" (
for %%f in ("%_SCALA_HOME%\lib\*") do call :add_cpath "%%f"
@@ -56,7 +52,7 @@ if "%_BOOT_CLASSPATH%"=="" ( )
)
-set _PROPS=-Dscala.home="%_SCALA_HOME%" -Denv.classpath="%CLASSPATH%" -Dilasm.tool="%_ILASM%" @properties@
+set _PROPS=-Dscala.home="%_SCALA_HOME%" -Denv.classpath="%CLASSPATH%" @properties@
rem echo %_JAVACMD% -Xbootclasspath/a:"%_BOOT_CLASSPATH%" %_JAVA_OPTS% %_PROPS% -cp "%_EXTENSION_CLASSPATH%" @class@ @toolflags@ %_ARGS%
%_JAVACMD% -Xbootclasspath/a:"%_BOOT_CLASSPATH%" %_JAVA_OPTS% %_PROPS% -cp "%_EXTENSION_CLASSPATH%" @class@ @toolflags@ %_ARGS%
@@ -82,10 +78,6 @@ rem set _SCALA_HOME=%~dps0.. set _SCALA_HOME=%_BIN_DIR%..
goto :eof
-:find_ilasm
- set _ILASM=%~$PATH:1
-goto :eof
-
:set_args
set _ARGS=
:loop
diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala index ced42db739..cc50e71d9b 100644 --- a/src/compiler/scala/tools/nsc/Main.scala +++ b/src/compiler/scala/tools/nsc/Main.scala @@ -6,6 +6,8 @@ package scala.tools.nsc +import java.io.File + import scala.tools.nsc.doc.{DocDriver => DocGenerator} import scala.tools.nsc.reporters.{Reporter, ConsoleReporter} import scala.tools.nsc.util.FakePos //{Position} @@ -46,6 +48,12 @@ object Main extends AnyRef with EvalLoop { if (command.settings.version.value) reporter.info(null, versionMsg, true) else { + if (command.settings.target.value == "msil") { + val libpath = System.getProperty("msil.libpath") + if (libpath != null) + command.settings.assemrefs.value = + command.settings.assemrefs.value + File.pathSeparator + libpath + } try { object compiler extends Global(command.settings, reporter) if (reporter.hasErrors) { diff --git a/src/compiler/scala/tools/nsc/Properties.scala b/src/compiler/scala/tools/nsc/Properties.scala index 2ec544b7e0..9f3001c9e0 100644 --- a/src/compiler/scala/tools/nsc/Properties.scala +++ b/src/compiler/scala/tools/nsc/Properties.scala @@ -53,13 +53,6 @@ object Properties { val cmdName: String = if (isWin) "scala.bat" else "scala" - val ilasmFormat: java.text.MessageFormat = { - val ilasm = System.getProperty("ilasm.tool", "") - if (ilasm == "") null - else - new java.text.MessageFormat(ilasm + ( - if (isWin) " /quiet /exe /output={0} {1}" - else " --format exe --output={0} {1}" - )) - } + val msilILasm: String = + System.getProperty("msil.ilasm", "") } diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala index 2c883c2513..115eb8e7ff 100644 --- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala +++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala @@ -455,21 +455,22 @@ abstract class GenMSIL extends SubComponent { createTypes() val filename = new File(outDir, assemName + ".msil").getPath() if (settings.debug.value) - log("output file name: " + filename) + log("Output file name: " + filename) try { massembly.Save(filename) -// val fm = Properties.ilasmFormat -// if (fm != null) { -// val exeName = new File(outDir, assemName + ".exe").getPath() -// val cmd = fm.format(Array(/*output*/exeName, /*input*/filename)) -// try { -// Runtime.getRuntime().exec(cmd) -// } catch { -// case ex: java.io.IOException => -// Console.println("Cannot run command: " + cmd) -// exit(1) -// } -// } + val ilasm = Properties.msilILasm + if (ilasm != "") { + val cmd = ilasm + " " + filename + if (settings.debug.value) + log("Executing command: " + cmd) + try { + Runtime.getRuntime().exec(cmd) + } catch { + case _ => + Console.println("Cannot run command: " + cmd) + exit(1) + } + } } catch { case _: Error => abort("Could not save file " + filename) } @@ -1288,7 +1289,7 @@ abstract class GenMSIL extends SubComponent { case LOAD_MODULE(module) => if (settings.debug.value) - log("genearting LOAD_MODULE for: " + showsym(module)) + log("Generating LOAD_MODULE for: " + showsym(module)) mcode.Emit(OpCodes.Ldsfld, getModuleInstanceField(module)) case STORE_ARRAY_ITEM(kind) => |