mirror of https://github.com/sbt/sbt.git
support checksum generation and checking, enable by default
This commit is contained in:
parent
14f53192ac
commit
cb02e3c852
|
|
@ -64,6 +64,7 @@ final class IvySbt(val configuration: IvyConfiguration)
|
||||||
{
|
{
|
||||||
case e: ExternalIvyConfiguration => is.load(e.file)
|
case e: ExternalIvyConfiguration => is.load(e.file)
|
||||||
case i: InlineIvyConfiguration =>
|
case i: InlineIvyConfiguration =>
|
||||||
|
is.setVariable("ivy.checksums", i.checksums mkString ",")
|
||||||
i.paths.ivyHome foreach settings.setDefaultIvyUserDir
|
i.paths.ivyHome foreach settings.setDefaultIvyUserDir
|
||||||
IvySbt.configureCache(is, i.localOnly)
|
IvySbt.configureCache(is, i.localOnly)
|
||||||
IvySbt.setResolvers(is, i.resolvers, i.otherResolvers, i.localOnly, configuration.log)
|
IvySbt.setResolvers(is, i.resolvers, i.otherResolvers, i.localOnly, configuration.log)
|
||||||
|
|
@ -182,6 +183,7 @@ private object IvySbt
|
||||||
val DefaultIvyConfigFilename = "ivysettings.xml"
|
val DefaultIvyConfigFilename = "ivysettings.xml"
|
||||||
val DefaultIvyFilename = "ivy.xml"
|
val DefaultIvyFilename = "ivy.xml"
|
||||||
val DefaultMavenFilename = "pom.xml"
|
val DefaultMavenFilename = "pom.xml"
|
||||||
|
val DefaultChecksums = Seq("sha1", "md5")
|
||||||
|
|
||||||
def defaultIvyFile(project: File) = new File(project, DefaultIvyFilename)
|
def defaultIvyFile(project: File) = new File(project, DefaultIvyFilename)
|
||||||
def defaultIvyConfiguration(project: File) = new File(project, DefaultIvyConfigFilename)
|
def defaultIvyConfiguration(project: File) = new File(project, DefaultIvyConfigFilename)
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ object IvyCache
|
||||||
{
|
{
|
||||||
val local = Resolver.defaultLocal
|
val local = Resolver.defaultLocal
|
||||||
val paths = new IvyPaths(new File("."), None)
|
val paths = new IvyPaths(new File("."), None)
|
||||||
val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, Nil, false, lock, log)
|
val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, Nil, false, lock, IvySbt.DefaultChecksums, log)
|
||||||
(new IvySbt(conf), local)
|
(new IvySbt(conf), local)
|
||||||
}
|
}
|
||||||
/** Creates a default jar artifact based on the given ID.*/
|
/** Creates a default jar artifact based on the given ID.*/
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@ sealed trait IvyConfiguration
|
||||||
}
|
}
|
||||||
final class InlineIvyConfiguration(val paths: IvyPaths, val resolvers: Seq[Resolver], val otherResolvers: Seq[Resolver],
|
final class InlineIvyConfiguration(val paths: IvyPaths, val resolvers: Seq[Resolver], val otherResolvers: Seq[Resolver],
|
||||||
val moduleConfigurations: Seq[ModuleConfiguration], val localOnly: Boolean, val lock: Option[xsbti.GlobalLock],
|
val moduleConfigurations: Seq[ModuleConfiguration], val localOnly: Boolean, val lock: Option[xsbti.GlobalLock],
|
||||||
val log: Logger) extends IvyConfiguration
|
val checksums: Seq[String], val log: Logger) extends IvyConfiguration
|
||||||
{
|
{
|
||||||
type This = InlineIvyConfiguration
|
type This = InlineIvyConfiguration
|
||||||
def baseDirectory = paths.baseDirectory
|
def baseDirectory = paths.baseDirectory
|
||||||
def withBase(newBase: File) = new InlineIvyConfiguration(paths.withBase(newBase), resolvers, otherResolvers, moduleConfigurations, localOnly, lock, 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, 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 file: File, val lock: Option[xsbti.GlobalLock], val log: Logger) extends IvyConfiguration
|
||||||
{
|
{
|
||||||
|
|
@ -37,14 +37,14 @@ object IvyConfiguration
|
||||||
{
|
{
|
||||||
/** Called to configure Ivy when inline resolvers are not specified.
|
/** Called to configure Ivy when inline resolvers are not specified.
|
||||||
* This will configure Ivy with an 'ivy-settings.xml' file if there is one or else use default resolvers.*/
|
* This will configure Ivy with an 'ivy-settings.xml' file if there is one or else use default resolvers.*/
|
||||||
def apply(paths: IvyPaths, lock: Option[xsbti.GlobalLock], localOnly: Boolean, log: Logger): IvyConfiguration =
|
def apply(paths: IvyPaths, lock: Option[xsbti.GlobalLock], localOnly: Boolean, checksums: Seq[String], log: Logger): 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)
|
new ExternalIvyConfiguration(paths.baseDirectory, defaultIvyConfigFile, lock, log)
|
||||||
else
|
else
|
||||||
new InlineIvyConfiguration(paths, Resolver.withDefaultResolvers(Nil), Nil, Nil, localOnly, lock, log)
|
new InlineIvyConfiguration(paths, Resolver.withDefaultResolvers(Nil), Nil, Nil, localOnly, lock, checksums, log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue