Search in sources :

Example 1 with ModelRuleBindingException

use of org.gradle.model.ModelRuleBindingException in project gradle by gradle.

the class ModelBinding method onBind.

public final void onBind(ModelNodeInternal node) {
    if (boundTo != null) {
        ModelRuleDescriptor creatorDescriptor = node.getDescriptor();
        ModelPath path = node.getPath();
        throw new InvalidModelRuleException(referrer, new ModelRuleBindingException(new AmbiguousBindingReporter(predicate.getReference(), boundTo.getPath(), boundTo.getDescriptor(), path, creatorDescriptor).asString()));
    }
    doOnBind(node);
}
Also used : InvalidModelRuleException(org.gradle.model.InvalidModelRuleException) ModelPath(org.gradle.model.internal.core.ModelPath) ModelRuleBindingException(org.gradle.model.ModelRuleBindingException) AmbiguousBindingReporter(org.gradle.model.internal.report.AmbiguousBindingReporter) ModelRuleDescriptor(org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor)

Example 2 with ModelRuleBindingException

use of org.gradle.model.ModelRuleBindingException in project gradle by gradle.

the class PathBinderCreationListener method doOnBind.

@Override
public void doOnBind(ModelNodeInternal node) {
    if (predicate.matches(node)) {
        boundTo = node;
        bindAction.execute(this);
    } else {
        throw new InvalidModelRuleException(referrer, new ModelRuleBindingException(IncompatibleTypeReferenceReporter.of(node, predicate.getReference().getType(), predicate.getReference().getDescription(), writable).asString()));
    }
}
Also used : InvalidModelRuleException(org.gradle.model.InvalidModelRuleException) ModelRuleBindingException(org.gradle.model.ModelRuleBindingException)

Aggregations

InvalidModelRuleException (org.gradle.model.InvalidModelRuleException)2 ModelRuleBindingException (org.gradle.model.ModelRuleBindingException)2 ModelPath (org.gradle.model.internal.core.ModelPath)1 ModelRuleDescriptor (org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor)1 AmbiguousBindingReporter (org.gradle.model.internal.report.AmbiguousBindingReporter)1