mirror of https://github.com/sbt/sbt.git
Add support for property absence directives in profile activation
This commit is contained in:
parent
b8207607c9
commit
b1f9cb96d4
|
|
@ -258,7 +258,7 @@ object Resolution {
|
||||||
if (mgmtDep.optional)
|
if (mgmtDep.optional)
|
||||||
dep = dep.copy(optional = mgmtDep.optional)
|
dep = dep.copy(optional = mgmtDep.optional)
|
||||||
}
|
}
|
||||||
|
|
||||||
(config, dep)
|
(config, dep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -448,12 +448,16 @@ object Resolution {
|
||||||
activation.properties.nonEmpty &&
|
activation.properties.nonEmpty &&
|
||||||
activation.properties.forall {
|
activation.properties.forall {
|
||||||
case (name, valueOpt) =>
|
case (name, valueOpt) =>
|
||||||
props.get(name).exists { v =>
|
if (name.startsWith("!")) {
|
||||||
valueOpt.forall { reqValue =>
|
props.get(name.drop(1)).isEmpty
|
||||||
if (reqValue.startsWith("!"))
|
} else {
|
||||||
v != reqValue.drop(1)
|
props.get(name).exists { v =>
|
||||||
else
|
valueOpt.forall { reqValue =>
|
||||||
v == reqValue
|
if (reqValue.startsWith("!"))
|
||||||
|
v != reqValue.drop(1)
|
||||||
|
else
|
||||||
|
v == reqValue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,12 @@ object ResolutionTests extends TestSuite {
|
||||||
// the property "special" is unset. Because that is the case here,
|
// the property "special" is unset. Because that is the case here,
|
||||||
// the "default" build profile should be active and "librairie-standard"
|
// the "default" build profile should be active and "librairie-standard"
|
||||||
// should be provided as a transitive dependency when resolved.
|
// 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(
|
profiles = Seq(
|
||||||
Profile("default", activation = Profile.Activation(properties = Seq("!special" -> None)), dependencies = Seq(
|
Profile("default", activation = Profile.Activation(properties = Seq("!special" -> None)), dependencies = Seq(
|
||||||
"" -> Dependency(Module("org.escalier", "librairie-standard"), "2.11.6"))))),
|
"" -> Dependency(Module("org.escalier", "librairie-standard"), "2.11.6"))))),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue