mirror of https://github.com/sbt/sbt.git
Do not compute name hashes when name hashing is disabled
We should compute name hashes only when name hashing is enabled. Otherwise, we just store an empty value for name hashes.
This commit is contained in:
parent
b9489c6035
commit
dcb327e6f4
|
|
@ -146,10 +146,18 @@ private final class AnalysisCallback(internalMap: File => Option[File], external
|
|||
classToSource.put(module, source)
|
||||
}
|
||||
|
||||
// empty value used when name hashing algorithm is disabled
|
||||
private val emptyNameHashes = new xsbti.api._internalOnly_NameHashes(Array.empty, Array.empty)
|
||||
|
||||
def api(sourceFile: File, source: SourceAPI) {
|
||||
import xsbt.api.{APIUtil, HashAPI}
|
||||
if (APIUtil.isScalaSourceName(sourceFile.getName) && APIUtil.hasMacro(source)) macroSources += sourceFile
|
||||
publicNameHashes(sourceFile) = (new NameHashing).nameHashes(source)
|
||||
publicNameHashes(sourceFile) = {
|
||||
if (nameHashing)
|
||||
(new NameHashing).nameHashes(source)
|
||||
else
|
||||
emptyNameHashes
|
||||
}
|
||||
val shouldMinimize = !Incremental.apiDebug(options)
|
||||
val savedSource = if (shouldMinimize) APIUtil.minimize(source) else source
|
||||
apis(sourceFile) = (HashAPI(source), savedSource)
|
||||
|
|
|
|||
Loading…
Reference in New Issue