Search in sources :

Example 1 with ModelRuleExecutionException

use of org.gradle.model.internal.core.ModelRuleExecutionException in project gradle by gradle.

the class DefaultModelRegistry method fireAction.

private void fireAction(RuleBinder boundMutator) {
    final List<ModelView<?>> inputs = toViews(boundMutator.getInputBindings(), boundMutator.getAction().getDescriptor());
    ModelBinding subjectBinding = boundMutator.getSubjectBinding();
    final ModelNodeInternal node = subjectBinding.getNode();
    final ModelAction mutator = boundMutator.getAction();
    ModelRuleDescriptor descriptor = mutator.getDescriptor();
    LOGGER.debug("Project {} - Mutating {} using {}", projectPath, node.getPath(), descriptor);
    try {
        RuleContext.run(descriptor, new Runnable() {

            @Override
            public void run() {
                mutator.execute(node, inputs);
            }
        });
    } catch (Throwable e) {
        // TODO some representation of state of the inputs
        throw new ModelRuleExecutionException(descriptor, e);
    }
}
Also used : ModelRuleExecutionException(org.gradle.model.internal.core.ModelRuleExecutionException) ModelView(org.gradle.model.internal.core.ModelView) ModelAction(org.gradle.model.internal.core.ModelAction) ModelRuleDescriptor(org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor) SimpleModelRuleDescriptor(org.gradle.model.internal.core.rule.describe.SimpleModelRuleDescriptor)

Aggregations

ModelAction (org.gradle.model.internal.core.ModelAction)1 ModelRuleExecutionException (org.gradle.model.internal.core.ModelRuleExecutionException)1 ModelView (org.gradle.model.internal.core.ModelView)1 ModelRuleDescriptor (org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor)1 SimpleModelRuleDescriptor (org.gradle.model.internal.core.rule.describe.SimpleModelRuleDescriptor)1