mirror of https://github.com/sbt/sbt.git
Better properties substitution
This commit is contained in:
parent
fd495cc9f8
commit
8d27ab7150
|
|
@ -350,21 +350,22 @@ object Resolver {
|
|||
// Here, we're substituting properties also in dependencies that come from parents
|
||||
// or dependency management. This may not be the right thing to do.
|
||||
|
||||
val properties = mergeProperties(
|
||||
project.properties,
|
||||
Map(
|
||||
"project.groupId" -> project.module.organization,
|
||||
"project.artifactId" -> project.module.name,
|
||||
"project.version" -> project.module.version
|
||||
)
|
||||
)
|
||||
|
||||
val deps =
|
||||
withExclusions(
|
||||
withProperties(
|
||||
depsWithDependencyManagement(
|
||||
project.dependencies,
|
||||
project.dependencyManagement
|
||||
),
|
||||
mergeProperties(
|
||||
project.properties,
|
||||
Map(
|
||||
"project.groupId" -> project.module.organization,
|
||||
"project.artifactId" -> project.module.name,
|
||||
"project.version" -> project.module.version
|
||||
)
|
||||
)
|
||||
depsWithDependencyManagement(
|
||||
// important: properties have to be applied to both, so that dep mgmt can be matched properly
|
||||
// See the added test with org.ow2.asm:asm-commons:5.0.2
|
||||
withProperties(project.dependencies, properties),
|
||||
withProperties(project.dependencyManagement, properties)
|
||||
),
|
||||
from.exclusions
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ object CentralTests extends TestSuite {
|
|||
.runF)
|
||||
|
||||
val res = res0.copy(
|
||||
projectsCache = Map.empty, errors = Map.empty, // No validating these here
|
||||
dependencies = res0.dependencies.filter(dep => dep.scope == Scope.Compile && !dep.optional)
|
||||
projectsCache = Map.empty, errors = Map.empty // No validating these here
|
||||
)
|
||||
|
||||
val expected = Resolution(
|
||||
|
|
@ -34,6 +33,29 @@ object CentralTests extends TestSuite {
|
|||
)
|
||||
)
|
||||
|
||||
assert(res == expected)
|
||||
}
|
||||
}
|
||||
'asm{
|
||||
async {
|
||||
val dep = Dependency(Module("org.ow2.asm", "asm-commons", "5.0.2"))
|
||||
val res0 =
|
||||
await(resolve(Set(dep), fetchFrom(repositories))
|
||||
.runF)
|
||||
|
||||
val res = res0.copy(
|
||||
projectsCache = Map.empty, errors = Map.empty // No validating these here
|
||||
)
|
||||
|
||||
val expected = Resolution(
|
||||
rootDependencies = Set(dep.withCompileScope),
|
||||
dependencies = Set(
|
||||
dep.withCompileScope,
|
||||
Dependency(Module("org.ow2.asm", "asm-tree", "5.0.2")).withCompileScope,
|
||||
Dependency(Module("org.ow2.asm", "asm", "5.0.2")).withCompileScope
|
||||
)
|
||||
)
|
||||
|
||||
assert(res == expected)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue