mirror of https://github.com/sbt/sbt.git
fixes issue with inter-project resolution when project delegates are defined
This commit is contained in:
parent
b8ba743e87
commit
a028f8e6d7
|
|
@ -41,6 +41,7 @@ sealed trait Resolver
|
||||||
final class RawRepository(val resolver: DependencyResolver) extends Resolver
|
final class RawRepository(val resolver: DependencyResolver) extends Resolver
|
||||||
{
|
{
|
||||||
def name = resolver.getName
|
def name = resolver.getName
|
||||||
|
override def toString = "Raw(" + resolver.toString + ")"
|
||||||
}
|
}
|
||||||
sealed case class MavenRepository(name: String, root: String) extends Resolver
|
sealed case class MavenRepository(name: String, root: String) extends Resolver
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class ProjectResolver(name: String, map: Map[ModuleRevisionId, ModuleDescriptor]
|
||||||
{
|
{
|
||||||
def getName = name
|
def getName = name
|
||||||
def setName(name: String) = error("Setting name not supported by ProjectResolver")
|
def setName(name: String) = error("Setting name not supported by ProjectResolver")
|
||||||
|
override def toString = "ProjectResolver(" + name + ", mapped: " + map.keys.mkString(", ") + ")"
|
||||||
|
|
||||||
def getDependency(dd: DependencyDescriptor, data: ResolveData): ResolvedModuleRevision =
|
def getDependency(dd: DependencyDescriptor, data: ResolveData): ResolvedModuleRevision =
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -571,7 +571,10 @@ object Classpaths
|
||||||
normalizedName <<= name(StringUtilities.normalize),
|
normalizedName <<= name(StringUtilities.normalize),
|
||||||
organization <<= organization or normalizedName.identity,
|
organization <<= organization or normalizedName.identity,
|
||||||
classpathFilter in GlobalScope :== "*.jar",
|
classpathFilter in GlobalScope :== "*.jar",
|
||||||
externalResolvers <<= externalResolvers or (resolvers map Resolver.withDefaultResolvers),
|
externalResolvers <<= (externalResolvers.task.? zipWith resolvers.identity) {
|
||||||
|
case (Some(delegated), Seq()) => delegated
|
||||||
|
case (_, rs) => task { Resolver.withDefaultResolvers(rs) }
|
||||||
|
},
|
||||||
fullResolvers <<= (projectResolver,externalResolvers,sbtPlugin,sbtResolver) map { (pr,rs,isPlugin,sr) =>
|
fullResolvers <<= (projectResolver,externalResolvers,sbtPlugin,sbtResolver) map { (pr,rs,isPlugin,sr) =>
|
||||||
val base = pr +: rs
|
val base = pr +: rs
|
||||||
if(isPlugin) sr +: base else base
|
if(isPlugin) sr +: base else base
|
||||||
|
|
@ -607,7 +610,7 @@ object Classpaths
|
||||||
retrievePattern in GlobalScope :== "[type]s/[organisation]/[module]/[artifact](-[revision])(-[classifier]).[ext]",
|
retrievePattern in GlobalScope :== "[type]s/[organisation]/[module]/[artifact](-[revision])(-[classifier]).[ext]",
|
||||||
updateConfiguration <<= (retrieveConfiguration, ivyLoggingLevel)((conf,level) => new UpdateConfiguration(conf, false, level) ),
|
updateConfiguration <<= (retrieveConfiguration, ivyLoggingLevel)((conf,level) => new UpdateConfiguration(conf, false, level) ),
|
||||||
retrieveConfiguration <<= (managedDirectory, retrievePattern, retrieveManaged) { (libm, pattern, enabled) => if(enabled) Some(new RetrieveConfiguration(libm, pattern)) else None },
|
retrieveConfiguration <<= (managedDirectory, retrievePattern, retrieveManaged) { (libm, pattern, enabled) => if(enabled) Some(new RetrieveConfiguration(libm, pattern)) else None },
|
||||||
ivyConfiguration <<= ivyConfiguration or mkIvyConfiguration,
|
ivyConfiguration <<= mkIvyConfiguration,
|
||||||
ivyConfigurations <<= (autoCompilerPlugins, internalConfigurationMap, thisProject) { (auto, internalMap, project) =>
|
ivyConfigurations <<= (autoCompilerPlugins, internalConfigurationMap, thisProject) { (auto, internalMap, project) =>
|
||||||
(project.configurations ++ project.configurations.map(internalMap) ++ (if(auto) CompilerPlugin :: Nil else Nil)).distinct
|
(project.configurations ++ project.configurations.map(internalMap) ++ (if(auto) CompilerPlugin :: Nil else Nil)).distinct
|
||||||
},
|
},
|
||||||
|
|
@ -629,8 +632,8 @@ object Classpaths
|
||||||
new IvySbt(conf)
|
new IvySbt(conf)
|
||||||
},
|
},
|
||||||
ivyModule <<= (ivySbt, moduleSettings) map { (ivySbt, settings) => new ivySbt.Module(settings) },
|
ivyModule <<= (ivySbt, moduleSettings) map { (ivySbt, settings) => new ivySbt.Module(settings) },
|
||||||
update <<= (ivyModule, updateConfiguration, cacheDirectory, scalaInstance, streams) map { (module, config, cacheDirectory, si, s) =>
|
update <<= (ivyModule, thisProjectRef, updateConfiguration, cacheDirectory, scalaInstance, streams) map { (module, ref, config, cacheDirectory, si, s) =>
|
||||||
cachedUpdate(cacheDirectory / "update", module, config, Some(si), s.log)
|
cachedUpdate(cacheDirectory / "update", Project.display(ref), module, config, Some(si), s.log)
|
||||||
},
|
},
|
||||||
transitiveClassifiers in GlobalScope :== Seq(SourceClassifier, DocClassifier),
|
transitiveClassifiers in GlobalScope :== Seq(SourceClassifier, DocClassifier),
|
||||||
updateClassifiers <<= (ivySbt, projectID, update, transitiveClassifiers, updateConfiguration, ivyScala, streams) map { (is, pid, up, classifiers, c, ivyScala, s) =>
|
updateClassifiers <<= (ivySbt, projectID, update, transitiveClassifiers, updateConfiguration, ivyScala, streams) map { (is, pid, up, classifiers, c, ivyScala, s) =>
|
||||||
|
|
@ -661,13 +664,13 @@ object Classpaths
|
||||||
import Cache._
|
import Cache._
|
||||||
import CacheIvy.{classpathFormat, /*publishIC,*/ updateIC, updateReportF}
|
import CacheIvy.{classpathFormat, /*publishIC,*/ updateIC, updateReportF}
|
||||||
|
|
||||||
def cachedUpdate(cacheFile: File, module: IvySbt#Module, config: UpdateConfiguration, scalaInstance: Option[ScalaInstance], log: Logger): UpdateReport =
|
def cachedUpdate(cacheFile: File, label: String, module: IvySbt#Module, config: UpdateConfiguration, scalaInstance: Option[ScalaInstance], log: Logger): UpdateReport =
|
||||||
{
|
{
|
||||||
implicit val updateCache = updateIC
|
implicit val updateCache = updateIC
|
||||||
implicit val updateReport = updateReportF
|
implicit val updateReport = updateReportF
|
||||||
type In = IvyConfiguration :+: ModuleSettings :+: UpdateConfiguration :+: HNil
|
type In = IvyConfiguration :+: ModuleSettings :+: UpdateConfiguration :+: HNil
|
||||||
def work = (_: In) match { case conf :+: settings :+: config :+: HNil =>
|
def work = (_: In) match { case conf :+: settings :+: config :+: HNil =>
|
||||||
log.info("Updating...")
|
log.info("Updating " + label + "...")
|
||||||
val r = IvyActions.update(module, config, log)
|
val r = IvyActions.update(module, config, log)
|
||||||
log.info("Done updating.")
|
log.info("Done updating.")
|
||||||
scalaInstance match { case Some(si) => substituteScalaFiles(si, r); case None => r }
|
scalaInstance match { case Some(si) => substituteScalaFiles(si, r); case None => r }
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import sbt._
|
||||||
|
import Keys._
|
||||||
|
|
||||||
|
object B extends Build
|
||||||
|
{
|
||||||
|
lazy val root: Project = Project("root", file(".")) aggregate(logic, ui)
|
||||||
|
lazy val logic: Project = Project("logic", file("logic"), delegates = root :: Nil)
|
||||||
|
lazy val ui: Project = Project("ui", file("ui"), delegates = root :: Nil) dependsOn(logic)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
> compile
|
||||||
Loading…
Reference in New Issue