Add support for property absence directives in profile activation

This commit is contained in:
Erem Boto 2016-10-15 18:21:12 -07:00
parent b8207607c9
commit b1f9cb96d4
2 changed files with 17 additions and 7 deletions

View File

@ -258,7 +258,7 @@ object Resolution {
if (mgmtDep.optional)
dep = dep.copy(optional = mgmtDep.optional)
}
(config, dep)
}
}
@ -448,12 +448,16 @@ object Resolution {
activation.properties.nonEmpty &&
activation.properties.forall {
case (name, valueOpt) =>
props.get(name).exists { v =>
valueOpt.forall { reqValue =>
if (reqValue.startsWith("!"))
v != reqValue.drop(1)
else
v == reqValue
if (name.startsWith("!")) {
props.get(name.drop(1)).isEmpty
} else {
props.get(name).exists { v =>
valueOpt.forall { reqValue =>
if (reqValue.startsWith("!"))
v != reqValue.drop(1)
else
v == reqValue
}
}
}
}

View File

@ -155,6 +155,12 @@ object ResolutionTests extends TestSuite {
// the property "special" is unset. Because that is the case here,
// the "default" build profile should be active and "librairie-standard"
// should be provided as a transitive dependency when resolved.
//
// We additionally include the property "!special" -> "true" to
// disambiguate the absence of the "special" property versus
// the presence of the "!special" property (which is probably not valid pom
// anyways)
properties = Seq("!special" -> "true"),
profiles = Seq(
Profile("default", activation = Profile.Activation(properties = Seq("!special" -> None)), dependencies = Seq(
"" -> Dependency(Module("org.escalier", "librairie-standard"), "2.11.6"))))),