mirror of https://github.com/sbt/sbt.git
Adapt to changes to DefinesClass in zinc
The definition of `DefinesClass` has changed from being a function `File => String => Boolean` to just a function `String => Boolean`. The changes in this commit reflect that fact. Also, this commit implements a newly introduced PerClasspathEntryLookup.
This commit is contained in:
parent
e8c5ff0ffe
commit
824b59a3ef
|
|
@ -8,7 +8,6 @@ import sbt.internal.inc.{ Analysis, AnalyzingCompiler, ClasspathOptions, Compile
|
|||
import xsbti.{ Logger => _, _ }
|
||||
import xsbti.compile.{ CompileOrder, Compilers, CompileResult, GlobalsCache, IncOptions, Inputs, MiniSetup }
|
||||
import CompileOrder.{ JavaThenScala, Mixed, ScalaThenJava }
|
||||
import Locate.DefinesClass
|
||||
import java.io.File
|
||||
|
||||
import sbt.internal.librarymanagement.{ ComponentManager, IvyConfiguration }
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import Scope.{ fillTaskAxis, GlobalScope, ThisScope }
|
|||
import sbt.internal.librarymanagement.mavenint.{ PomExtraDependencyAttributes, SbtPomExtraProperties }
|
||||
import xsbt.api.Discovery
|
||||
import xsbti.compile.{ CompileAnalysis, CompileOptions, CompileOrder, CompileResult, DefinesClass, IncOptions, IncOptionsUtil, Inputs, MiniSetup, PreviousResult, Setup, TransactionalManagerType }
|
||||
import xsbti.compile.PerClasspathEntryLookup
|
||||
import Project.{ inConfig, inScope, inTask, richInitialize, richInitializeTask, richTaskSessionVar }
|
||||
import Def.{ Initialize, ScopedKey, Setting, SettingsDefinition }
|
||||
import sbt.internal.librarymanagement.{ CustomPomParser, DependencyFilter }
|
||||
|
|
@ -88,7 +89,7 @@ object Defaults extends BuildCommon {
|
|||
apiMappings := Map.empty,
|
||||
autoScalaLibrary :== true,
|
||||
managedScalaInstance :== true,
|
||||
definesClass :== FileValueCache(Locate.definesClass _).get,
|
||||
classpathEntryDefinesClass :== FileValueCache(Locate.definesClass _).get,
|
||||
traceLevel in run :== 0,
|
||||
traceLevel in runMain :== 0,
|
||||
traceLevel in console :== Int.MaxValue,
|
||||
|
|
@ -886,13 +887,17 @@ object Defaults extends BuildCommon {
|
|||
finally x.close() // workaround for #937
|
||||
}
|
||||
def compileIncSetupTask = Def.task {
|
||||
val dc: File => DefinesClass = {
|
||||
val dc = definesClass.value
|
||||
f => new DefinesClass { override def apply(className: String): Boolean = dc(f)(className) }
|
||||
val lookup = new PerClasspathEntryLookup {
|
||||
private val cachedAnalysisMap = analysisMap(dependencyClasspath.value)
|
||||
private val cachedPerEntryDefinesClassLookup = Keys.classpathEntryDefinesClass.value
|
||||
|
||||
override def analysis(classpathEntry: File): Maybe[CompileAnalysis] =
|
||||
o2m(cachedAnalysisMap(classpathEntry))
|
||||
override def definesClass(classpathEntry: File): DefinesClass =
|
||||
cachedPerEntryDefinesClassLookup(classpathEntry)
|
||||
}
|
||||
new Setup(
|
||||
f1(t => o2m(analysisMap(dependencyClasspath.value)(t))),
|
||||
f1(dc),
|
||||
lookup,
|
||||
(skip in compile).value,
|
||||
// TODO - this is kind of a bad way to grab the cache directory for streams...
|
||||
streams.value.cacheDirectory / compileAnalysisFilename.value,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import java.net.URL
|
|||
import scala.concurrent.duration.{ FiniteDuration, Duration }
|
||||
import Def.ScopedKey
|
||||
import sbt.internal.util.complete._
|
||||
import sbt.internal.inc.Locate.DefinesClass
|
||||
import xsbti.compile.DefinesClass
|
||||
import sbt.internal.inc.{ ClasspathOptions, MixedAnalyzingCompiler, ScalaInstance }
|
||||
import std.TaskExtra._
|
||||
import xsbti.compile.{ CompileAnalysis, CompileOptions, CompileOrder, Compilers, CompileResult, GlobalsCache, IncOptions, Inputs, PreviousResult, Setup }
|
||||
|
|
@ -195,7 +195,7 @@ object Keys {
|
|||
val compileIncSetup = TaskKey[Setup]("inc-compile-setup", "Configures aspects of incremental compilation.", DTask)
|
||||
val compilerCache = TaskKey[GlobalsCache]("compiler-cache", "Cache of scala.tools.nsc.Global instances. This should typically be cached so that it isn't recreated every task run.", DTask)
|
||||
val stateCompilerCache = AttributeKey[GlobalsCache]("compiler-cache", "Internal use: Global cache.")
|
||||
val definesClass = TaskKey[DefinesClass]("defines-class", "Internal use: provides a function that determines whether the provided file contains a given class.", Invisible)
|
||||
val classpathEntryDefinesClass = TaskKey[File => DefinesClass]("classpath-entry-defines-class", "Internal use: provides a function that determines whether the provided file contains a given class.", Invisible)
|
||||
val doc = TaskKey[File]("doc", "Generates API documentation.", AMinusTask)
|
||||
val copyResources = TaskKey[Seq[(File, File)]]("copy-resources", "Copies resources to the output directory.", AMinusTask)
|
||||
val aggregate = SettingKey[Boolean]("aggregate", "Configures task aggregation.", BMinusSetting)
|
||||
|
|
|
|||
Loading…
Reference in New Issue