Updated Scalac to support a mode (triggered by setting 'scalacdebugging' to true) that prints the compiled files and any stack trace generated by the compiler.
Use it in SABBUS for quick and strap. git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@5583 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
233eea8ad3
commit
992c0eebc4
18
build.xml
18
build.xml
|
@ -375,7 +375,8 @@ BUILD QUICK-TEST LAYER
|
|||
<locker srcdir="${src.dir}/${lib.dir.name}"
|
||||
destdir="${quick.lib.dir}"
|
||||
usepredefs="no"
|
||||
addparams="${nsc.params}">
|
||||
addparams="${nsc.params}"
|
||||
scalacdebugging="yes">
|
||||
<classpath>
|
||||
<pathelement location="${quick.lib.dir}"/>
|
||||
</classpath>
|
||||
|
@ -384,7 +385,8 @@ BUILD QUICK-TEST LAYER
|
|||
</locker>
|
||||
<locker srcdir="${src.dir}/${lib.dir.name}"
|
||||
destdir="${quick.lib.dir}"
|
||||
addparams="${nsc.params}">
|
||||
addparams="${nsc.params}"
|
||||
scalacdebugging="yes">
|
||||
<classpath>
|
||||
<pathelement location="${quick.lib.dir}"/>
|
||||
</classpath>
|
||||
|
@ -406,7 +408,8 @@ BUILD QUICK-TEST LAYER
|
|||
</pico>
|
||||
<locker srcdir="${src.dir}/${comp.dir.name}"
|
||||
destdir="${quick.comp.dir}"
|
||||
addparams="${nsc.params}">
|
||||
addparams="${nsc.params}"
|
||||
scalacdebugging="yes">
|
||||
<classpath>
|
||||
<pathelement location="${quick.lib.dir}"/>
|
||||
<pathelement location="${quick.comp.dir}"/>
|
||||
|
@ -471,7 +474,8 @@ TEST
|
|||
<quick srcdir="${src.dir}/${lib.dir.name}"
|
||||
destdir="${strap.lib.dir}"
|
||||
usepredefs="no"
|
||||
addparams="${nsc.params}">
|
||||
addparams="${nsc.params}"
|
||||
scalacdebugging="yes">
|
||||
<classpath>
|
||||
<pathelement location="${strap.lib.dir}"/>
|
||||
</classpath>
|
||||
|
@ -480,7 +484,8 @@ TEST
|
|||
</quick>
|
||||
<quick srcdir="${src.dir}/${lib.dir.name}"
|
||||
destdir="${strap.lib.dir}"
|
||||
addparams="${nsc.params}">
|
||||
addparams="${nsc.params}"
|
||||
scalacdebugging="yes">
|
||||
<classpath>
|
||||
<pathelement location="${strap.lib.dir}"/>
|
||||
</classpath>
|
||||
|
@ -502,7 +507,8 @@ TEST
|
|||
</pico>
|
||||
<quick srcdir="${src.dir}/${comp.dir.name}"
|
||||
destdir="${strap.comp.dir}"
|
||||
addparams="${nsc.params}">
|
||||
addparams="${nsc.params}"
|
||||
scalacdebugging="yes">
|
||||
<classpath>
|
||||
<pathelement location="${strap.lib.dir}"/>
|
||||
<pathelement location="${strap.comp.dir}"/>
|
||||
|
|
|
@ -118,6 +118,10 @@ package scala.tools.ant {
|
|||
/** Instruct the compiler to generate debugging information */
|
||||
private var addParams: String = ""
|
||||
|
||||
/** Whether the compiler is being debuged. Prints more information in case
|
||||
* in case of failure. */
|
||||
private var scalacDebugging: Boolean = false
|
||||
|
||||
/******************************************************************************\
|
||||
** Properties setters **
|
||||
\******************************************************************************/
|
||||
|
@ -262,6 +266,10 @@ package scala.tools.ant {
|
|||
def setAddparams(input: String): Unit =
|
||||
addParams = input
|
||||
|
||||
/** Set the scalac debugging attribute. */
|
||||
def setScalacdebugging(input: Boolean): Unit =
|
||||
scalacDebugging = input
|
||||
|
||||
/******************************************************************************\
|
||||
** Properties getters **
|
||||
\******************************************************************************/
|
||||
|
@ -380,27 +388,40 @@ package scala.tools.ant {
|
|||
// If force is false, only files were the .class file in destination is
|
||||
// older than the .scala file will be used.
|
||||
val sourceFiles: List[File] =
|
||||
for (val originDir <- getOrigin;
|
||||
val originFile <- {
|
||||
var includedFiles =
|
||||
getDirectoryScanner(originDir).getIncludedFiles()
|
||||
if (!force) {
|
||||
includedFiles = new SourceFileScanner(this).
|
||||
restrict(includedFiles, originDir, destination.get, mapper)
|
||||
}
|
||||
(List.fromArray(includedFiles)).
|
||||
map(nameToFile(originDir))
|
||||
})
|
||||
yield {
|
||||
for {
|
||||
val originDir <- getOrigin;
|
||||
val originFile <- {
|
||||
var includedFiles =
|
||||
getDirectoryScanner(originDir).getIncludedFiles()
|
||||
if (!force) {
|
||||
includedFiles = new SourceFileScanner(this).
|
||||
restrict(includedFiles, originDir, destination.get, mapper)
|
||||
}
|
||||
val list = List.fromArray(includedFiles)
|
||||
if (scalacDebugging && list.length > 0)
|
||||
log(
|
||||
list.mkString(
|
||||
"Compiling source file" +
|
||||
(if (list.length > 1) "s: " else ": "),
|
||||
", ",
|
||||
" "
|
||||
) + "to " + getDestination.toString()
|
||||
)
|
||||
else if (list.length > 0)
|
||||
log(
|
||||
"Compiling " + list.length + " source file" +
|
||||
(if (list.length > 1) "s" else "") +
|
||||
(" to " + getDestination.toString())
|
||||
)
|
||||
else
|
||||
log("No files selected for compilation", Project.MSG_VERBOSE)
|
||||
|
||||
list
|
||||
}
|
||||
} yield {
|
||||
log(originFile.toString(), Project.MSG_DEBUG)
|
||||
originFile
|
||||
nameToFile(originDir)(originFile)
|
||||
}
|
||||
|
||||
if (sourceFiles.length == 0)
|
||||
log("No files selected for compilation", Project.MSG_VERBOSE)
|
||||
else log("Compiling " + sourceFiles.length + " source file" +
|
||||
(if (sourceFiles.length > 1) "s" else "") +
|
||||
(" to " + getDestination.toString()))
|
||||
|
||||
// Builds-up the compilation settings for Scalac with the existing Ant
|
||||
// parameters.
|
||||
|
@ -446,27 +467,30 @@ package scala.tools.ant {
|
|||
try {
|
||||
(new compiler.Run).compile(sourceFiles.map(f:File=>f.toString()))
|
||||
if (reporter.errors > 0)
|
||||
error("Compile failed with " +
|
||||
reporter.errors + " error" +
|
||||
(if (reporter.errors > 1) "s" else "") +
|
||||
"; see the compiler error output for details."
|
||||
)
|
||||
}
|
||||
catch {
|
||||
case exception @ FatalError(msg) => {
|
||||
exception.printStackTrace()
|
||||
if (settings.debug.value) exception.printStackTrace()
|
||||
error("Compile failed because of an internal compiler error (" + msg +
|
||||
"); see the error output for details.")
|
||||
}
|
||||
}
|
||||
if (reporter.warnings > 0)
|
||||
log("Compile suceeded with " +
|
||||
error (
|
||||
"Compile failed with " +
|
||||
reporter.errors + " error" +
|
||||
(if (reporter.errors > 1) "s" else "") +
|
||||
"; see the compiler error output for details."
|
||||
)
|
||||
else if (reporter.warnings > 0)
|
||||
log (
|
||||
"Compile suceeded with " +
|
||||
reporter.warnings + " warning" +
|
||||
(if (reporter.warnings > 1) "s" else "") +
|
||||
"; see the compiler output for details."
|
||||
)
|
||||
reporter.printSummary()
|
||||
)
|
||||
reporter.printSummary()
|
||||
} catch {
|
||||
case exception: Throwable if (exception.getMessage != null) =>
|
||||
if (scalacDebugging) exception.printStackTrace()
|
||||
error("Compile failed because of an internal compiler error (" +
|
||||
exception.getMessage + "); see the error output for details.")
|
||||
case exception =>
|
||||
if (scalacDebugging) exception.printStackTrace()
|
||||
error("Compile failed because of an internal compiler error " +
|
||||
"(no error message provided); see the error output for details.")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue