Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gkossakowski/8325674 to your computer and use it in GitHub Desktop.
Save gkossakowski/8325674 to your computer and use it in GitHub Desktop.
From dfc0d56bb05fdf92bf343eae96a0487b89eb8412 Mon Sep 17 00:00:00 2001
From: Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com>
Date: Wed, 8 Jan 2014 22:50:54 +0100
Subject: [PATCH] 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.
---
compile/inc/src/main/scala/sbt/inc/Compile.scala | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/compile/inc/src/main/scala/sbt/inc/Compile.scala b/compile/inc/src/main/scala/sbt/inc/Compile.scala
index edf714f..925e8fd 100644
--- a/compile/inc/src/main/scala/sbt/inc/Compile.scala
+++ b/compile/inc/src/main/scala/sbt/inc/Compile.scala
@@ -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)
--
1.8.1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment