use of com.google.devtools.build.lib.analysis.constraints.SupportedEnvironments in project bazel by bazelbuild.
the class RuleConfiguredTargetBuilder method checkConstraints.
/**
* Invokes Blaze's constraint enforcement system: checks that this rule's dependencies
* support its environments and reports appropriate errors if violations are found. Also
* publishes this rule's supported environments for the rules that depend on it.
*/
private void checkConstraints() {
if (!ruleContext.getRule().getRuleClassObject().supportsConstraintChecking()) {
return;
}
EnvironmentCollection supportedEnvironments = ConstraintSemantics.getSupportedEnvironments(ruleContext);
if (supportedEnvironments != null) {
EnvironmentCollection.Builder refinedEnvironments = new EnvironmentCollection.Builder();
Map<Label, Target> removedEnvironmentCulprits = new LinkedHashMap<>();
ConstraintSemantics.checkConstraints(ruleContext, supportedEnvironments, refinedEnvironments, removedEnvironmentCulprits);
add(SupportedEnvironmentsProvider.class, new SupportedEnvironments(supportedEnvironments, refinedEnvironments.build(), removedEnvironmentCulprits));
}
}
Aggregations