mirror of https://github.com/sbt/sbt.git
Better handling of properties in dependency management / profiles
Test fix in the next commit prevents regressions
This commit is contained in:
parent
5146be5c39
commit
3a6cdb20fb
|
|
@ -851,17 +851,27 @@ final case class Resolution(
|
||||||
// 1.2 made from Pom.scala (TODO look at the very details?)
|
// 1.2 made from Pom.scala (TODO look at the very details?)
|
||||||
|
|
||||||
// 1.3 & 1.4 (if only vaguely so)
|
// 1.3 & 1.4 (if only vaguely so)
|
||||||
val dependencies0 = addDependencies(
|
|
||||||
(project.dependencies +: profiles0.map(_.dependencies)).map(withProperties(_, approxProperties))
|
|
||||||
)
|
|
||||||
val dependenciesMgmt0 = addDependencies(
|
|
||||||
(project.dependencyManagement +: profiles0.map(_.dependencyManagement)).map(withProperties(_, approxProperties))
|
|
||||||
)
|
|
||||||
val properties0 =
|
val properties0 =
|
||||||
(project.properties /: profiles0) { (acc, p) =>
|
(project.properties /: profiles0) { (acc, p) =>
|
||||||
acc ++ p.properties
|
acc ++ p.properties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val project0 = project.copy(
|
||||||
|
properties = project.parent // belongs to 1.5 & 1.6
|
||||||
|
.filter(projectCache.contains)
|
||||||
|
.map(projectCache(_)._2.properties)
|
||||||
|
.fold(properties0)(_ ++ properties0)
|
||||||
|
)
|
||||||
|
|
||||||
|
val propertiesMap0 = propertiesMap(projectProperties(project0))
|
||||||
|
|
||||||
|
val dependencies0 = addDependencies(
|
||||||
|
(project0.dependencies +: profiles0.map(_.dependencies)).map(withProperties(_, propertiesMap0))
|
||||||
|
)
|
||||||
|
val dependenciesMgmt0 = addDependencies(
|
||||||
|
(project0.dependencyManagement +: profiles0.map(_.dependencyManagement)).map(withProperties(_, propertiesMap0))
|
||||||
|
)
|
||||||
|
|
||||||
val deps0 =
|
val deps0 =
|
||||||
dependencies0
|
dependencies0
|
||||||
.collect { case ("import", dep) =>
|
.collect { case ("import", dep) =>
|
||||||
|
|
@ -871,7 +881,7 @@ final case class Resolution(
|
||||||
.collect { case ("import", dep) =>
|
.collect { case ("import", dep) =>
|
||||||
dep.moduleVersion
|
dep.moduleVersion
|
||||||
} ++
|
} ++
|
||||||
project.parent // belongs to 1.5 & 1.6
|
project0.parent // belongs to 1.5 & 1.6
|
||||||
|
|
||||||
val deps = deps0.filter(projectCache.contains)
|
val deps = deps0.filter(projectCache.contains)
|
||||||
|
|
||||||
|
|
@ -879,35 +889,31 @@ final case class Resolution(
|
||||||
.map(projectCache(_)._2)
|
.map(projectCache(_)._2)
|
||||||
|
|
||||||
val depMgmt = (
|
val depMgmt = (
|
||||||
project.dependencyManagement +: (
|
project0.dependencyManagement +: (
|
||||||
profiles0.map(_.dependencyManagement) ++
|
profiles0.map(_.dependencyManagement) ++
|
||||||
projs.map(_.dependencyManagement)
|
projs.map(_.dependencyManagement)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.map(withProperties(_, approxProperties))
|
.map(withProperties(_, propertiesMap0))
|
||||||
.foldLeft(Map.empty[DepMgmt.Key, (String, Dependency)])(DepMgmt.addSeq)
|
.foldLeft(Map.empty[DepMgmt.Key, (String, Dependency)])(DepMgmt.addSeq)
|
||||||
|
|
||||||
val depsSet = deps.toSet
|
val depsSet = deps.toSet
|
||||||
|
|
||||||
project.copy(
|
project0.copy(
|
||||||
version = substituteProps(project.version, approxProperties),
|
version = substituteProps(project0.version, propertiesMap0),
|
||||||
dependencies =
|
dependencies =
|
||||||
dependencies0
|
dependencies0
|
||||||
.filterNot{case (config, dep) =>
|
.filterNot{case (config, dep) =>
|
||||||
config == "import" && depsSet(dep.moduleVersion)
|
config == "import" && depsSet(dep.moduleVersion)
|
||||||
} ++
|
} ++
|
||||||
project.parent // belongs to 1.5 & 1.6
|
project0.parent // belongs to 1.5 & 1.6
|
||||||
.filter(projectCache.contains)
|
.filter(projectCache.contains)
|
||||||
.toSeq
|
.toSeq
|
||||||
.flatMap(projectCache(_)._2.dependencies),
|
.flatMap(projectCache(_)._2.dependencies),
|
||||||
dependencyManagement = depMgmt.values.toSeq
|
dependencyManagement = depMgmt.values.toSeq
|
||||||
.filterNot{case (config, dep) =>
|
.filterNot{case (config, dep) =>
|
||||||
config == "import" && depsSet(dep.moduleVersion)
|
config == "import" && depsSet(dep.moduleVersion)
|
||||||
},
|
}
|
||||||
properties = project.parent // belongs to 1.5 & 1.6
|
|
||||||
.filter(projectCache.contains)
|
|
||||||
.map(projectCache(_)._2.properties)
|
|
||||||
.fold(properties0)(properties0 ++ _)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue