mirror of https://github.com/sbt/sbt.git
support checksum generation and checking, enable by default
This commit is contained in:
parent
d09aab03be
commit
3e29126cbf
|
|
@ -64,6 +64,7 @@ final class IvySbt(val configuration: IvyConfiguration)
|
|||
{
|
||||
case e: ExternalIvyConfiguration => is.load(e.file)
|
||||
case i: InlineIvyConfiguration =>
|
||||
is.setVariable("ivy.checksums", i.checksums mkString ",")
|
||||
i.paths.ivyHome foreach settings.setDefaultIvyUserDir
|
||||
IvySbt.configureCache(is, i.localOnly)
|
||||
IvySbt.setResolvers(is, i.resolvers, i.otherResolvers, i.localOnly, configuration.log)
|
||||
|
|
@ -182,6 +183,7 @@ private object IvySbt
|
|||
val DefaultIvyConfigFilename = "ivysettings.xml"
|
||||
val DefaultIvyFilename = "ivy.xml"
|
||||
val DefaultMavenFilename = "pom.xml"
|
||||
val DefaultChecksums = Seq("sha1", "md5")
|
||||
|
||||
def defaultIvyFile(project: File) = new File(project, DefaultIvyFilename)
|
||||
def defaultIvyConfiguration(project: File) = new File(project, DefaultIvyConfigFilename)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ object IvyCache
|
|||
{
|
||||
val local = Resolver.defaultLocal
|
||||
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)
|
||||
}
|
||||
/** 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],
|
||||
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
|
||||
def baseDirectory = paths.baseDirectory
|
||||
def withBase(newBase: File) = new InlineIvyConfiguration(paths.withBase(newBase), resolvers, otherResolvers, moduleConfigurations, localOnly, lock, log)
|
||||
def changeResolvers(newResolvers: Seq[Resolver]) = new InlineIvyConfiguration(paths, newResolvers, 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, checksums, log)
|
||||
}
|
||||
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.
|
||||
* 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.")
|
||||
val defaultIvyConfigFile = IvySbt.defaultIvyConfiguration(paths.baseDirectory)
|
||||
if(defaultIvyConfigFile.canRead)
|
||||
new ExternalIvyConfiguration(paths.baseDirectory, defaultIvyConfigFile, lock, log)
|
||||
else
|
||||
new InlineIvyConfiguration(paths, Resolver.withDefaultResolvers(Nil), Nil, Nil, localOnly, lock, log)
|
||||
new InlineIvyConfiguration(paths, Resolver.withDefaultResolvers(Nil), Nil, Nil, localOnly, lock, checksums, log)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ final class Update(config: UpdateConfiguration)
|
|||
val settings = new IvySettings
|
||||
ivyHome foreach settings.setDefaultIvyUserDir
|
||||
addResolvers(settings)
|
||||
settings.setVariable("ivy.checksums", "sha1,md5")
|
||||
settings.setDefaultConflictManager(settings.getConflictManager(ConflictManagerName))
|
||||
settings.setBaseDir(bootDirectory)
|
||||
settings.setVariable("scala", scalaVersion)
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ object Defaults
|
|||
settings <<= buildStructure map ( _.data ),
|
||||
artifactClassifier :== None,
|
||||
artifactClassifier in packageSrc :== Some(SourceClassifier),
|
||||
artifactClassifier in packageDoc :== Some(DocClassifier)
|
||||
artifactClassifier in packageDoc :== Some(DocClassifier),
|
||||
checksums :== IvySbt.DefaultChecksums
|
||||
))
|
||||
def projectCore: Seq[Setting[_]] = Seq(
|
||||
name <<= thisProject(_.id),
|
||||
|
|
@ -524,9 +525,9 @@ object Classpaths
|
|||
retrievePattern in GlobalScope :== "[type]/[organisation]/[module]/[artifact](-[revision])(-[classifier]).[ext]",
|
||||
updateConfiguration <<= (retrieveConfiguration, ivyLoggingLevel)((conf,level) => new UpdateConfiguration(conf, false, level) ),
|
||||
retrieveConfiguration <<= (managedDirectory, retrievePattern, retrieveManaged) { (libm, pattern, enabled) => if(enabled) Some(new RetrieveConfiguration(libm, pattern)) else None },
|
||||
ivyConfiguration <<= (fullResolvers, ivyPaths, otherResolvers, moduleConfigurations, offline, appConfiguration, streams) map { (rs, paths, other, moduleConfs, off, app, s) =>
|
||||
ivyConfiguration <<= (fullResolvers, ivyPaths, otherResolvers, moduleConfigurations, offline, checksums, appConfiguration, streams) map { (rs, paths, other, moduleConfs, off, check, app, s) =>
|
||||
val lock = app.provider.scalaProvider.launcher.globalLock
|
||||
new InlineIvyConfiguration(paths, rs, other, moduleConfs, off, Some(lock), s.log)
|
||||
new InlineIvyConfiguration(paths, rs, other, moduleConfs, off, Some(lock), check, s.log)
|
||||
},
|
||||
ivyConfigurations <<= (autoCompilerPlugins, thisProject) { (auto, project) =>
|
||||
project.configurations ++ (if(auto) CompilerPlugin :: Nil else Nil)
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ object Keys
|
|||
val classpathTypes = SettingKey[Set[String]]("classpath-types")
|
||||
val publishArtifact = SettingKey[Boolean]("publish-artifact")
|
||||
val packagedArtifact = TaskKey[(Artifact, File)]("packaged-artifact")
|
||||
val checksums = SettingKey[Seq[String]]("checksums")
|
||||
|
||||
val sbtResolver = SettingKey[Resolver]("sbt-resolver")
|
||||
val sbtDependency = SettingKey[ModuleID]("sbt-dependency")
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ object CacheIvy
|
|||
}
|
||||
|
||||
object L5 {
|
||||
implicit def inlineIvyToHL = (i: InlineIvyConfiguration) => i.paths :+: i.resolvers :+: i.otherResolvers :+: i.moduleConfigurations :+: i.localOnly :+: HNil
|
||||
implicit def inlineIvyToHL = (i: InlineIvyConfiguration) => i.paths :+: i.resolvers :+: i.otherResolvers :+: i.moduleConfigurations :+: i.localOnly :+: i.checksums :+: HNil
|
||||
}
|
||||
import L5._
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue