use of org.gradle.internal.component.external.model.IvyModuleResolveMetadata in project gradle by gradle.
the class DefaultComponentMetadataHandler method processRule.
private void processRule(SpecRuleAction<? super ComponentMetadataDetails> specRuleAction, ModuleComponentResolveMetadata metadata, ComponentMetadataDetails details) {
if (!specRuleAction.getSpec().isSatisfiedBy(details)) {
return;
}
List<Object> inputs = Lists.newArrayList();
for (Class<?> inputType : specRuleAction.getAction().getInputTypes()) {
if (inputType == IvyModuleDescriptor.class) {
// Ignore the rule if it expects Ivy metadata and this isn't an Ivy module
if (!(metadata instanceof IvyModuleResolveMetadata)) {
return;
}
IvyModuleResolveMetadata ivyMetadata = (IvyModuleResolveMetadata) metadata;
inputs.add(new DefaultIvyModuleDescriptor(ivyMetadata.getExtraInfo(), ivyMetadata.getBranch(), ivyMetadata.getStatus()));
continue;
}
// We've already validated the inputs: should never get here.
throw new IllegalStateException();
}
try {
specRuleAction.getAction().execute(details, inputs);
} catch (Exception e) {
throw new InvalidUserCodeException(String.format("There was an error while evaluating a component metadata rule for %s.", details.getId()), e);
}
}
Aggregations