Adapt to new library management API

This commit is contained in:
Martin Duhem 2017-07-15 18:09:40 -04:00 committed by Eugene Yokota
parent 3cc49e49f4
commit 347914191a
34 changed files with 366 additions and 315 deletions

View File

@ -241,11 +241,11 @@ lazy val actionsProj = (project in file("main-actions"))
addSbtIO, addSbtIO,
addSbtUtilLogging, addSbtUtilLogging,
addSbtUtilRelation, addSbtUtilRelation,
addSbtUtilTracking,
addSbtCompilerInterface, addSbtCompilerInterface,
addSbtCompilerClasspath, addSbtCompilerClasspath,
addSbtCompilerApiInfo, addSbtCompilerApiInfo,
addSbtUtilTracking, addSbtLmCore,
addSbtLm,
addSbtCompilerIvyIntegration, addSbtCompilerIvyIntegration,
addSbtZinc addSbtZinc
) )
@ -281,7 +281,7 @@ lazy val commandProj = (project in file("main-command"))
addSbtUtilLogging, addSbtUtilLogging,
addSbtCompilerInterface, addSbtCompilerInterface,
addSbtCompilerClasspath, addSbtCompilerClasspath,
addSbtLm addSbtLmCore
) )
// The core macro project defines the main logic of the DSL, abstracted // The core macro project defines the main logic of the DSL, abstracted
@ -329,7 +329,7 @@ lazy val mainSettingsProj = (project in file("main-settings"))
addSbtUtilRelation, addSbtUtilRelation,
addSbtCompilerInterface, addSbtCompilerInterface,
addSbtCompilerClasspath, addSbtCompilerClasspath,
addSbtLm addSbtLmCore
) )
// The main integration project for sbt. It brings all of the projects together, configures them, and provides for overriding conventions. // The main integration project for sbt. It brings all of the projects together, configures them, and provides for overriding conventions.
@ -347,10 +347,10 @@ lazy val mainProj = (project in file("main"))
.configure( .configure(
addSbtIO, addSbtIO,
addSbtUtilLogging, addSbtUtilLogging,
addSbtLmCore,
addSbtLmIvy,
addSbtCompilerInterface, addSbtCompilerInterface,
addSbtLm, addSbtZincCompile)
addSbtZincCompile
)
// Strictly for bringing implicits and aliases from subsystems into the top-level sbt namespace through a single package object // Strictly for bringing implicits and aliases from subsystems into the top-level sbt namespace through a single package object
// technically, we need a dependency on all of mainProj's dependencies, but we don't do that since this is strictly an integration project // technically, we need a dependency on all of mainProj's dependencies, but we don't do that since this is strictly an integration project

View File

@ -16,6 +16,7 @@ import sbt.util.CacheImplicits._
import sbt.util.Tracked.inputChanged import sbt.util.Tracked.inputChanged
import sbt.util.{ CacheStoreFactory, FilesInfo, HashFileInfo, ModifiedFileInfo, PlainFileInfo } import sbt.util.{ CacheStoreFactory, FilesInfo, HashFileInfo, ModifiedFileInfo, PlainFileInfo }
import sbt.internal.util.HNil import sbt.internal.util.HNil
import sbt.internal.util.HListFormats._
import sbt.util.FileInfo.{ exists, hash, lastModified } import sbt.util.FileInfo.{ exists, hash, lastModified }
import xsbti.compile.ClasspathOptions import xsbti.compile.ClasspathOptions

View File

@ -46,14 +46,20 @@ class CacheIvyTest extends Properties("CacheIvy") {
eq(out, m) :| s"Expected: ${str(m)}" :| s"Got: ${str(out)}" eq(out, m) :| s"Expected: ${str(m)}" :| s"Got: ${str(out)}"
} }
implicit val arbExclusionRule: Arbitrary[ExclusionRule] = Arbitrary( implicit val arbConfigRef: Arbitrary[ConfigRef] = Arbitrary(
for {
n <- Gen.alphaStr
} yield ConfigRef(n)
)
implicit val arbExclusionRule: Arbitrary[InclExclRule] = Arbitrary(
for { for {
o <- Gen.alphaStr o <- Gen.alphaStr
n <- Gen.alphaStr n <- Gen.alphaStr
a <- Gen.alphaStr a <- Gen.alphaStr
v <- arbCrossVersion.arbitrary v <- arbCrossVersion.arbitrary
cs <- arbitrary[List[String]] cs <- arbitrary[List[ConfigRef]]
} yield ExclusionRule(o, n, a, cs.toVector, v) } yield InclExclRule(o, n, a, cs.toVector, v)
) )
implicit val arbCrossVersion: Arbitrary[CrossVersion] = Arbitrary { implicit val arbCrossVersion: Arbitrary[CrossVersion] = Arbitrary {
@ -78,8 +84,8 @@ class CacheIvyTest extends Properties("CacheIvy") {
isTransitive <- arbitrary[Boolean] isTransitive <- arbitrary[Boolean]
isForce <- arbitrary[Boolean] isForce <- arbitrary[Boolean]
explicitArtifacts <- Gen.listOf(arbitrary[Artifact]) explicitArtifacts <- Gen.listOf(arbitrary[Artifact])
exclusions <- Gen.listOf(arbitrary[ExclusionRule]) exclusions <- Gen.listOf(arbitrary[InclExclRule])
inclusions <- Gen.listOf(arbitrary[InclusionRule]) inclusions <- Gen.listOf(arbitrary[InclExclRule])
extraAttributes <- Gen.mapOf(arbitrary[(String, String)]) extraAttributes <- Gen.mapOf(arbitrary[(String, String)])
crossVersion <- arbitrary[CrossVersion] crossVersion <- arbitrary[CrossVersion]
} yield } yield

View File

@ -56,6 +56,14 @@ object Append {
}) })
def appendValue(a: List[T], b: V): List[T] = a :+ (b: T) def appendValue(a: List[T], b: V): List[T] = a :+ (b: T)
} }
implicit def appendVectorImplicit[T, V](implicit ev: V => T): Sequence[Vector[T], Seq[V], V] =
new Sequence[Vector[T], Seq[V], V] {
def appendValues(a: Vector[T], b: Seq[V]): Vector[T] =
a ++ (b map { x =>
(x: T)
})
def appendValue(a: Vector[T], b: V): Vector[T] = a :+ (b: T)
}
implicit def appendString: Value[String, String] = new Value[String, String] { implicit def appendString: Value[String, String] = new Value[String, String] {
def appendValue(a: String, b: String) = a + b def appendValue(a: String, b: String) = a + b
} }

View File

@ -48,8 +48,7 @@ import sbt.io.{
PathFinder, PathFinder,
SimpleFileFilter, SimpleFileFilter,
DirectoryFilter, DirectoryFilter,
Hash, Hash
WatchService
}, Path._ }, Path._
import sbt.librarymanagement.Artifact.{ DocClassifier, SourceClassifier } import sbt.librarymanagement.Artifact.{ DocClassifier, SourceClassifier }
import sbt.librarymanagement.Configurations.{ import sbt.librarymanagement.Configurations.{
@ -62,7 +61,8 @@ import sbt.librarymanagement.Configurations.{
Test Test
} }
import sbt.librarymanagement.CrossVersion.{ binarySbtVersion, binaryScalaVersion, partialVersion } import sbt.librarymanagement.CrossVersion.{ binarySbtVersion, binaryScalaVersion, partialVersion }
import sbt.librarymanagement.{ `package` => _, _ } import sbt.librarymanagement._
import sbt.librarymanagement.ivy._
import sbt.librarymanagement.syntax._ import sbt.librarymanagement.syntax._
import sbt.util.InterfaceUtil.{ toJavaFunction => f1 } import sbt.util.InterfaceUtil.{ toJavaFunction => f1 }
import sbt.util._ import sbt.util._
@ -470,7 +470,7 @@ object Defaults extends BuildCommon {
globalLock = launcher.globalLock, globalLock = launcher.globalLock,
componentProvider = app.provider.components, componentProvider = app.provider.components,
secondaryCacheDir = Option(zincDir), secondaryCacheDir = Option(zincDir),
ivyConfiguration = bootIvyConfiguration.value, dependencyResolution = dependencyResolution.value,
compilerBridgeSource = scalaCompilerBridgeSource.value, compilerBridgeSource = scalaCompilerBridgeSource.value,
scalaJarsTarget = zincDir, scalaJarsTarget = zincDir,
log = streams.value.log log = streams.value.log
@ -625,7 +625,7 @@ object Defaults extends BuildCommon {
} }
def scalaInstanceFromUpdate: Initialize[Task[ScalaInstance]] = Def.task { def scalaInstanceFromUpdate: Initialize[Task[ScalaInstance]] = Def.task {
val toolReport = update.value.configuration(Configurations.ScalaTool.name) getOrElse val toolReport = update.value.configuration(Configurations.ScalaTool) getOrElse
sys.error(noToolConfiguration(managedScalaInstance.value)) sys.error(noToolConfiguration(managedScalaInstance.value))
def files(id: String) = def files(id: String) =
for { for {
@ -1065,12 +1065,13 @@ object Defaults extends BuildCommon {
case c => Some(c.name) case c => Some(c.name)
} }
val combined = cPart.toList ++ classifier.toList val combined = cPart.toList ++ classifier.toList
if (combined.isEmpty) a.withClassifier(None).withConfigurations(cOpt.toVector) val configurations = cOpt.map(c => ConfigRef(c.name)).toVector
if (combined.isEmpty) a.withClassifier(None).withConfigurations(configurations)
else { else {
val classifierString = combined mkString "-" val classifierString = combined mkString "-"
a.withClassifier(Some(classifierString)) a.withClassifier(Some(classifierString))
.withType(Artifact.classifierType(classifierString)) .withType(Artifact.classifierType(classifierString))
.withConfigurations(cOpt.toVector) .withConfigurations(configurations)
} }
} }
@ -1667,7 +1668,9 @@ object Classpaths {
def notFound = def notFound =
sys.error( sys.error(
"Configuration to use for managed classpath must be explicitly defined when default configurations are not present.") "Configuration to use for managed classpath must be explicitly defined when default configurations are not present.")
search find { defined contains _.name } getOrElse notFound search find { c =>
defined contains ConfigRef(c.name)
} getOrElse notFound
} }
def packaged(pkgTasks: Seq[TaskKey[File]]): Initialize[Task[Map[Artifact, File]]] = def packaged(pkgTasks: Seq[TaskKey[File]]): Initialize[Task[Map[Artifact, File]]] =
@ -1703,12 +1706,14 @@ object Classpaths {
packagedArtifacts :== Map.empty, packagedArtifacts :== Map.empty,
crossTarget := target.value, crossTarget := target.value,
makePom := { makePom := {
val config = makePomConfiguration.value; val config = makePomConfiguration.value
IvyActions.makePom(ivyModule.value, config, streams.value.log); config.file val publisher = Keys.publisher.value
publisher.makePomFile(ivyModule.value, config, streams.value.log)
config.file
}, },
packagedArtifact in makePom := ((artifact in makePom).value -> makePom.value), packagedArtifact in makePom := ((artifact in makePom).value -> makePom.value),
deliver := deliverTask(deliverConfiguration).value, deliver := deliverTask(publishConfiguration).value,
deliverLocal := deliverTask(deliverLocalConfiguration).value, deliverLocal := deliverTask(publishLocalConfiguration).value,
publish := publishTask(publishConfiguration, deliver).value, publish := publishTask(publishConfiguration, deliver).value,
publishLocal := publishTask(publishLocalConfiguration, deliverLocal).value, publishLocal := publishTask(publishLocalConfiguration, deliverLocal).value,
publishM2 := publishTask(publishM2Configuration, deliverLocal).value publishM2 := publishTask(publishM2Configuration, deliverLocal).value
@ -1726,7 +1731,7 @@ object Classpaths {
scmInfo :== None, scmInfo :== None,
offline :== false, offline :== false,
defaultConfiguration :== Some(Configurations.Compile), defaultConfiguration :== Some(Configurations.Compile),
dependencyOverrides :== Set.empty, dependencyOverrides :== Vector.empty,
libraryDependencies :== Nil, libraryDependencies :== Nil,
excludeDependencies :== Nil, excludeDependencies :== Nil,
ivyLoggingLevel :== { ivyLoggingLevel :== {
@ -1739,12 +1744,12 @@ object Classpaths {
ivyValidate :== false, ivyValidate :== false,
moduleConfigurations :== Nil, moduleConfigurations :== Nil,
publishTo :== None, publishTo :== None,
resolvers :== Nil, resolvers :== Vector.empty,
useJCenter :== false, useJCenter :== false,
retrievePattern :== Resolver.defaultRetrievePattern, retrievePattern :== Resolver.defaultRetrievePattern,
transitiveClassifiers :== Seq(SourceClassifier, DocClassifier), transitiveClassifiers :== Seq(SourceClassifier, DocClassifier),
sourceArtifactTypes :== Artifact.DefaultSourceTypes, sourceArtifactTypes :== Artifact.DefaultSourceTypes.toVector,
docArtifactTypes :== Artifact.DefaultDocTypes, docArtifactTypes :== Artifact.DefaultDocTypes.toVector,
sbtDependency := { sbtDependency := {
val app = appConfiguration.value val app = appConfiguration.value
val id = app.provider.id val id = app.provider.id
@ -1788,13 +1793,13 @@ object Classpaths {
useJCenter.value) match { useJCenter.value) match {
case (Some(delegated), Seq(), _, _) => delegated case (Some(delegated), Seq(), _, _) => delegated
case (_, rs, Some(ars), uj) => ars ++ rs case (_, rs, Some(ars), uj) => ars ++ rs
case (_, rs, _, uj) => Resolver.withDefaultResolvers(rs, uj, mavenCentral = true) case (_, rs, _, uj) => Resolver.combineDefaultResolvers(rs, uj, mavenCentral = true)
}), }),
appResolvers := { appResolvers := {
val ac = appConfiguration.value val ac = appConfiguration.value
val uj = useJCenter.value val uj = useJCenter.value
appRepositories(ac) map { ars => appRepositories(ac) map { ars =>
val useMavenCentral = ars contains DefaultMavenRepository val useMavenCentral = ars contains Resolver.DefaultMavenRepository
Resolver.reorganizeAppResolvers(ars, uj, useMavenCentral) Resolver.reorganizeAppResolvers(ars, uj, useMavenCentral)
} }
}, },
@ -1817,7 +1822,7 @@ object Classpaths {
val st = state.value val st = state.value
BuildPaths.getDependencyDirectory(st, BuildPaths.getGlobalBase(st)) BuildPaths.getDependencyDirectory(st, BuildPaths.getGlobalBase(st))
}, },
otherResolvers := Resolver.publishMavenLocal :: publishTo.value.toList, otherResolvers := Resolver.publishMavenLocal +: publishTo.value.toVector,
projectResolver := projectResolverTask.value, projectResolver := projectResolverTask.value,
projectDependencies := projectDependenciesTask.value, projectDependencies := projectDependenciesTask.value,
// TODO - Is this the appropriate split? Ivy defines this simply as // TODO - Is this the appropriate split? Ivy defines this simply as
@ -1826,10 +1831,10 @@ object Classpaths {
allDependencies := { allDependencies := {
projectDependencies.value ++ libraryDependencies.value projectDependencies.value ++ libraryDependencies.value
}, },
ivyScala := (ivyScala or ( scalaModuleInfo := (scalaModuleInfo or (
Def.setting { Def.setting {
Option( Option(
IvyScala( ScalaModuleInfo(
(scalaVersion in update).value, (scalaVersion in update).value,
(scalaBinaryVersion in update).value, (scalaBinaryVersion in update).value,
Vector.empty, Vector.empty,
@ -1848,26 +1853,27 @@ object Classpaths {
projectDescriptors := depMap.value, projectDescriptors := depMap.value,
updateConfiguration := { updateConfiguration := {
// Tell the UpdateConfiguration which artifact types are special (for sources and javadocs) // Tell the UpdateConfiguration which artifact types are special (for sources and javadocs)
val specialArtifactTypes = sourceArtifactTypes.value union docArtifactTypes.value val specialArtifactTypes = sourceArtifactTypes.value.toSet union docArtifactTypes.value.toSet
// By default, to retrieve all types *but* these (it's assumed that everything else is binary/resource) // By default, to retrieve all types *but* these (it's assumed that everything else is binary/resource)
UpdateConfiguration( UpdateConfiguration()
retrieve = retrieveConfiguration.value, .withRetrieveManaged(retrieveConfiguration.value)
missingOk = false, .withLogging(ivyLoggingLevel.value)
logging = ivyLoggingLevel.value, .withArtifactFilter(ArtifactTypeFilter.forbid(specialArtifactTypes))
artifactFilter = ArtifactTypeFilter.forbid(specialArtifactTypes), .withOffline(offline.value)
offline = offline.value,
frozen = false
)
}, },
retrieveConfiguration := { retrieveConfiguration := {
if (retrieveManaged.value) if (retrieveManaged.value)
Some( Some(
RetrieveConfiguration(managedDirectory.value, RetrieveConfiguration(
retrievePattern.value, managedDirectory.value,
retrieveManagedSync.value, retrievePattern.value,
configurationsToRetrieve.value)) retrieveManagedSync.value,
configurationsToRetrieve.value.getOrElse(Vector.empty).map(c => ConfigRef(c.name))
))
else None else None
}, },
dependencyResolution := IvyDependencyResolution(ivyConfiguration.value),
publisher := IvyPublisher(ivyConfiguration.value),
ivyConfiguration := mkIvyConfiguration.value, ivyConfiguration := mkIvyConfiguration.value,
ivyConfigurations := { ivyConfigurations := {
val confs = thisProject.value.configurations val confs = thisProject.value.configurations
@ -1888,36 +1894,37 @@ object Classpaths {
pomPostProcess.value, pomPostProcess.value,
pomIncludeRepository.value, pomIncludeRepository.value,
pomAllRepositories.value), pomAllRepositories.value),
deliverLocalConfiguration := deliverConfig(crossTarget.value,
status =
if (isSnapshot.value) "integration"
else "release",
logging = ivyLoggingLevel.value),
deliverConfiguration := deliverLocalConfiguration.value,
publishConfiguration := { publishConfiguration := {
// TODO(jvican): I think this is a bug.
val delivered = deliver.value
publishConfig( publishConfig(
packagedArtifacts.in(publish).value, publishMavenStyle.value,
if (publishMavenStyle.value) None else Some(delivered), deliverPattern(crossTarget.value),
resolverName = getPublishTo(publishTo.value).name, if (isSnapshot.value) "integration" else "release",
checksums = checksums.in(publish).value, ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
logging = ivyLoggingLevel.value, packagedArtifacts.in(publish).value.toVector,
overwrite = isSnapshot.value checksums.in(publish).value,
getPublishTo(publishTo.value).name,
ivyLoggingLevel.value,
isSnapshot.value
) )
}, },
publishLocalConfiguration := publishConfig( publishLocalConfiguration := publishConfig(
packagedArtifacts.in(publishLocal).value, false, //publishMavenStyle.value,
Some(deliverLocal.value), deliverPattern(crossTarget.value),
if (isSnapshot.value) "integration" else "release",
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
packagedArtifacts.in(publishLocal).value.toVector,
checksums.in(publishLocal).value, checksums.in(publishLocal).value,
logging = ivyLoggingLevel.value, logging = ivyLoggingLevel.value,
overwrite = isSnapshot.value overwrite = isSnapshot.value
), ),
publishM2Configuration := publishConfig( publishM2Configuration := publishConfig(
packagedArtifacts.in(publishM2).value, true,
None, deliverPattern(crossTarget.value),
resolverName = Resolver.publishMavenLocal.name, if (isSnapshot.value) "integration" else "release",
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
packagedArtifacts.in(publishM2).value.toVector,
checksums = checksums.in(publishM2).value, checksums = checksums.in(publishM2).value,
resolverName = Resolver.publishMavenLocal.name,
logging = ivyLoggingLevel.value, logging = ivyLoggingLevel.value,
overwrite = isSnapshot.value overwrite = isSnapshot.value
), ),
@ -1955,14 +1962,18 @@ object Classpaths {
implicit val key = (m: ModuleID) => (m.organization, m.name, m.revision) implicit val key = (m: ModuleID) => (m.organization, m.name, m.revision)
val projectDeps = projectDependencies.value.iterator.map(key).toSet val projectDeps = projectDependencies.value.iterator.map(key).toSet
val externalModules = update.value.allModules.filterNot(m => projectDeps contains key(m)) val externalModules = update.value.allModules.filterNot(m => projectDeps contains key(m))
GetClassifiersModule(projectID.value, GetClassifiersModule(
externalModules, projectID.value,
ivyConfigurations.in(updateClassifiers).value.toVector, None,
transitiveClassifiers.in(updateClassifiers).value.toVector) externalModules,
ivyConfigurations.in(updateClassifiers).value.toVector,
transitiveClassifiers.in(updateClassifiers).value.toVector
)
}, },
updateClassifiers := (Def.task { updateClassifiers := (Def.task {
val s = streams.value val s = streams.value
val is = ivySbt.value val is = ivySbt.value
val lm = new DependencyResolution(new IvyDependencyResolution(is))
val mod = (classifiersModule in updateClassifiers).value val mod = (classifiersModule in updateClassifiers).value
val c = updateConfiguration.value val c = updateConfiguration.value
val app = appConfiguration.value val app = appConfiguration.value
@ -1970,24 +1981,23 @@ object Classpaths {
val docTypes = docArtifactTypes.value val docTypes = docArtifactTypes.value
val out = is.withIvy(s.log)(_.getSettings.getDefaultIvyUserDir) val out = is.withIvy(s.log)(_.getSettings.getDefaultIvyUserDir)
val uwConfig = (unresolvedWarningConfiguration in update).value val uwConfig = (unresolvedWarningConfiguration in update).value
val depDir = dependencyCacheDirectory.value val scalaModule = scalaModuleInfo.value
val ivy = ivyScala.value
val st = state.value
withExcludes(out, mod.classifiers, lock(app)) { excludes => withExcludes(out, mod.classifiers, lock(app)) { excludes =>
IvyActions.updateClassifiers( lm.updateClassifiers(
is, GetClassifiersConfiguration(
GetClassifiersConfiguration(mod, mod,
excludes, excludes.toVector,
c.withArtifactFilter(c.artifactFilter.invert), c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))),
ivy, // scalaModule,
srcTypes, srcTypes,
docTypes), docTypes),
uwConfig, uwConfig,
LogicalClock(st.hashCode),
Some(depDir),
Vector.empty, Vector.empty,
s.log s.log
) ) match {
case Left(_) => ???
case Right(ur) => ur
}
} }
} tag (Tags.Update, Tags.Network)).value } tag (Tags.Update, Tags.Network)).value
) )
@ -2010,7 +2020,7 @@ object Classpaths {
else base else base
val sbtOrg = scalaOrganization.value val sbtOrg = scalaOrganization.value
val version = scalaVersion.value val version = scalaVersion.value
if (scalaHome.value.isDefined || ivyScala.value.isEmpty || !managedScalaInstance.value) if (scalaHome.value.isDefined || scalaModuleInfo.value.isEmpty || !managedScalaInstance.value)
pluginAdjust pluginAdjust
else { else {
val isDotty = ScalaInstance.isDotty(version) val isDotty = ScalaInstance.isDotty(version)
@ -2050,9 +2060,9 @@ object Classpaths {
new IvySbt(ivyConfiguration.value) new IvySbt(ivyConfiguration.value)
} }
def moduleSettings0: Initialize[Task[ModuleSettings]] = Def.task { def moduleSettings0: Initialize[Task[ModuleSettings]] = Def.task {
InlineConfiguration( ModuleDescriptorConfiguration(
ivyValidate.value, ivyValidate.value,
ivyScala.value, scalaModuleInfo.value,
projectID.value, projectID.value,
projectInfo.value, projectInfo.value,
allDependencies.value.toVector, allDependencies.value.toVector,
@ -2083,7 +2093,7 @@ object Classpaths {
.resolvers .resolvers
explicit orElse bootRepositories(appConfiguration.value) getOrElse externalResolvers.value explicit orElse bootRepositories(appConfiguration.value) getOrElse externalResolvers.value
}, },
ivyConfiguration := new InlineIvyConfiguration( ivyConfiguration := InlineIvyConfiguration(
paths = ivyPaths.value, paths = ivyPaths.value,
resolvers = externalResolvers.value.toVector, resolvers = externalResolvers.value.toVector,
otherResolvers = Vector.empty, otherResolvers = Vector.empty,
@ -2101,16 +2111,18 @@ object Classpaths {
// to fix https://github.com/sbt/sbt/issues/2686 // to fix https://github.com/sbt/sbt/issues/2686
scalaVersion := appConfiguration.value.provider.scalaProvider.version, scalaVersion := appConfiguration.value.provider.scalaProvider.version,
scalaBinaryVersion := binaryScalaVersion(scalaVersion.value), scalaBinaryVersion := binaryScalaVersion(scalaVersion.value),
ivyScala := { scalaModuleInfo := {
Some( Some(
IvyScala(scalaVersion.value, ScalaModuleInfo(
scalaBinaryVersion.value, scalaVersion.value,
Vector(), scalaBinaryVersion.value,
checkExplicit = false, Vector(),
filterImplicit = false, checkExplicit = false,
overrideScalaVersion = true).withScalaOrganization(scalaOrganization.value)) filterImplicit = false,
overrideScalaVersion = true).withScalaOrganization(scalaOrganization.value))
}, },
updateSbtClassifiers in TaskGlobal := (Def.task { updateSbtClassifiers in TaskGlobal := (Def.task {
val lm = dependencyResolution.value
val s = streams.value val s = streams.value
val is = ivySbt.value val is = ivySbt.value
val mod = classifiersModule.value val mod = classifiersModule.value
@ -2122,24 +2134,24 @@ object Classpaths {
val out = is.withIvy(log)(_.getSettings.getDefaultIvyUserDir) val out = is.withIvy(log)(_.getSettings.getDefaultIvyUserDir)
val uwConfig = (unresolvedWarningConfiguration in update).value val uwConfig = (unresolvedWarningConfiguration in update).value
val depDir = dependencyCacheDirectory.value val depDir = dependencyCacheDirectory.value
val ivy = ivyScala.value val ivy = scalaModuleInfo.value
val st = state.value val st = state.value
withExcludes(out, mod.classifiers, lock(app)) { excludes => withExcludes(out, mod.classifiers, lock(app)) { excludes =>
val noExplicitCheck = ivy.map(_.withCheckExplicit(false)) // val noExplicitCheck = ivy.map(_.withCheckExplicit(false))
IvyActions.transitiveScratch( lm.transitiveScratch(
is,
"sbt", "sbt",
GetClassifiersConfiguration(mod, GetClassifiersConfiguration(
excludes, mod,
c.withArtifactFilter(c.artifactFilter.invert), excludes.toVector,
noExplicitCheck, c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))),
srcTypes, srcTypes,
docTypes), docTypes),
uwConfig, uwConfig,
LogicalClock(st.hashCode),
Some(depDir),
log log
) ) match {
case Left(uw) => ???
case Right(ur) => ur
}
} }
} tag (Tags.Update, Tags.Network)).value } tag (Tags.Update, Tags.Network)).value
)) ++ Seq(bootIvyConfiguration := (ivyConfiguration in updateSbtClassifiers).value) )) ++ Seq(bootIvyConfiguration := (ivyConfiguration in updateSbtClassifiers).value)
@ -2151,12 +2163,16 @@ object Classpaths {
val pluginClasspath = loadedBuild.value.units(ref.build).unit.plugins.fullClasspath.toVector val pluginClasspath = loadedBuild.value.units(ref.build).unit.plugins.fullClasspath.toVector
val pluginJars = pluginClasspath.filter(_.data.isFile) // exclude directories: an approximation to whether they've been published val pluginJars = pluginClasspath.filter(_.data.isFile) // exclude directories: an approximation to whether they've been published
val pluginIDs: Vector[ModuleID] = pluginJars.flatMap(_ get moduleID.key) val pluginIDs: Vector[ModuleID] = pluginJars.flatMap(_ get moduleID.key)
GetClassifiersModule(projectID.value, GetClassifiersModule(
sbtDependency.value +: pluginIDs, projectID.value,
Vector(Configurations.Default), // TODO: Should it be sbt's scalaModuleInfo?
classifiers.toVector) scalaModuleInfo.value,
sbtDependency.value +: pluginIDs,
Vector(Configurations.Default),
classifiers.toVector
)
} }
def deliverTask(config: TaskKey[DeliverConfiguration]): Initialize[Task[File]] = def deliverTask(config: TaskKey[PublishConfiguration]): Initialize[Task[File]] =
Def.task { Def.task {
val _ = update.value val _ = update.value
IvyActions.deliver(ivyModule.value, config.value, streams.value.log) IvyActions.deliver(ivyModule.value, config.value, streams.value.log)
@ -2178,7 +2194,7 @@ object Classpaths {
} }
def withExcludes(out: File, classifiers: Seq[String], lock: xsbti.GlobalLock)( def withExcludes(out: File, classifiers: Seq[String], lock: xsbti.GlobalLock)(
f: Map[ModuleID, Set[String]] => UpdateReport): UpdateReport = { f: Map[ModuleID, Vector[ConfigRef]] => UpdateReport): UpdateReport = {
import sbt.librarymanagement.LibraryManagementCodec._ import sbt.librarymanagement.LibraryManagementCodec._
import sbt.util.FileBasedStore import sbt.util.FileBasedStore
implicit val isoString: sjsonnew.IsoString[scalajson.ast.unsafe.JValue] = implicit val isoString: sjsonnew.IsoString[scalajson.ast.unsafe.JValue] =
@ -2195,11 +2211,17 @@ object Classpaths {
def call = { def call = {
implicit val midJsonKeyFmt: sjsonnew.JsonKeyFormat[ModuleID] = moduleIdJsonKeyFormat implicit val midJsonKeyFmt: sjsonnew.JsonKeyFormat[ModuleID] = moduleIdJsonKeyFormat
val excludes = val excludes =
store.read[Map[ModuleID, Set[String]]](default = Map.empty[ModuleID, Set[String]]) store
.read[Map[ModuleID, Vector[ConfigRef]]](
default = Map.empty[ModuleID, Vector[ConfigRef]])
val report = f(excludes) val report = f(excludes)
val allExcludes = excludes ++ IvyActions.extractExcludes(report) val allExcludes: Map[ModuleID, Vector[ConfigRef]] = excludes ++ IvyActions
.extractExcludes(report)
.mapValues(cs => cs.map(c => ConfigRef(c)).toVector)
store.write(allExcludes) store.write(allExcludes)
IvyActions.addExcluded(report, classifiers.toVector, allExcludes) IvyActions.addExcluded(report,
classifiers.toVector,
allExcludes.mapValues(_.map(_.name).toSet))
} }
} }
) )
@ -2373,25 +2395,24 @@ object Classpaths {
def getPublishTo(repo: Option[Resolver]): Resolver = def getPublishTo(repo: Option[Resolver]): Resolver =
repo getOrElse sys.error("Repository for publishing is not specified.") repo getOrElse sys.error("Repository for publishing is not specified.")
def deliverConfig(outputDirectory: File, def publishConfig(publishMavenStyle: Boolean,
status: String = "release", deliverIvyPattern: String,
logging: UpdateLogging = UpdateLogging.DownloadOnly) = status: String,
new DeliverConfiguration(deliverPattern(outputDirectory), status, None, logging) configurations: Vector[ConfigRef],
artifacts: Vector[(Artifact, File)],
def publishConfig( checksums: Vector[String],
artifacts: Map[Artifact, File], resolverName: String = "local",
ivyFile: Option[File], logging: UpdateLogging = UpdateLogging.DownloadOnly,
checksums: Seq[String], overwrite: Boolean = false) =
resolverName: String = "local", PublishConfiguration(publishMavenStyle,
logging: UpdateLogging = UpdateLogging.DownloadOnly, deliverIvyPattern,
overwrite: Boolean = false status,
) = configurations,
new PublishConfiguration(ivyFile, resolverName,
resolverName, artifacts,
artifacts, checksums,
checksums.toVector, logging,
logging, overwrite)
overwrite)
def deliverPattern(outputPath: File): String = def deliverPattern(outputPath: File): String =
(outputPath / "[artifact]-[revision](-[classifier]).[ext]").absolutePath (outputPath / "[artifact]-[revision](-[classifier]).[ext]").absolutePath
@ -2426,7 +2447,8 @@ object Classpaths {
def projectResolverTask: Initialize[Task[Resolver]] = def projectResolverTask: Initialize[Task[Resolver]] =
projectDescriptors map { m => projectDescriptors map { m =>
new RawRepository(new ProjectResolver(ProjectResolver.InterProject, m)) val resolver = new ProjectResolver(ProjectResolver.InterProject, m)
new RawRepository(resolver, resolver.getName)
} }
def analyzed[T](data: T, analysis: CompileAnalysis) = def analyzed[T](data: T, analysis: CompileAnalysis) =
@ -2555,19 +2577,16 @@ object Classpaths {
val (rs, other) = (fullResolvers.value.toVector, otherResolvers.value.toVector) val (rs, other) = (fullResolvers.value.toVector, otherResolvers.value.toVector)
val s = streams.value val s = streams.value
warnResolversConflict(rs ++: other, s.log) warnResolversConflict(rs ++: other, s.log)
new InlineIvyConfiguration( InlineIvyConfiguration()
paths = ivyPaths.value, .withPaths(ivyPaths.value)
resolvers = rs, .withResolvers(rs)
otherResolvers = other, .withOtherResolvers(other)
moduleConfigurations = moduleConfigurations.value.toVector, .withModuleConfigurations(moduleConfigurations.value.toVector)
// offline.value, .withLock(lock(appConfiguration.value))
lock = Option(lock(appConfiguration.value)), .withChecksums((checksums in update).value)
checksums = (checksums in update).value.toVector, .withResolutionCacheDir(crossTarget.value / "resolution-cache")
managedChecksums = false, .withUpdateOptions(updateOptions.value)
resolutionCacheDir = Some(crossTarget.value / "resolution-cache"), .withLog(s.log)
updateOptions = updateOptions.value,
log = s.log
)
} }
import java.util.LinkedHashSet import java.util.LinkedHashSet
@ -2581,12 +2600,12 @@ object Classpaths {
val applicableConfigs = allConfigs(c) val applicableConfigs = allConfigs(c)
for (ac <- applicableConfigs) // add all configurations in this project for (ac <- applicableConfigs) // add all configurations in this project
visited add (p -> ac.name) visited add (p -> ac.name)
val masterConfs = names(getConfigurations(projectRef, data)) val masterConfs = names(getConfigurations(projectRef, data).toVector)
for (ResolvedClasspathDependency(dep, confMapping) <- deps.classpath(p)) { for (ResolvedClasspathDependency(dep, confMapping) <- deps.classpath(p)) {
val configurations = getConfigurations(dep, data) val configurations = getConfigurations(dep, data)
val mapping = val mapping =
mapped(confMapping, masterConfs, names(configurations), "compile", "*->compile") mapped(confMapping, masterConfs, names(configurations.toVector), "compile", "*->compile")
// map master configuration 'c' and all extended configurations to the appropriate dependency configuration // map master configuration 'c' and all extended configurations to the appropriate dependency configuration
for (ac <- applicableConfigs; depConfName <- mapping(ac.name)) { for (ac <- applicableConfigs; depConfName <- mapping(ac.name)) {
for (depConf <- confOpt(configurations, depConfName)) for (depConf <- confOpt(configurations, depConfName))
@ -2824,8 +2843,8 @@ object Classpaths {
case _: NoSuchMethodError => None case _: NoSuchMethodError => None
} }
def bootChecksums(app: xsbti.AppConfiguration): Seq[String] = def bootChecksums(app: xsbti.AppConfiguration): Vector[String] =
try { app.provider.scalaProvider.launcher.checksums.toSeq } catch { try { app.provider.scalaProvider.launcher.checksums.toVector } catch {
case _: NoSuchMethodError => IvySbt.DefaultChecksums case _: NoSuchMethodError => IvySbt.DefaultChecksums
} }
@ -2834,13 +2853,13 @@ object Classpaths {
catch { case _: NoSuchMethodError => false } catch { case _: NoSuchMethodError => false }
/** Loads the `appRepositories` configured for this launcher, if supported. */ /** Loads the `appRepositories` configured for this launcher, if supported. */
def appRepositories(app: xsbti.AppConfiguration): Option[Seq[Resolver]] = def appRepositories(app: xsbti.AppConfiguration): Option[Vector[Resolver]] =
try { Some(app.provider.scalaProvider.launcher.appRepositories.toSeq map bootRepository) } catch { try { Some(app.provider.scalaProvider.launcher.appRepositories.toVector map bootRepository) } catch {
case _: NoSuchMethodError => None case _: NoSuchMethodError => None
} }
def bootRepositories(app: xsbti.AppConfiguration): Option[Seq[Resolver]] = def bootRepositories(app: xsbti.AppConfiguration): Option[Vector[Resolver]] =
try { Some(app.provider.scalaProvider.launcher.ivyRepositories.toSeq map bootRepository) } catch { try { Some(app.provider.scalaProvider.launcher.ivyRepositories.toVector map bootRepository) } catch {
case _: NoSuchMethodError => None case _: NoSuchMethodError => None
} }
@ -2874,7 +2893,7 @@ object Classpaths {
p.id match { p.id match {
case Predefined.Local => Resolver.defaultLocal case Predefined.Local => Resolver.defaultLocal
case Predefined.MavenLocal => Resolver.mavenLocal case Predefined.MavenLocal => Resolver.mavenLocal
case Predefined.MavenCentral => DefaultMavenRepository case Predefined.MavenCentral => Resolver.DefaultMavenRepository
case Predefined.ScalaToolsReleases => Resolver.ScalaToolsReleases case Predefined.ScalaToolsReleases => Resolver.ScalaToolsReleases
case Predefined.ScalaToolsSnapshots => Resolver.ScalaToolsSnapshots case Predefined.ScalaToolsSnapshots => Resolver.ScalaToolsSnapshots
case Predefined.SonatypeOSSReleases => Resolver.sonatypeRepo("releases") case Predefined.SonatypeOSSReleases => Resolver.sonatypeRepo("releases")
@ -2998,7 +3017,13 @@ trait BuildExtra extends BuildCommon with DefExtra {
otherTask map { otherTask map {
case (base, app, pr, uo, s) => case (base, app, pr, uo, s) =>
val extraResolvers = if (addMultiResolver) Vector(pr) else Vector.empty val extraResolvers = if (addMultiResolver) Vector(pr) else Vector.empty
ExternalIvyConfiguration(Option(lock(app)), base, s.log, uo, u, extraResolvers) ExternalIvyConfiguration()
.withLock(lock(app))
.withBaseDirectory(base)
.withLog(s.log)
.withUpdateOptions(uo)
.withUri(u)
.withExtraResolvers(extraResolvers)
} }
}).value }).value
} }
@ -3007,18 +3032,19 @@ trait BuildExtra extends BuildCommon with DefExtra {
baseDirectory.value / name baseDirectory.value / name
} }
def externalIvyFile( def externalIvyFile(file: Initialize[File] = inBase("ivy.xml"),
file: Initialize[File] = inBase("ivy.xml"), iScala: Initialize[Option[ScalaModuleInfo]] = scalaModuleInfo)
iScala: Initialize[Option[IvyScala]] = ivyScala): Setting[Task[ModuleSettings]] = : Setting[Task[ModuleSettings]] =
moduleSettings := IvyFileConfiguration(ivyValidate.value, moduleSettings := IvyFileConfiguration(ivyValidate.value,
iScala.value, iScala.value,
file.value, file.value,
managedScalaInstance.value) managedScalaInstance.value)
def externalPom(file: Initialize[File] = inBase("pom.xml"), def externalPom(file: Initialize[File] = inBase("pom.xml"),
iScala: Initialize[Option[IvyScala]] = ivyScala): Setting[Task[ModuleSettings]] = iScala: Initialize[Option[ScalaModuleInfo]] = scalaModuleInfo)
: Setting[Task[ModuleSettings]] =
moduleSettings := PomConfiguration(ivyValidate.value, moduleSettings := PomConfiguration(ivyValidate.value,
ivyScala.value, scalaModuleInfo.value,
file.value, file.value,
managedScalaInstance.value) managedScalaInstance.value)

View File

@ -140,7 +140,7 @@ object EvaluateTaskConfig {
final case class PluginData( final case class PluginData(
dependencyClasspath: Seq[Attributed[File]], dependencyClasspath: Seq[Attributed[File]],
definitionClasspath: Seq[Attributed[File]], definitionClasspath: Seq[Attributed[File]],
resolvers: Option[Seq[Resolver]], resolvers: Option[Vector[Resolver]],
report: Option[UpdateReport], report: Option[UpdateReport],
scalacOptions: Seq[String] scalacOptions: Seq[String]
) { ) {

View File

@ -42,44 +42,40 @@ import sbt.internal.util.{ AttributeKey, SourcePosition }
import sbt.librarymanagement.Configurations.CompilerPlugin import sbt.librarymanagement.Configurations.CompilerPlugin
import sbt.librarymanagement.LibraryManagementCodec._ import sbt.librarymanagement.LibraryManagementCodec._
import sbt.librarymanagement.ivy.{ Credentials, UpdateOptions }
import sbt.librarymanagement.{ import sbt.librarymanagement.{
Artifact, Artifact,
Configuration, Configuration,
ConflictManager, ConflictManager,
ConflictWarning, ConflictWarning,
Credentials,
CrossVersion, CrossVersion,
Developer, Developer,
DependencyResolution,
EvictionWarning, EvictionWarning,
EvictionWarningOptions, EvictionWarningOptions,
IvyScala, GetClassifiersModule,
MakePomConfiguration,
MavenRepository, MavenRepository,
ModuleConfiguration, ModuleConfiguration,
ModuleID, ModuleID,
ModuleInfo, ModuleInfo,
ModuleSettings, ModuleSettings,
PublishConfiguration,
Publisher,
Resolver, Resolver,
RetrieveConfiguration,
ScalaModuleInfo,
ScalaVersion, ScalaVersion,
ScmInfo, ScmInfo,
TrackLevel, TrackLevel,
UnresolvedWarningConfiguration,
UpdateConfiguration, UpdateConfiguration,
UpdateOptions,
UpdateLogging, UpdateLogging,
UpdateReport UpdateReport
} }
import sbt.librarymanagement.ExclusionRule import sbt.librarymanagement.InclExclRule
import sbt.internal.librarymanagement.{ import sbt.internal.librarymanagement.{ CompatibilityWarningOptions, IvySbt }
CompatibilityWarningOptions, import sbt.librarymanagement.ivy.{ IvyConfiguration, IvyPaths }
DeliverConfiguration,
GetClassifiersModule,
IvyConfiguration,
IvyPaths,
IvySbt,
MakePomConfiguration,
PublishConfiguration,
RetrieveConfiguration,
UnresolvedWarningConfiguration
}
import sbt.util.{ Level, Logger } import sbt.util.{ Level, Logger }
import org.apache.logging.log4j.core.Appender import org.apache.logging.log4j.core.Appender
import sbt.BuildSyntax._ import sbt.BuildSyntax._
@ -344,6 +340,8 @@ object Keys {
val updateOptions = SettingKey[UpdateOptions]("update-options", "Options for resolving managed dependencies.", DSetting) val updateOptions = SettingKey[UpdateOptions]("update-options", "Options for resolving managed dependencies.", DSetting)
val unresolvedWarningConfiguration = TaskKey[UnresolvedWarningConfiguration]("unresolved-warning-configuration", "Configuration for unresolved dependency warning.", DTask) val unresolvedWarningConfiguration = TaskKey[UnresolvedWarningConfiguration]("unresolved-warning-configuration", "Configuration for unresolved dependency warning.", DTask)
val dependencyPositions = TaskKey[Map[ModuleID, SourcePosition]]("dependency-positions", "Source positions where the dependencies are defined.", DTask) val dependencyPositions = TaskKey[Map[ModuleID, SourcePosition]]("dependency-positions", "Source positions where the dependencies are defined.", DTask)
val dependencyResolution = TaskKey[DependencyResolution]("dependency-resolution", "Provides the sbt interface to dependency resolution.", CTask)
val publisher = TaskKey[Publisher]("publisher", "Provides the sbt interface to publisher")
val ivySbt = TaskKey[IvySbt]("ivy-sbt", "Provides the sbt interface to Ivy.", CTask) val ivySbt = TaskKey[IvySbt]("ivy-sbt", "Provides the sbt interface to Ivy.", CTask)
val ivyModule = TaskKey[IvySbt#Module]("ivy-module", "Provides the sbt interface to a configured Ivy module.", CTask) val ivyModule = TaskKey[IvySbt#Module]("ivy-module", "Provides the sbt interface to a configured Ivy module.", CTask)
val updateCacheName = TaskKey[String]("updateCacheName", "Defines the directory name used to store the update cache files (inside the streams cacheDirectory).", DTask) val updateCacheName = TaskKey[String]("updateCacheName", "Defines the directory name used to store the update cache files (inside the streams cacheDirectory).", DTask)
@ -354,14 +352,12 @@ object Keys {
val updateClassifiers = TaskKey[UpdateReport]("update-classifiers", "Resolves and optionally retrieves classified artifacts, such as javadocs and sources, for dependency definitions, transitively.", BPlusTask, update) val updateClassifiers = TaskKey[UpdateReport]("update-classifiers", "Resolves and optionally retrieves classified artifacts, such as javadocs and sources, for dependency definitions, transitively.", BPlusTask, update)
val transitiveClassifiers = SettingKey[Seq[String]]("transitive-classifiers", "List of classifiers used for transitively obtaining extra artifacts for sbt or declared dependencies.", BSetting) val transitiveClassifiers = SettingKey[Seq[String]]("transitive-classifiers", "List of classifiers used for transitively obtaining extra artifacts for sbt or declared dependencies.", BSetting)
val updateSbtClassifiers = TaskKey[UpdateReport]("update-sbt-classifiers", "Resolves and optionally retrieves classifiers, such as javadocs and sources, for sbt, transitively.", BPlusTask, updateClassifiers) val updateSbtClassifiers = TaskKey[UpdateReport]("update-sbt-classifiers", "Resolves and optionally retrieves classifiers, such as javadocs and sources, for sbt, transitively.", BPlusTask, updateClassifiers)
val sourceArtifactTypes = SettingKey[Set[String]]("source-artifact-types", "Ivy artifact types that correspond to source artifacts. Used by IDEs to resolve these resources.", BSetting) val sourceArtifactTypes = SettingKey[Vector[String]]("source-artifact-types", "Ivy artifact types that correspond to source artifacts. Used by IDEs to resolve these resources.", BSetting)
val docArtifactTypes = SettingKey[Set[String]]("doc-artifact-types", "Ivy artifact types that correspond to javadoc artifacts. Used by IDEs to resolve these resources.", BSetting) val docArtifactTypes = SettingKey[Vector[String]]("doc-artifact-types", "Ivy artifact types that correspond to javadoc artifacts. Used by IDEs to resolve these resources.", BSetting)
val publishConfiguration = TaskKey[PublishConfiguration]("publish-configuration", "Configuration for publishing to a repository.", DTask) val publishConfiguration = TaskKey[PublishConfiguration]("publish-configuration", "Configuration for publishing to a repository.", DTask)
val publishLocalConfiguration = TaskKey[PublishConfiguration]("publish-local-configuration", "Configuration for publishing to the local Ivy repository.", DTask) val publishLocalConfiguration = TaskKey[PublishConfiguration]("publish-local-configuration", "Configuration for publishing to the local Ivy repository.", DTask)
val publishM2Configuration = TaskKey[PublishConfiguration]("publish-m2-configuration", "Configuration for publishing to the local Maven repository.", DTask) val publishM2Configuration = TaskKey[PublishConfiguration]("publish-m2-configuration", "Configuration for publishing to the local Maven repository.", DTask)
val deliverConfiguration = TaskKey[DeliverConfiguration]("deliver-configuration", "Configuration for generating the finished Ivy file for publishing.", DTask)
val deliverLocalConfiguration = TaskKey[DeliverConfiguration]("deliver-local-configuration", "Configuration for generating the finished Ivy file for local publishing.", DTask)
val makePomConfiguration = SettingKey[MakePomConfiguration]("make-pom-configuration", "Configuration for generating a pom.", DSetting) val makePomConfiguration = SettingKey[MakePomConfiguration]("make-pom-configuration", "Configuration for generating a pom.", DSetting)
val packagedArtifacts = TaskKey[Map[Artifact, File]]("packaged-artifacts", "Packages all artifacts for publishing and maps the Artifact definition to the generated file.", CTask) val packagedArtifacts = TaskKey[Map[Artifact, File]]("packaged-artifacts", "Packages all artifacts for publishing and maps the Artifact definition to the generated file.", CTask)
val publishMavenStyle = SettingKey[Boolean]("publish-maven-style", "Configures whether to generate and publish a pom (true) or Ivy file (false).", BSetting) val publishMavenStyle = SettingKey[Boolean]("publish-maven-style", "Configures whether to generate and publish a pom (true) or Ivy file (false).", BSetting)
@ -385,13 +381,13 @@ object Keys {
val moduleID = SettingKey[ModuleID]("module-id", "A dependency management descriptor. This is currently used for associating a ModuleID with a classpath entry.", BPlusSetting) val moduleID = SettingKey[ModuleID]("module-id", "A dependency management descriptor. This is currently used for associating a ModuleID with a classpath entry.", BPlusSetting)
val projectID = SettingKey[ModuleID]("project-id", "The dependency management descriptor for the current module.", BMinusSetting) val projectID = SettingKey[ModuleID]("project-id", "The dependency management descriptor for the current module.", BMinusSetting)
val overrideBuildResolvers = SettingKey[Boolean]("override-build-resolvers", "Whether or not all the build resolvers should be overridden with what's defined from the launcher.", BMinusSetting) val overrideBuildResolvers = SettingKey[Boolean]("override-build-resolvers", "Whether or not all the build resolvers should be overridden with what's defined from the launcher.", BMinusSetting)
val bootResolvers = TaskKey[Option[Seq[Resolver]]]("boot-resolvers", "The resolvers used by the sbt launcher.", BMinusSetting) val bootResolvers = TaskKey[Option[Vector[Resolver]]]("boot-resolvers", "The resolvers used by the sbt launcher.", BMinusSetting)
val appResolvers = SettingKey[Option[Seq[Resolver]]]("app-resolvers", "The resolvers configured for this application by the sbt launcher.", BMinusSetting) val appResolvers = SettingKey[Option[Vector[Resolver]]]("app-resolvers", "The resolvers configured for this application by the sbt launcher.", BMinusSetting)
val externalResolvers = TaskKey[Seq[Resolver]]("external-resolvers", "The external resolvers for automatically managed dependencies.", BMinusSetting) val externalResolvers = TaskKey[Vector[Resolver]]("external-resolvers", "The external resolvers for automatically managed dependencies.", BMinusSetting)
val resolvers = SettingKey[Seq[Resolver]]("resolvers", "The user-defined additional resolvers for automatically managed dependencies.", BMinusTask) val resolvers = SettingKey[Vector[Resolver]]("resolvers", "The user-defined additional resolvers for automatically managed dependencies.", BMinusTask)
val projectResolver = TaskKey[Resolver]("project-resolver", "Resolver that handles inter-project dependencies.", DTask) val projectResolver = TaskKey[Resolver]("project-resolver", "Resolver that handles inter-project dependencies.", DTask)
val fullResolvers = TaskKey[Seq[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.", CTask) val fullResolvers = TaskKey[Vector[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.", CTask)
val otherResolvers = TaskKey[Seq[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.", CSetting) val otherResolvers = TaskKey[Vector[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.", CSetting)
val useJCenter = SettingKey[Boolean]("use-jcenter", "Use JCenter as the default repository.", BSetting) val useJCenter = SettingKey[Boolean]("use-jcenter", "Use JCenter as the default repository.", BSetting)
val moduleConfigurations = SettingKey[Seq[ModuleConfiguration]]("module-configurations", "Defines module configurations, which override resolvers on a per-module basis.", BMinusSetting) val moduleConfigurations = SettingKey[Seq[ModuleConfiguration]]("module-configurations", "Defines module configurations, which override resolvers on a per-module basis.", BMinusSetting)
val retrievePattern = SettingKey[String]("retrieve-pattern", "Pattern used to retrieve managed dependencies to the current build.", DSetting) val retrievePattern = SettingKey[String]("retrieve-pattern", "Pattern used to retrieve managed dependencies to the current build.", DSetting)
@ -400,12 +396,12 @@ object Keys {
val ivyPaths = SettingKey[IvyPaths]("ivy-paths", "Configures paths used by Ivy for dependency management.", DSetting) val ivyPaths = SettingKey[IvyPaths]("ivy-paths", "Configures paths used by Ivy for dependency management.", DSetting)
val dependencyCacheDirectory = TaskKey[File]("dependency-cache-directory", "The base directory for cached dependencies.", DTask) val dependencyCacheDirectory = TaskKey[File]("dependency-cache-directory", "The base directory for cached dependencies.", DTask)
val libraryDependencies = SettingKey[Seq[ModuleID]]("library-dependencies", "Declares managed dependencies.", APlusSetting) val libraryDependencies = SettingKey[Seq[ModuleID]]("library-dependencies", "Declares managed dependencies.", APlusSetting)
val dependencyOverrides = SettingKey[Set[ModuleID]]("dependency-overrides", "Declares managed dependency overrides.", BSetting) val dependencyOverrides = SettingKey[Vector[ModuleID]]("dependency-overrides", "Declares managed dependency overrides.", BSetting)
val excludeDependencies = SettingKey[Seq[ExclusionRule]]("exclude-dependencies", "Declares managed dependency exclusions.", BSetting) val excludeDependencies = SettingKey[Seq[InclExclRule]]("exclude-dependencies", "Declares managed dependency exclusions.", BSetting)
val allDependencies = TaskKey[Seq[ModuleID]]("all-dependencies", "Inter-project and library dependencies.", CTask) val allDependencies = TaskKey[Seq[ModuleID]]("all-dependencies", "Inter-project and library dependencies.", CTask)
val projectDependencies = TaskKey[Seq[ModuleID]]("project-dependencies", "Inter-project dependencies.", DTask) val projectDependencies = TaskKey[Seq[ModuleID]]("project-dependencies", "Inter-project dependencies.", DTask)
val ivyXML = SettingKey[NodeSeq]("ivy-xml", "Defines inline Ivy XML for configuring dependency management.", BSetting) val ivyXML = SettingKey[NodeSeq]("ivy-xml", "Defines inline Ivy XML for configuring dependency management.", BSetting)
val ivyScala = SettingKey[Option[IvyScala]]("ivy-scala", "Configures how Scala dependencies are checked, filtered, and injected.", CSetting) val scalaModuleInfo = SettingKey[Option[ScalaModuleInfo]]("scala-module-info", "Configures how Scala dependencies are checked, filtered, and injected.", CSetting)
val ivyValidate = SettingKey[Boolean]("ivy-validate", "Enables/disables Ivy validation of module metadata.", BSetting) val ivyValidate = SettingKey[Boolean]("ivy-validate", "Enables/disables Ivy validation of module metadata.", BSetting)
val ivyLoggingLevel = SettingKey[UpdateLogging]("ivy-logging-level", "The logging level for updating.", BSetting) val ivyLoggingLevel = SettingKey[UpdateLogging]("ivy-logging-level", "The logging level for updating.", BSetting)
val publishTo = TaskKey[Option[Resolver]]("publish-to", "The resolver to publish to.", ASetting) val publishTo = TaskKey[Option[Resolver]]("publish-to", "The resolver to publish to.", ASetting)
@ -414,12 +410,12 @@ object Keys {
val autoUpdate = SettingKey[Boolean]("auto-update", "<unimplemented>", Invisible) val autoUpdate = SettingKey[Boolean]("auto-update", "<unimplemented>", Invisible)
val retrieveManaged = SettingKey[Boolean]("retrieve-managed", "If true, enables retrieving dependencies to the current build. Otherwise, dependencies are used directly from the cache.", BSetting) val retrieveManaged = SettingKey[Boolean]("retrieve-managed", "If true, enables retrieving dependencies to the current build. Otherwise, dependencies are used directly from the cache.", BSetting)
val retrieveManagedSync = SettingKey[Boolean]("retrieve-managed-sync", "If true, enables synchronizing the dependencies retrieved to the current build by removed unneeded files.", BSetting) val retrieveManagedSync = SettingKey[Boolean]("retrieve-managed-sync", "If true, enables synchronizing the dependencies retrieved to the current build by removed unneeded files.", BSetting)
val configurationsToRetrieve = SettingKey[Option[Set[Configuration]]]("configurations-to-retrieve", "An optional set of configurations from which to retrieve dependencies if retrieveManaged is set to true", BSetting) val configurationsToRetrieve = SettingKey[Option[Vector[Configuration]]]("configurations-to-retrieve", "An optional set of configurations from which to retrieve dependencies if retrieveManaged is set to true", BSetting)
val managedDirectory = SettingKey[File]("managed-directory", "Directory to which managed dependencies are retrieved.", BSetting) val managedDirectory = SettingKey[File]("managed-directory", "Directory to which managed dependencies are retrieved.", BSetting)
val classpathTypes = SettingKey[Set[String]]("classpath-types", "Artifact types that are included on the classpath.", BSetting) val classpathTypes = SettingKey[Set[String]]("classpath-types", "Artifact types that are included on the classpath.", BSetting)
val publishArtifact = SettingKey[Boolean]("publish-artifact", "Enables (true) or disables (false) publishing an artifact.", AMinusSetting) val publishArtifact = SettingKey[Boolean]("publish-artifact", "Enables (true) or disables (false) publishing an artifact.", AMinusSetting)
val packagedArtifact = TaskKey[(Artifact, File)]("packaged-artifact", "Generates a packaged artifact, returning the Artifact and the produced File.", CTask) val packagedArtifact = TaskKey[(Artifact, File)]("packaged-artifact", "Generates a packaged artifact, returning the Artifact and the produced File.", CTask)
val checksums = SettingKey[Seq[String]]("checksums", "The list of checksums to generate and to verify for dependencies.", BSetting) val checksums = SettingKey[Vector[String]]("checksums", "The list of checksums to generate and to verify for dependencies.", BSetting)
val forceUpdatePeriod = SettingKey[Option[FiniteDuration]]("force-update-period", "Duration after which to force a full update to occur", CSetting) val forceUpdatePeriod = SettingKey[Option[FiniteDuration]]("force-update-period", "Duration after which to force a full update to occur", CSetting)
val classifiersModule = TaskKey[GetClassifiersModule]("classifiers-module", rank = CTask) val classifiersModule = TaskKey[GetClassifiersModule]("classifiers-module", rank = CTask)

View File

@ -3,7 +3,8 @@
*/ */
package sbt package sbt
import sbt.librarymanagement.{ Credentials, MavenRepository, Resolver } import sbt.librarymanagement.{ MavenRepository, Resolver }
import sbt.librarymanagement.ivy.Credentials
import java.io.File import java.io.File
import java.net.URL import java.net.URL
@ -62,11 +63,12 @@ object DefaultOptions {
def scaladoc(name: String, version: String): Seq[String] = def scaladoc(name: String, version: String): Seq[String] =
doc.title(name) ++ doc.version(version) doc.title(name) ++ doc.version(version)
def resolvers(snapshot: Boolean): Seq[Resolver] = { def resolvers(snapshot: Boolean): Vector[Resolver] = {
if (snapshot) Seq(resolver.sbtSnapshots) else Nil if (snapshot) Vector(resolver.sbtSnapshots) else Vector.empty
} }
def pluginResolvers(plugin: Boolean, snapshot: Boolean): Seq[Resolver] = { def pluginResolvers(plugin: Boolean, snapshot: Boolean): Vector[Resolver] = {
if (plugin && snapshot) Seq(resolver.sbtSnapshots, resolver.sbtIvySnapshots) else Nil if (plugin && snapshot) Vector(resolver.sbtSnapshots, resolver.sbtIvySnapshots)
else Vector.empty
} }
def addResolvers: Setting[_] = Keys.resolvers ++= { resolvers(Keys.isSnapshot.value) } def addResolvers: Setting[_] = Keys.resolvers ++= { resolvers(Keys.isSnapshot.value) }
def addPluginResolvers: Setting[_] = def addPluginResolvers: Setting[_] =

View File

@ -8,7 +8,7 @@ import sbt.util._
import sbt.internal.util.complete.{ DefaultParsers, Parser }, DefaultParsers._ import sbt.internal.util.complete.{ DefaultParsers, Parser }, DefaultParsers._
import xsbti.AppConfiguration import xsbti.AppConfiguration
import sbt.librarymanagement._ import sbt.librarymanagement._
import sbt.internal.librarymanagement.IvyConfiguration import sbt.librarymanagement.ivy.{ IvyConfiguration, IvyDependencyResolution }
import sbt.internal.inc.classpath.ClasspathUtilities import sbt.internal.inc.classpath.ClasspathUtilities
import BasicCommandStrings._, BasicKeys._ import BasicCommandStrings._, BasicKeys._
@ -25,13 +25,13 @@ private[sbt] object TemplateCommandUtil {
val extracted = (Project extract state) val extracted = (Project extract state)
val (s2, ivyConf) = extracted.runTask(Keys.ivyConfiguration, state) val (s2, ivyConf) = extracted.runTask(Keys.ivyConfiguration, state)
val globalBase = BuildPaths.getGlobalBase(state) val globalBase = BuildPaths.getGlobalBase(state)
val ivyScala = extracted.get(Keys.ivyScala in Keys.updateSbtClassifiers) val scalaModuleInfo = extracted.get(Keys.scalaModuleInfo in Keys.updateSbtClassifiers)
val arguments = inputArg.toList ++ val arguments = inputArg.toList ++
(state.remainingCommands match { (state.remainingCommands match {
case exec :: Nil if exec.commandLine == "shell" => Nil case exec :: Nil if exec.commandLine == "shell" => Nil
case xs => xs map (_.commandLine) case xs => xs map (_.commandLine)
}) })
run(infos, arguments, state.configuration, ivyConf, globalBase, ivyScala, log) run(infos, arguments, state.configuration, ivyConf, globalBase, scalaModuleInfo, log)
"exit" :: s2.copy(remainingCommands = Nil) "exit" :: s2.copy(remainingCommands = Nil)
} }
@ -41,11 +41,11 @@ private[sbt] object TemplateCommandUtil {
config: AppConfiguration, config: AppConfiguration,
ivyConf: IvyConfiguration, ivyConf: IvyConfiguration,
globalBase: File, globalBase: File,
ivyScala: Option[IvyScala], scalaModuleInfo: Option[ScalaModuleInfo],
log: Logger log: Logger
): Unit = ): Unit =
infos find { info => infos find { info =>
val loader = infoLoader(info, config, ivyConf, globalBase, ivyScala, log) val loader = infoLoader(info, config, ivyConf, globalBase, scalaModuleInfo, log)
val hit = tryTemplate(info, arguments, loader) val hit = tryTemplate(info, arguments, loader)
if (hit) { if (hit) {
runTemplate(info, arguments, loader) runTemplate(info, arguments, loader)
@ -75,10 +75,10 @@ private[sbt] object TemplateCommandUtil {
config: AppConfiguration, config: AppConfiguration,
ivyConf: IvyConfiguration, ivyConf: IvyConfiguration,
globalBase: File, globalBase: File,
ivyScala: Option[IvyScala], scalaModuleInfo: Option[ScalaModuleInfo],
log: Logger log: Logger
): ClassLoader = { ): ClassLoader = {
val cp = classpathForInfo(info, ivyConf, globalBase, ivyScala, log) val cp = classpathForInfo(info, ivyConf, globalBase, scalaModuleInfo, log)
ClasspathUtilities.toLoader(cp, config.provider.loader) ClasspathUtilities.toLoader(cp, config.provider.loader)
} }
@ -103,10 +103,10 @@ private[sbt] object TemplateCommandUtil {
info: TemplateResolverInfo, info: TemplateResolverInfo,
ivyConf: IvyConfiguration, ivyConf: IvyConfiguration,
globalBase: File, globalBase: File,
ivyScala: Option[IvyScala], scalaModuleInfo: Option[ScalaModuleInfo],
log: Logger log: Logger
): List[File] = { ): List[File] = {
val lm = new DefaultLibraryManagement(ivyConf, log) val lm = IvyDependencyResolution(ivyConf)
val templatesBaseDirectory = new File(globalBase, "templates") val templatesBaseDirectory = new File(globalBase, "templates")
val templateId = s"${info.module.organization}_${info.module.name}_${info.module.revision}" val templateId = s"${info.module.organization}_${info.module.name}_${info.module.revision}"
val templateDirectory = new File(templatesBaseDirectory, templateId) val templateDirectory = new File(templatesBaseDirectory, templateId)
@ -114,8 +114,13 @@ private[sbt] object TemplateCommandUtil {
if (!(info.module.revision endsWith "-SNAPSHOT") && jars.nonEmpty) jars.toList if (!(info.module.revision endsWith "-SNAPSHOT") && jars.nonEmpty) jars.toList
else { else {
IO.createDirectory(templateDirectory) IO.createDirectory(templateDirectory)
val m = lm.getModule(info.module.withConfigurations(Some("component")), ivyScala) val m = lm.moduleDescriptor(info.module.withConfigurations(Some("component")),
val xs = lm.update(m, templateDirectory)(_ => true).toList.flatten Vector.empty,
scalaModuleInfo)
val xs = lm.retrieve(m, templateDirectory, log) match {
case Left(_) => ??? // FIXME
case Right(files) => files.toList
}
xs xs
} }
} }

View File

@ -3,14 +3,14 @@ package sbt.internal
import sbt.internal.librarymanagement._ import sbt.internal.librarymanagement._
import sbt.internal.util.Types._ import sbt.internal.util.Types._
import sbt.internal.util.{ HList, HNil } import sbt.internal.util.{ HList, HNil }
import sbt.internal.util.HListFormats._ import sbt.io.Hash
import sbt.io.{ Hash, IO }
import sbt.librarymanagement._ import sbt.librarymanagement._
import sbt.util.CacheImplicits._ import sbt.librarymanagement.ivy._
import sbt.util._ import sbt.util._
import sbt.internal.util.HListFormats._
import sjsonnew.JsonFormat import sjsonnew.JsonFormat
object AltLibraryManagementCodec extends LibraryManagementCodec { object AltLibraryManagementCodec extends IvyLibraryManagementCodec {
type In0 = ModuleSettings :+: UpdateConfiguration :+: HNil type In0 = ModuleSettings :+: UpdateConfiguration :+: HNil
type In = IvyConfiguration :+: In0 type In = IvyConfiguration :+: In0
@ -37,33 +37,31 @@ object AltLibraryManagementCodec extends LibraryManagementCodec {
SftpRepository, SftpRepository,
RawRepository] RawRepository]
type InlineIvyHL = (IvyPaths :+: Vector[Resolver] :+: Vector[Resolver] :+: Vector[ type InlineIvyHL = (Option[IvyPaths] :+: Vector[Resolver] :+: Vector[Resolver] :+: Vector[
ModuleConfiguration] :+: Vector[String] :+: Boolean :+: HNil) ModuleConfiguration] :+: Vector[String] :+: Boolean :+: HNil)
def inlineIvyToHL(i: InlineIvyConfiguration): InlineIvyHL = ( def inlineIvyToHL(i: InlineIvyConfiguration): InlineIvyHL = (
i.paths :+: i.resolvers :+: i.otherResolvers :+: i.moduleConfigurations :+: i.paths :+: i.resolvers :+: i.otherResolvers :+: i.moduleConfigurations :+:
i.checksums :+: i.managedChecksums :+: HNil i.checksums :+: i.managedChecksums :+: HNil
) )
type ExternalIvyHL = PlainFileInfo :+: Array[Byte] :+: HNil type ExternalIvyHL = Option[PlainFileInfo] :+: Array[Byte] :+: HNil
def externalIvyToHL(e: ExternalIvyConfiguration): ExternalIvyHL = def externalIvyToHL(e: ExternalIvyConfiguration): ExternalIvyHL =
FileInfo.exists(e.baseDirectory) :+: Hash.contentsIfLocal(e.uri) :+: HNil e.baseDirectory.map(FileInfo.exists.apply) :+: e.uri
.map(Hash.contentsIfLocal)
.getOrElse(Array.empty) :+: HNil
// Redefine to use a subset of properties, that are serialisable // Redefine to use a subset of properties, that are serialisable
override lazy implicit val InlineIvyConfigurationFormat: JsonFormat[InlineIvyConfiguration] = { override lazy implicit val InlineIvyConfigurationFormat: JsonFormat[InlineIvyConfiguration] = {
def hlToInlineIvy(i: InlineIvyHL): InlineIvyConfiguration = { def hlToInlineIvy(i: InlineIvyHL): InlineIvyConfiguration = {
val (paths :+: resolvers :+: otherResolvers :+: moduleConfigurations :+: localOnly val (paths :+: resolvers :+: otherResolvers :+: moduleConfigurations :+: checksums
:+: checksums :+: HNil) = i :+: managedChecksums :+: HNil) = i
InlineIvyConfiguration(None, InlineIvyConfiguration()
IO.createTemporaryDirectory, .withPaths(paths)
NullLogger, .withResolvers(resolvers)
UpdateOptions(), .withOtherResolvers(otherResolvers)
paths, .withModuleConfigurations(moduleConfigurations)
resolvers, .withManagedChecksums(managedChecksums)
otherResolvers, .withChecksums(checksums)
moduleConfigurations,
localOnly,
checksums,
None)
} }
projectFormat[InlineIvyConfiguration, InlineIvyHL](inlineIvyToHL, hlToInlineIvy) projectFormat[InlineIvyConfiguration, InlineIvyHL](inlineIvyToHL, hlToInlineIvy)
@ -76,11 +74,12 @@ object AltLibraryManagementCodec extends LibraryManagementCodec {
val baseDirectory :+: _ /* uri */ :+: HNil = e val baseDirectory :+: _ /* uri */ :+: HNil = e
ExternalIvyConfiguration( ExternalIvyConfiguration(
None, None,
baseDirectory.file, Some(NullLogger),
NullLogger,
UpdateOptions(), UpdateOptions(),
IO.createTemporaryDirectory.toURI /* the original uri is destroyed.. */, baseDirectory.map(_.file),
Vector.empty) None /* the original uri is destroyed.. */,
Vector.empty
)
} }
projectFormat[ExternalIvyConfiguration, ExternalIvyHL](externalIvyToHL, hlToExternalIvy) projectFormat[ExternalIvyConfiguration, ExternalIvyHL](externalIvyToHL, hlToExternalIvy)

View File

@ -15,7 +15,7 @@ object ConsoleProject {
val cpImports = new Imports(extracted, state) val cpImports = new Imports(extracted, state)
val bindings = ("currentState" -> state) :: ("extracted" -> extracted) :: ("cpHelpers" -> cpImports) :: Nil val bindings = ("currentState" -> state) :: ("extracted" -> extracted) :: ("cpHelpers" -> cpImports) :: Nil
val unit = extracted.currentUnit val unit = extracted.currentUnit
val (_, ivyConf) = extracted.runTask(Keys.ivyConfiguration, state) val (_, dependencyResolution) = extracted.runTask(Keys.dependencyResolution, state)
val scalaInstance = { val scalaInstance = {
val scalaProvider = state.configuration.provider.scalaProvider val scalaProvider = state.configuration.provider.scalaProvider
ScalaInstance(scalaProvider.version, scalaProvider.launcher) ScalaInstance(scalaProvider.version, scalaProvider.launcher)
@ -30,7 +30,7 @@ object ConsoleProject {
globalLock = launcher.globalLock, globalLock = launcher.globalLock,
componentProvider = app.provider.components, componentProvider = app.provider.components,
secondaryCacheDir = Option(zincDir), secondaryCacheDir = Option(zincDir),
ivyConfiguration = ivyConf, dependencyResolution = dependencyResolution,
compilerBridgeSource = extracted.get(Keys.scalaCompilerBridgeSource), compilerBridgeSource = extracted.get(Keys.scalaCompilerBridgeSource),
scalaJarsTarget = zincDir, scalaJarsTarget = zincDir,
log = log log = log

View File

@ -102,7 +102,7 @@ object GlobalPlugin {
final case class GlobalPluginData(projectID: ModuleID, final case class GlobalPluginData(projectID: ModuleID,
dependencies: Seq[ModuleID], dependencies: Seq[ModuleID],
descriptors: Map[ModuleRevisionId, ModuleDescriptor], descriptors: Map[ModuleRevisionId, ModuleDescriptor],
resolvers: Seq[Resolver], resolvers: Vector[Resolver],
fullClasspath: Classpath, fullClasspath: Classpath,
internalClasspath: Classpath)(val updateReport: UpdateReport) internalClasspath: Classpath)(val updateReport: UpdateReport)
final case class GlobalPlugin(data: GlobalPluginData, final case class GlobalPlugin(data: GlobalPluginData,

View File

@ -41,7 +41,7 @@ object IvyConsole {
val depSettings: Seq[Setting[_]] = Seq( val depSettings: Seq[Setting[_]] = Seq(
libraryDependencies ++= managed.reverse, libraryDependencies ++= managed.reverse,
resolvers ++= repos.reverse, resolvers ++= repos.reverse.toVector,
unmanagedJars in Compile ++= Attributed blankSeq unmanaged.reverse, unmanagedJars in Compile ++= Attributed blankSeq unmanaged.reverse,
logLevel in Global := Level.Warn, logLevel in Global := Level.Warn,
showSuccess in Global := false showSuccess in Global := false

View File

@ -7,8 +7,9 @@ import sbt.internal.util.HNil
import sbt.internal.util.Types._ import sbt.internal.util.Types._
import sbt.internal.util.HListFormats._ import sbt.internal.util.HListFormats._
import sbt.librarymanagement._ import sbt.librarymanagement._
import sbt.librarymanagement.ivy._
import sbt.librarymanagement.syntax._ import sbt.librarymanagement.syntax._
import sbt.util.CacheImplicits._ import sbt.internal.util.HListFormats._
import sbt.util.{ CacheStore, CacheStoreFactory, Logger, Tracked } import sbt.util.{ CacheStore, CacheStoreFactory, Logger, Tracked }
object LibraryManagement { object LibraryManagement {
@ -40,7 +41,7 @@ object LibraryManagement {
log.info(s"Updating $label...") log.info(s"Updating $label...")
val reportOrUnresolved: Either[UnresolvedWarning, UpdateReport] = val reportOrUnresolved: Either[UnresolvedWarning, UpdateReport] =
//try { //try {
IvyActions.updateEither(module, updateConfig, uwConfig, logicalClock, depDir, log) IvyActions.updateEither(module, updateConfig, uwConfig, /*logicalClock, depDir,*/ log)
// } catch { // } catch {
// case e: Throwable => // case e: Throwable =>
// e.printStackTrace // e.printStackTrace

View File

@ -31,13 +31,13 @@ import Keys.{
} }
import Project.inScope import Project.inScope
import sbt.internal.inc.classpath.ClasspathUtilities import sbt.internal.inc.classpath.ClasspathUtilities
import sbt.internal.librarymanagement.{ InlineIvyConfiguration, IvyPaths } import sbt.librarymanagement.ivy.{ InlineIvyConfiguration, IvyDependencyResolution, IvyPaths }
import sbt.internal.inc.{ ZincUtil, ScalaInstance } import sbt.internal.inc.{ ZincUtil, ScalaInstance }
import sbt.internal.util.Attributed.data import sbt.internal.util.Attributed.data
import sbt.internal.util.Types.const import sbt.internal.util.Types.const
import sbt.internal.util.{ Attributed, Settings, ~> } import sbt.internal.util.{ Attributed, Settings, ~> }
import sbt.io.{ GlobFilter, IO, Path } import sbt.io.{ GlobFilter, IO, Path }
import sbt.librarymanagement.{ Configuration, Configurations, Resolver, UpdateOptions } import sbt.librarymanagement.{ Configuration, Configurations, Resolver }
import sbt.util.{ Show, Logger } import sbt.util.{ Show, Logger }
import scala.annotation.tailrec import scala.annotation.tailrec
import scala.tools.nsc.reporters.ConsoleReporter import scala.tools.nsc.reporters.ConsoleReporter
@ -79,18 +79,12 @@ private[sbt] object Load {
val stagingDirectory = getStagingDirectory(state, globalBase).getCanonicalFile val stagingDirectory = getStagingDirectory(state, globalBase).getCanonicalFile
val loader = getClass.getClassLoader val loader = getClass.getClassLoader
val classpath = Attributed.blankSeq(provider.mainClasspath ++ scalaProvider.jars) val classpath = Attributed.blankSeq(provider.mainClasspath ++ scalaProvider.jars)
val ivyConfiguration = new InlineIvyConfiguration( val ivyConfiguration =
paths = IvyPaths(baseDirectory, bootIvyHome(state.configuration)), InlineIvyConfiguration()
resolvers = Resolver.withDefaultResolvers(Nil).toVector, .withPaths(IvyPaths(baseDirectory, bootIvyHome(state.configuration)))
otherResolvers = Vector.empty, .withResolvers(Resolver.combineDefaultResolvers(Vector.empty))
moduleConfigurations = Vector.empty, .withLog(log)
lock = None, val dependencyResolution = IvyDependencyResolution(ivyConfiguration)
checksums = Vector.empty,
managedChecksums = false,
resolutionCacheDir = None,
updateOptions = UpdateOptions(),
log = log
)
val si = ScalaInstance(scalaProvider.version, scalaProvider.launcher) val si = ScalaInstance(scalaProvider.version, scalaProvider.launcher)
val zincDir = BuildPaths.getZincDirectory(state, globalBase) val zincDir = BuildPaths.getZincDirectory(state, globalBase)
val classpathOptions = ClasspathOptionsUtil.boot val classpathOptions = ClasspathOptionsUtil.boot
@ -100,7 +94,7 @@ private[sbt] object Load {
globalLock = launcher.globalLock, globalLock = launcher.globalLock,
componentProvider = app.provider.components, componentProvider = app.provider.components,
secondaryCacheDir = Option(zincDir), secondaryCacheDir = Option(zincDir),
ivyConfiguration = ivyConfiguration, dependencyResolution = dependencyResolution,
compilerBridgeSource = ZincUtil.getDefaultBridgeModule(scalaProvider.version), compilerBridgeSource = ZincUtil.getDefaultBridgeModule(scalaProvider.version),
scalaJarsTarget = zincDir, scalaJarsTarget = zincDir,
log = log log = log

View File

@ -27,7 +27,7 @@ final case class PluginManagement(overrides: Set[ModuleID],
addOverrides(extractOverrides(cp)) addOverrides(extractOverrides(cp))
def inject: Seq[Setting[_]] = Seq( def inject: Seq[Setting[_]] = Seq(
Keys.dependencyOverrides ++= overrides Keys.dependencyOverrides ++= overrides.toVector
) )
def resetDepth: PluginManagement = def resetDepth: PluginManagement =

View File

@ -7,5 +7,5 @@ import sbt.librarymanagement.RawRepository
object FakeRawRepository { object FakeRawRepository {
def create(name: String): RawRepository = def create(name: String): RawRepository =
new RawRepository(new FakeResolver(name, IO.createTemporaryDirectory, Map.empty)) new RawRepository(new FakeResolver(name, IO.createTemporaryDirectory, Map.empty), name)
} }

View File

@ -27,7 +27,8 @@ object Dependencies {
private val utilTracking = "org.scala-sbt" %% "util-tracking" % utilVersion private val utilTracking = "org.scala-sbt" %% "util-tracking" % utilVersion
private val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion private val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion
private val libraryManagement = "org.scala-sbt" %% "librarymanagement" % lmVersion private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion
private val libraryManagementIvy = "org.scala-sbt" %% "librarymanagement-ivy" % lmVersion
val launcherInterface = "org.scala-sbt" % "launcher-interface" % "1.0.0" val launcherInterface = "org.scala-sbt" % "launcher-interface" % "1.0.0"
val rawLauncher = "org.scala-sbt" % "launcher" % "1.0.0" val rawLauncher = "org.scala-sbt" % "launcher" % "1.0.0"
@ -77,7 +78,8 @@ object Dependencies {
def addSbtUtilScripted(p: Project): Project = def addSbtUtilScripted(p: Project): Project =
addSbtModule(p, sbtUtilPath, "utilScripted", utilScripted) addSbtModule(p, sbtUtilPath, "utilScripted", utilScripted)
def addSbtLm(p: Project): Project = addSbtModule(p, sbtLmPath, "lm", libraryManagement) def addSbtLmCore(p: Project): Project = addSbtModule(p, sbtLmPath, "lmCore", libraryManagementCore)
def addSbtLmIvy(p: Project): Project = addSbtModule(p, sbtLmPath, "lmIvy", libraryManagementIvy)
def addSbtCompilerInterface(p: Project): Project = def addSbtCompilerInterface(p: Project): Project =
addSbtModule(p, sbtZincPath, "compilerInterface", compilerInterface) addSbtModule(p, sbtZincPath, "compilerInterface", compilerInterface)

View File

@ -8,6 +8,8 @@ trait Import {
type URI = java.net.URI type URI = java.net.URI
type URL = java.net.URL type URL = java.net.URL
implicit def Seq2Vector[T](s: Seq[T]): Vector[T] = s.toVector
// sbt // sbt
val StdoutOutput = sbt.OutputStrategy.StdoutOutput val StdoutOutput = sbt.OutputStrategy.StdoutOutput
type BufferedOutput = sbt.OutputStrategy.BufferedOutput type BufferedOutput = sbt.OutputStrategy.BufferedOutput
@ -225,8 +227,8 @@ trait Import {
type Caller = sbt.librarymanagement.Caller type Caller = sbt.librarymanagement.Caller
val ChainedResolver = sbt.librarymanagement.ChainedResolver val ChainedResolver = sbt.librarymanagement.ChainedResolver
type ChainedResolver = sbt.librarymanagement.ChainedResolver type ChainedResolver = sbt.librarymanagement.ChainedResolver
val CircularDependencyLevel = sbt.librarymanagement.CircularDependencyLevel val CircularDependencyLevel = sbt.librarymanagement.ivy.CircularDependencyLevel
type CircularDependencyLevel = sbt.librarymanagement.CircularDependencyLevel type CircularDependencyLevel = sbt.librarymanagement.ivy.CircularDependencyLevel
val Configuration = sbt.librarymanagement.Configuration val Configuration = sbt.librarymanagement.Configuration
type Configuration = sbt.librarymanagement.Configuration type Configuration = sbt.librarymanagement.Configuration
val ConfigurationReport = sbt.librarymanagement.ConfigurationReport val ConfigurationReport = sbt.librarymanagement.ConfigurationReport
@ -236,33 +238,34 @@ trait Import {
type ConflictManager = sbt.librarymanagement.ConflictManager type ConflictManager = sbt.librarymanagement.ConflictManager
val ConflictWarning = sbt.librarymanagement.ConflictWarning val ConflictWarning = sbt.librarymanagement.ConflictWarning
type ConflictWarning = sbt.librarymanagement.ConflictWarning type ConflictWarning = sbt.librarymanagement.ConflictWarning
val Credentials = sbt.librarymanagement.Credentials val Credentials = sbt.librarymanagement.ivy.Credentials
type Credentials = sbt.librarymanagement.Credentials type Credentials = sbt.librarymanagement.ivy.Credentials
val CrossVersion = sbt.librarymanagement.CrossVersion val CrossVersion = sbt.librarymanagement.CrossVersion
type CrossVersion = sbt.librarymanagement.CrossVersion type CrossVersion = sbt.librarymanagement.CrossVersion
val DefaultMavenRepository = sbt.librarymanagement.DefaultMavenRepository val DefaultMavenRepository = sbt.librarymanagement.Resolver.DefaultMavenRepository
val Developer = sbt.librarymanagement.Developer val Developer = sbt.librarymanagement.Developer
type Developer = sbt.librarymanagement.Developer type Developer = sbt.librarymanagement.Developer
val Disabled = sbt.librarymanagement.Disabled val Disabled = sbt.librarymanagement.Disabled
type Disabled = sbt.librarymanagement.Disabled type Disabled = sbt.librarymanagement.Disabled
type DirectCredentials = sbt.librarymanagement.DirectCredentials type DirectCredentials = sbt.librarymanagement.ivy.DirectCredentials
val EvictionPair = sbt.librarymanagement.EvictionPair val EvictionPair = sbt.librarymanagement.EvictionPair
type EvictionPair = sbt.librarymanagement.EvictionPair type EvictionPair = sbt.librarymanagement.EvictionPair
val EvictionWarning = sbt.librarymanagement.EvictionWarning val EvictionWarning = sbt.librarymanagement.EvictionWarning
type EvictionWarning = sbt.librarymanagement.EvictionWarning type EvictionWarning = sbt.librarymanagement.EvictionWarning
val EvictionWarningOptions = sbt.librarymanagement.EvictionWarningOptions val EvictionWarningOptions = sbt.librarymanagement.EvictionWarningOptions
type EvictionWarningOptions = sbt.librarymanagement.EvictionWarningOptions type EvictionWarningOptions = sbt.librarymanagement.EvictionWarningOptions
val ExclusionRule = sbt.librarymanagement.ExclusionRule // val ExclusionRule = sbt.librarymanagement.InclExclRule
type ExclusionRule = sbt.librarymanagement.ExclusionRule // type ExclusionRule = sbt.librarymanagement.InclExclRule
type FileCredentials = sbt.librarymanagement.FileCredentials type FileCredentials = sbt.librarymanagement.ivy.FileCredentials
val FileRepository = sbt.librarymanagement.FileRepository val FileRepository = sbt.librarymanagement.FileRepository
type FileRepository = sbt.librarymanagement.FileRepository type FileRepository = sbt.librarymanagement.FileRepository
val Full = sbt.librarymanagement.Full val Full = sbt.librarymanagement.Full
type Full = sbt.librarymanagement.Full type Full = sbt.librarymanagement.Full
val IvyScala = sbt.librarymanagement.IvyScala val IvyScala = sbt.librarymanagement.ScalaModuleInfo
type IvyScala = sbt.librarymanagement.IvyScala type IvyScala = sbt.librarymanagement.ScalaModuleInfo
val JCenterRepository = sbt.librarymanagement.JCenterRepository val JCenterRepository = sbt.librarymanagement.Resolver.JCenterRepository
val JavaNet2Repository = sbt.librarymanagement.JavaNet2Repository val JavaNet2Repository = sbt.librarymanagement.Resolver.JavaNet2Repository
type MakePomConfiguration = sbt.librarymanagement.MakePomConfiguration
val MavenCache = sbt.librarymanagement.MavenCache val MavenCache = sbt.librarymanagement.MavenCache
type MavenCache = sbt.librarymanagement.MavenCache type MavenCache = sbt.librarymanagement.MavenCache
val MavenRepo = sbt.librarymanagement.MavenRepo val MavenRepo = sbt.librarymanagement.MavenRepo
@ -301,8 +304,8 @@ trait Import {
val URLRepository = sbt.librarymanagement.URLRepository val URLRepository = sbt.librarymanagement.URLRepository
type URLRepository = sbt.librarymanagement.URLRepository type URLRepository = sbt.librarymanagement.URLRepository
val UpdateLogging = sbt.librarymanagement.UpdateLogging val UpdateLogging = sbt.librarymanagement.UpdateLogging
val UpdateOptions = sbt.librarymanagement.UpdateOptions val UpdateOptions = sbt.librarymanagement.ivy.UpdateOptions
type UpdateOptions = sbt.librarymanagement.UpdateOptions type UpdateOptions = sbt.librarymanagement.ivy.UpdateOptions
val UpdateReport = sbt.librarymanagement.UpdateReport val UpdateReport = sbt.librarymanagement.UpdateReport
type UpdateReport = sbt.librarymanagement.UpdateReport type UpdateReport = sbt.librarymanagement.UpdateReport
val UpdateStats = sbt.librarymanagement.UpdateStats val UpdateStats = sbt.librarymanagement.UpdateStats
@ -312,8 +315,8 @@ trait Import {
type VersionNumberCompatibility = sbt.librarymanagement.VersionNumberCompatibility type VersionNumberCompatibility = sbt.librarymanagement.VersionNumberCompatibility
// sbt.internal.librarymanagement // sbt.internal.librarymanagement
type IvyPaths = sbt.internal.librarymanagement.IvyPaths type IvyPaths = sbt.librarymanagement.ivy.IvyPaths
val IvyPaths = sbt.internal.librarymanagement.IvyPaths val IvyPaths = sbt.librarymanagement.ivy.IvyPaths
type IncOptions = xsbti.compile.IncOptions type IncOptions = xsbti.compile.IncOptions
} }

View File

@ -1,3 +1,5 @@
import scala.language.experimental.macros
/* sbt -- Simple Build Tool /* sbt -- Simple Build Tool
* Copyright 2010, 2011 Mark Harrah * Copyright 2010, 2011 Mark Harrah
*/ */
@ -5,8 +7,8 @@ package object sbt
extends sbt.IOSyntax0 extends sbt.IOSyntax0
with sbt.std.TaskExtra with sbt.std.TaskExtra
with sbt.internal.util.Types with sbt.internal.util.Types
with sbt.internal.librarymanagement.impl.DependencyBuilders
with sbt.ProjectExtra with sbt.ProjectExtra
with sbt.librarymanagement.DependencyBuilders
with sbt.librarymanagement.DependencyFilterExtra with sbt.librarymanagement.DependencyFilterExtra
with sbt.librarymanagement.LibraryManagementSyntax with sbt.librarymanagement.LibraryManagementSyntax
with sbt.BuildExtra with sbt.BuildExtra
@ -36,15 +38,16 @@ package object sbt
final val Global = Scope.Global final val Global = Scope.Global
final val GlobalScope = Scope.GlobalScope final val GlobalScope = Scope.GlobalScope
import sbt.{ Configurations => C } // import sbt.{ Configurations => C }
final val Compile = C.Compile // final val Compile = C.Compile
final val Test = C.Test // final val Test = C.Test
final val Runtime = C.Runtime // final val Runtime = C.Runtime
final val IntegrationTest = C.IntegrationTest // final val IntegrationTest = C.IntegrationTest
final val Default = C.Default // final val Default = C.Default
final val Provided = C.Provided // final val Provided = C.Provided
// java.lang.System is more important, so don't alias this one // java.lang.System is more important, so don't alias this one
// final val System = C.System // final val System = C.System
final val Optional = C.Optional // final val Optional = C.Optional
def config(s: String): Configuration = C.config(s) def config(name: String): Configuration =
macro sbt.librarymanagement.ConfigurationMacro.configMacroImpl
} }

View File

@ -6,7 +6,7 @@ val b = project
localCache, localCache,
scalaVersion := "2.11.8", scalaVersion := "2.11.8",
libraryDependencies += "org.example" %% "artifacta" % "1.0.0-SNAPSHOT" withSources() classifier("tests"), libraryDependencies += "org.example" %% "artifacta" % "1.0.0-SNAPSHOT" withSources() classifier("tests"),
externalResolvers := Seq( externalResolvers := Vector(
MavenCache("demo", ((baseDirectory in ThisBuild).value / "demo-repo")), MavenCache("demo", ((baseDirectory in ThisBuild).value / "demo-repo")),
DefaultMavenRepository DefaultMavenRepository
) )

View File

@ -18,8 +18,9 @@ lazy val root = (project in file("."))
val module = ivyModule.value val module = ivyModule.value
val config = updateConfiguration.value val config = updateConfiguration.value
import sbt.internal.librarymanagement.IvyConfiguration import sbt.librarymanagement.ivy.IvyConfiguration
import sbt.librarymanagement.{ ModuleSettings, UpdateConfiguration } import sbt.librarymanagement.{ ModuleSettings, UpdateConfiguration }
import sbt.internal.util.HListFormats._
type In = IvyConfiguration :+: ModuleSettings :+: UpdateConfiguration :+: HNil type In = IvyConfiguration :+: ModuleSettings :+: UpdateConfiguration :+: HNil

View File

@ -1,4 +1,4 @@
configurationsToRetrieve := Some(Set(Compile)) configurationsToRetrieve := Some(Vector(Compile))
retrieveManaged := true retrieveManaged := true
@ -8,4 +8,4 @@ autoScalaLibrary := false
managedDirectory := file("dependencies") managedDirectory := file("dependencies")
retrievePattern := "[conf]/[artifact]-[revision](-[classifier]).[ext]" retrievePattern := "[conf]/[artifact]-[revision](-[classifier]).[ext]"

View File

@ -1,6 +1,7 @@
import scala.xml.{ Node, _ } import scala.xml.{ Node, _ }
import scala.xml.Utility.trim import scala.xml.Utility.trim
import sbt.internal.librarymanagement.{ IvySbt, MakePomConfiguration, MakePom } import sbt.librarymanagement.MakePomConfiguration
import sbt.internal.librarymanagement.{ IvySbt, MakePom }
lazy val check = taskKey[Unit]("check") lazy val check = taskKey[Unit]("check")

View File

@ -6,7 +6,7 @@ lazy val root = (project in file(".")).
settings( settings(
libraryDependencies ++= baseDirectory(dependencies).value, libraryDependencies ++= baseDirectory(dependencies).value,
scalaVersion := "2.9.2", scalaVersion := "2.9.2",
ivyScala := ivyScala.value map (_.withOverrideScalaVersion(sbtPlugin.value)), scalaModuleInfo := scalaModuleInfo.value map (_.withOverrideScalaVersion(sbtPlugin.value)),
autoScalaLibrary := baseDirectory(base => !(base / "noscala").exists ).value, autoScalaLibrary := baseDirectory(base => !(base / "noscala").exists ).value,
scalaOverride := check("scala.App").value scalaOverride := check("scala.App").value
) )

View File

@ -1,7 +1,7 @@
lazy val check = taskKey[Unit]("tests update") lazy val check = taskKey[Unit]("tests update")
def commonSettings: Seq[Def.Setting[_]] = Seq( def commonSettings: Seq[Def.Setting[_]] = Seq(
resolvers ++= Resolver.typesafeIvyRepo("releases") :: Resolver.typesafeRepo("releases") :: Resolver.sbtPluginRepo("releases") :: Nil, resolvers ++= Vector(Resolver.typesafeIvyRepo("releases"), Resolver.typesafeRepo("releases"), Resolver.sbtPluginRepo("releases")),
check := { check := {
val ur = update.value val ur = update.value
import sbinary._, Operations._, DefaultProtocol._ import sbinary._, Operations._, DefaultProtocol._

View File

@ -1,6 +1,6 @@
lazy val commonSettings = Seq( lazy val commonSettings = Seq(
autoScalaLibrary := false, autoScalaLibrary := false,
ivyScala := None, scalaModuleInfo := None,
unmanagedJars in Compile ++= (scalaInstance map (_.allJars.toSeq)).value, unmanagedJars in Compile ++= (scalaInstance map (_.allJars.toSeq)).value,
publishArtifact in packageSrc := false, publishArtifact in packageSrc := false,
publishArtifact in packageDoc := false, publishArtifact in packageDoc := false,

View File

@ -6,7 +6,10 @@ lazy val root = (project in file(".")) settings (
TaskKey[Unit]("checkExtra") := checkExtra.value, TaskKey[Unit]("checkExtra") := checkExtra.value,
TaskKey[Unit]("checkVersionPlusMapping") := checkVersionPlusMapping.value, TaskKey[Unit]("checkVersionPlusMapping") := checkVersionPlusMapping.value,
resolvers += Resolver.sonatypeRepo("snapshots"), resolvers += Resolver.sonatypeRepo("snapshots"),
makePomConfiguration ~= { _.copy(extra = <extra-tag/>) }, makePomConfiguration := {
val p = makePomConfiguration.value
new MakePomConfiguration(p.file, p.moduleInfo, p.configurations, <extra-tag/>, p.process, p.filterRepositories, p.allRepositories, p.includeTypes)
},
libraryDependencies += "com.google.code.findbugs" % "jsr305" % "1.3.+" libraryDependencies += "com.google.code.findbugs" % "jsr305" % "1.3.+"
) )

View File

@ -2,12 +2,12 @@ autoScalaLibrary := false
ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")) ivyPaths := IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache"))
ivyScala := Some(IvyScala( scalaModuleInfo := Some(sbt.librarymanagement.ScalaModuleInfo(
(scalaVersion in update).value, (scalaVersion in update).value,
(scalaBinaryVersion in update).value, (scalaBinaryVersion in update).value,
Vector.empty, Vector.empty,
filterImplicit = false,
checkExplicit = false, checkExplicit = false,
filterImplicit = false,
overrideScalaVersion = false overrideScalaVersion = false
)) ))

View File

@ -1,19 +1,19 @@
> 'set libraryDependencies := Seq("junit" % "junit" % "3.8.1" % "test")' > 'set libraryDependencies := Seq("junit" % "junit" % "3.8.1" % "test")'
> check 3.8.1 > check 3.8.1
> 'set dependencyOverrides := Set("junit" % "junit" % "4.5")' > 'set dependencyOverrides := Vector("junit" % "junit" % "4.5")'
> check 4.5 > check 4.5
> 'set libraryDependencies := Seq("junit" % "junit" % "4.5" % "test")' > 'set libraryDependencies := Seq("junit" % "junit" % "4.5" % "test")'
> check 4.5 > check 4.5
> 'set dependencyOverrides := Set("junit" % "junit" % "3.8.1")' > 'set dependencyOverrides := Vector("junit" % "junit" % "3.8.1")'
> check 3.8.1 > check 3.8.1
> 'set libraryDependencies := Seq("net.databinder" %% "dispatch-http" % "0.8.7")' > 'set libraryDependencies := Seq("net.databinder" %% "dispatch-http" % "0.8.7")'
> check 0.8.7 > check 0.8.7
> 'set dependencyOverrides := Set("net.databinder" %% "dispatch-http" % "0.8.6")' > 'set dependencyOverrides := Vector("net.databinder" %% "dispatch-http" % "0.8.6")'
> check 0.8.6 > check 0.8.6
> 'set libraryDependencies := Seq("net.databinder" %% "dispatch-http" % "0.8.6")' > 'set libraryDependencies := Seq("net.databinder" %% "dispatch-http" % "0.8.6")'
> check 0.8.6 > check 0.8.6
> 'set dependencyOverrides := Set("net.databinder" %% "dispatch-http" % "0.8.7")' > 'set dependencyOverrides := Vector("net.databinder" %% "dispatch-http" % "0.8.7")'
> check 0.8.7 > check 0.8.7

View File

@ -6,6 +6,6 @@ scalaBinaryVersion := "2.9.1"
resolvers += Classpaths.typesafeReleases resolvers += Classpaths.typesafeReleases
dependencyOverrides := Set("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.1") dependencyOverrides := Vector("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.1")
autoScalaLibrary := false autoScalaLibrary := false

View File

@ -1,4 +1,4 @@
lazy val custom = config("custom") lazy val custom = config("custom") //Configurations.config("custom")
lazy val root = (project in file(".")). lazy val root = (project in file(".")).
configs(custom). configs(custom).

View File

@ -1,5 +1,5 @@
def configIvyScala = def configIvyScala =
ivyScala ~= (_ map (_ withCheckExplicit false)) scalaModuleInfo ~= (_ map (_ withCheckExplicit false))
val declared = SettingKey[Boolean]("declared") val declared = SettingKey[Boolean]("declared")
lazy val a = project. lazy val a = project.

View File

@ -15,8 +15,8 @@ object ScriptedPlugin extends AutoPlugin {
override def requires = plugins.JvmPlugin override def requires = plugins.JvmPlugin
override def trigger = allRequirements override def trigger = allRequirements
object autoImport { object autoImport {
def scriptedConf = config("scripted-sbt") hide val ScriptedConf = Configurations.config("scripted-sbt") hide
def scriptedLaunchConf = config("scripted-sbt-launch") hide val ScriptedLaunchConf = Configurations.config("scripted-sbt-launch") hide
val scriptedSbt = SettingKey[String]("scripted-sbt") val scriptedSbt = SettingKey[String]("scripted-sbt")
val sbtLauncher = TaskKey[File]("sbt-launcher") val sbtLauncher = TaskKey[File]("sbt-launcher")
val sbtTestDirectory = SettingKey[File]("sbt-test-directory") val sbtTestDirectory = SettingKey[File]("sbt-test-directory")
@ -32,26 +32,26 @@ object ScriptedPlugin extends AutoPlugin {
} }
import autoImport._ import autoImport._
override lazy val projectSettings = Seq( override lazy val projectSettings = Seq(
ivyConfigurations ++= Seq(scriptedConf, scriptedLaunchConf), ivyConfigurations ++= Seq(ScriptedConf, ScriptedLaunchConf),
scriptedSbt := (sbtVersion in pluginCrossBuild).value, scriptedSbt := (sbtVersion in pluginCrossBuild).value,
sbtLauncher := getJars(scriptedLaunchConf).map(_.get.head).value, sbtLauncher := getJars(ScriptedLaunchConf).map(_.get.head).value,
sbtTestDirectory := sourceDirectory.value / "sbt-test", sbtTestDirectory := sourceDirectory.value / "sbt-test",
libraryDependencies ++= { libraryDependencies ++= {
binarySbtVersion(scriptedSbt.value) match { binarySbtVersion(scriptedSbt.value) match {
case "0.13" => case "0.13" =>
Seq( Seq(
"org.scala-sbt" % "scripted-sbt" % scriptedSbt.value % scriptedConf.toString, "org.scala-sbt" % "scripted-sbt" % scriptedSbt.value % ScriptedConf.toString,
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % scriptedLaunchConf.toString "org.scala-sbt" % "sbt-launch" % scriptedSbt.value % ScriptedLaunchConf.toString
) )
case sv if sv startsWith "1.0." => case sv if sv startsWith "1.0." =>
Seq( Seq(
"org.scala-sbt" %% "scripted-sbt" % scriptedSbt.value % scriptedConf.toString, "org.scala-sbt" %% "scripted-sbt" % scriptedSbt.value % ScriptedConf.toString,
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % scriptedLaunchConf.toString "org.scala-sbt" % "sbt-launch" % scriptedSbt.value % ScriptedLaunchConf.toString
) )
} }
}, },
scriptedBufferLog := true, scriptedBufferLog := true,
scriptedClasspath := getJars(scriptedConf).value, scriptedClasspath := getJars(ScriptedConf).value,
scriptedTests := scriptedTestsTask.value, scriptedTests := scriptedTestsTask.value,
scriptedRun := scriptedRunTask.value, scriptedRun := scriptedRunTask.value,
scriptedDependencies := { scriptedDependencies := {