mirror of https://github.com/sbt/sbt.git
Merge pull request #1938 from sbt/wip/launcher-as-module
Removing launcher in favor of re-wrapping sbt/launcher module
This commit is contained in:
commit
25650267be
|
|
@ -336,6 +336,9 @@ class MakePom(val log: Logger) {
|
|||
val repositories = if (includeAll) allResolvers(settings) else resolvers(settings.getDefaultResolver)
|
||||
val mavenRepositories =
|
||||
repositories.flatMap {
|
||||
// TODO - Would it be ok if bintray were in the pom? We should avoid it for now.
|
||||
case m: CustomRemoteMavenResolver if m.repo.root == JCenterRepository.root => Nil
|
||||
case m: IBiblioResolver if m.isM2compatible && m.getRoot == JCenterRepository.root => Nil
|
||||
case m: CustomRemoteMavenResolver if m.repo.root != DefaultMavenRepository.root =>
|
||||
MavenRepository(m.repo.name, m.repo.root) :: Nil
|
||||
case m: IBiblioResolver if m.isM2compatible && m.getRoot != DefaultMavenRepository.root =>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
package sbt
|
||||
|
||||
import java.io.File
|
||||
import java.util.concurrent.Callable
|
||||
import org.specs2._
|
||||
import mutable.Specification
|
||||
import IO.{ createDirectory, delete, touch, withTemporaryDirectory }
|
||||
import org.apache.ivy.util.ChecksumHelper
|
||||
import IfMissing.Fail
|
||||
import xsbti.ComponentProvider
|
||||
|
||||
// TODO - We need to re-enable this test. Right now, we dont' have a "stub" launcher for this.
|
||||
// This is testing something which uses a launcher interface, but was grabbing the underlying class directly
|
||||
// when it really should, instead, be stubbing out the underyling class.
|
||||
|
||||
object ComponentManagerTest extends Specification {
|
||||
val TestID = "manager-test"
|
||||
|
|
@ -82,7 +88,39 @@ object ComponentManagerTest extends Specification {
|
|||
private def withManagerHome[T](ivyHome: File)(f: ComponentManager => T): T =
|
||||
TestLogger { logger =>
|
||||
withTemporaryDirectory { temp =>
|
||||
val mgr = new ComponentManager(xsbt.boot.Locks, new xsbt.boot.ComponentProvider(temp, true), Some(ivyHome), logger)
|
||||
// The actual classes we'll use at runtime.
|
||||
//val mgr = new ComponentManager(xsbt.boot.Locks, new xsbt.boot.ComponentProvider(temp, true), Some(ivyHome), logger)
|
||||
|
||||
// A stub component manager
|
||||
object provider extends ComponentProvider {
|
||||
override def componentLocation(id: String): File = new File(temp, id)
|
||||
override def lockFile(): File = {
|
||||
IO.createDirectory(temp)
|
||||
new java.io.File(temp, "sbt.components.lock")
|
||||
}
|
||||
override def defineComponent(id: String, files: Array[File]): Unit = {
|
||||
val location = componentLocation(id)
|
||||
if (location.exists)
|
||||
throw new RuntimeException(s"Cannot redefine component. ID: $id, files: ${files.mkString(",")}")
|
||||
else
|
||||
IO.copy(files.map { f => f -> new java.io.File(location, f.getName) })
|
||||
}
|
||||
override def addToComponent(id: String, files: Array[File]): Boolean = {
|
||||
val location = componentLocation(id)
|
||||
IO.copy(files.map { f => f -> new java.io.File(location, f.getName) })
|
||||
true
|
||||
}
|
||||
override def component(id: String): Array[File] =
|
||||
Option(componentLocation(id).listFiles()).map(_.filter(_.isFile)).getOrElse(Array.empty)
|
||||
}
|
||||
// A stubbed locking API.
|
||||
object locks extends xsbti.GlobalLock {
|
||||
override def apply[T](lockFile: File, run: Callable[T]): T = {
|
||||
// TODO - do we need to lock?
|
||||
run.call()
|
||||
}
|
||||
}
|
||||
val mgr = new ComponentManager(locks, provider, Some(ivyHome), logger)
|
||||
f(mgr)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue