short-circuit the macro check in the incremental compiler if the source isn't a Scala source file

This commit is contained in:
Mark Harrah 2013-02-22 16:31:32 -05:00
parent 68443fc047
commit 6e30bd7842
2 changed files with 3 additions and 1 deletions

View File

@ -16,6 +16,8 @@ object APIUtil
new Modifiers( x(0), x(1), x(2), x(3), x(4), x(5), x(6) )
}
def isScalaSourceName(name: String): Boolean = name.endsWith(".scala")
def hasMacro(s: SourceAPI): Boolean =
{
val check = new HasMacro

View File

@ -128,7 +128,7 @@ private final class AnalysisCallback(internalMap: File => Option[File], external
def api(sourceFile: File, source: SourceAPI) {
import xsbt.api.{APIUtil, HashAPI}
if (APIUtil.hasMacro(source)) macroSources += sourceFile
if (APIUtil.isScalaSourceName(sourceFile.getName) && APIUtil.hasMacro(source)) macroSources += sourceFile
val shouldMinimize = !Incremental.apiDebug(options)
val savedSource = if (shouldMinimize) APIUtil.minimize(source) else source
apis(sourceFile) = (HashAPI(source), savedSource)