mirror of https://github.com/sbt/sbt.git
Port zinc-lm-integration
This commit is contained in:
parent
4ff27d7ab7
commit
1459b8a79d
|
|
@ -184,7 +184,6 @@ lazy val sbtRoot: Project = (project in file("."))
|
|||
(allProjects diff Seq(
|
||||
actionsProj,
|
||||
mainSettingsProj,
|
||||
zincLmIntegrationProj,
|
||||
scriptedSbtReduxProj,
|
||||
scriptedSbtOldProj,
|
||||
scriptedPluginProj,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ sealed trait IfMissing
|
|||
object IfMissing {
|
||||
def fail: IfMissing = Fail
|
||||
|
||||
/** f is expected to call ZincComponentManager.define. */
|
||||
/** f is expected to call ZincComponentManager.define. */
|
||||
def define(useSecondaryCache: Boolean, f: => Unit): IfMissing = new Define(useSecondaryCache, f)
|
||||
object Fail extends IfMissing
|
||||
final class Define(val useSecondaryCache: Boolean, define: => Unit) extends IfMissing {
|
||||
|
|
|
|||
|
|
@ -66,12 +66,14 @@ class ZincComponentManager(
|
|||
lockLocalCache(getOrElse(fromSecondary))
|
||||
}
|
||||
|
||||
/** Get the file for component 'id',
|
||||
* throwing an exception if no files or multiple files exist for the component. */
|
||||
/**
|
||||
* Get the file for component 'id',
|
||||
* throwing an exception if no files or multiple files exist for the component.
|
||||
*/
|
||||
def file(id: String)(ifMissing: IfMissing): File = {
|
||||
files(id)(ifMissing).toList match {
|
||||
case x :: Nil => x
|
||||
case xs => invalid(s"Expected single file for component '$id', found: ${xs.mkString(", ")}")
|
||||
case xs => invalid(s"Expected single file for component '$id', found: ${xs.mkString(", ")}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,8 +81,10 @@ class ZincComponentManager(
|
|||
def define(id: String, files: Iterable[File]): Unit =
|
||||
lockLocalCache(provider.defineComponent(id, files.toSeq.toArray))
|
||||
|
||||
/** This is used to lock the local cache in project/boot/.
|
||||
* By checking the local cache first, we can avoid grabbing a global lock. */
|
||||
/**
|
||||
* This is used to lock the local cache in project/boot/.
|
||||
* By checking the local cache first, we can avoid grabbing a global lock.
|
||||
*/
|
||||
private def lockLocalCache[T](action: => T): T = lock(provider.lockFile)(action)
|
||||
|
||||
/** This is used to ensure atomic access to components in the global Ivy cache. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue