mirror of https://github.com/sbt/sbt.git
Add support for loading Ivy settings from a URL
This commit is contained in:
parent
2999cf8df9
commit
38289ad08a
|
|
@ -65,7 +65,7 @@ final class IvySbt(val configuration: IvyConfiguration)
|
||||||
CustomPomParser.registerDefault
|
CustomPomParser.registerDefault
|
||||||
configuration match
|
configuration match
|
||||||
{
|
{
|
||||||
case e: ExternalIvyConfiguration => is.load(e.file)
|
case e: ExternalIvyConfiguration => is.load(e.url)
|
||||||
case i: InlineIvyConfiguration =>
|
case i: InlineIvyConfiguration =>
|
||||||
is.setVariable("ivy.checksums", i.checksums mkString ",")
|
is.setVariable("ivy.checksums", i.checksums mkString ",")
|
||||||
i.paths.ivyHome foreach is.setDefaultIvyUserDir
|
i.paths.ivyHome foreach is.setDefaultIvyUserDir
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
package sbt
|
package sbt
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.net.URL
|
||||||
import scala.xml.NodeSeq
|
import scala.xml.NodeSeq
|
||||||
|
|
||||||
final class IvyPaths(val baseDirectory: File, val ivyHome: Option[File])
|
final class IvyPaths(val baseDirectory: File, val ivyHome: Option[File])
|
||||||
|
|
@ -27,10 +28,14 @@ final class InlineIvyConfiguration(val paths: IvyPaths, val resolvers: Seq[Resol
|
||||||
def withBase(newBase: File) = new InlineIvyConfiguration(paths.withBase(newBase), resolvers, otherResolvers, moduleConfigurations, localOnly, lock, checksums, log)
|
def withBase(newBase: File) = new InlineIvyConfiguration(paths.withBase(newBase), resolvers, otherResolvers, moduleConfigurations, localOnly, lock, checksums, log)
|
||||||
def changeResolvers(newResolvers: Seq[Resolver]) = new InlineIvyConfiguration(paths, newResolvers, otherResolvers, moduleConfigurations, localOnly, lock, checksums, log)
|
def changeResolvers(newResolvers: Seq[Resolver]) = new InlineIvyConfiguration(paths, newResolvers, otherResolvers, moduleConfigurations, localOnly, lock, checksums, log)
|
||||||
}
|
}
|
||||||
final class ExternalIvyConfiguration(val baseDirectory: File, val file: File, val lock: Option[xsbti.GlobalLock], val log: Logger) extends IvyConfiguration
|
final class ExternalIvyConfiguration(val baseDirectory: File, val url: URL, val lock: Option[xsbti.GlobalLock], val log: Logger) extends IvyConfiguration
|
||||||
{
|
{
|
||||||
type This = ExternalIvyConfiguration
|
type This = ExternalIvyConfiguration
|
||||||
def withBase(newBase: File) = new ExternalIvyConfiguration(newBase, file, lock, log)
|
def withBase(newBase: File) = new ExternalIvyConfiguration(newBase, url, lock, log)
|
||||||
|
}
|
||||||
|
object ExternalIvyConfiguration
|
||||||
|
{
|
||||||
|
def apply(baseDirectory: File, file: File, lock: Option[xsbti.GlobalLock], log: Logger) = new ExternalIvyConfiguration(baseDirectory, file.toURI.toURL, lock, log)
|
||||||
}
|
}
|
||||||
|
|
||||||
object IvyConfiguration
|
object IvyConfiguration
|
||||||
|
|
@ -42,7 +47,7 @@ object IvyConfiguration
|
||||||
log.debug("Autodetecting configuration.")
|
log.debug("Autodetecting configuration.")
|
||||||
val defaultIvyConfigFile = IvySbt.defaultIvyConfiguration(paths.baseDirectory)
|
val defaultIvyConfigFile = IvySbt.defaultIvyConfiguration(paths.baseDirectory)
|
||||||
if(defaultIvyConfigFile.canRead)
|
if(defaultIvyConfigFile.canRead)
|
||||||
new ExternalIvyConfiguration(paths.baseDirectory, defaultIvyConfigFile, lock, log)
|
ExternalIvyConfiguration(paths.baseDirectory, defaultIvyConfigFile, lock, log)
|
||||||
else
|
else
|
||||||
new InlineIvyConfiguration(paths, Resolver.withDefaultResolvers(Nil), Nil, Nil, localOnly, lock, checksums, log)
|
new InlineIvyConfiguration(paths, Resolver.withDefaultResolvers(Nil), Nil, Nil, localOnly, lock, checksums, log)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue