use of org.gradle.api.InvalidUserCodeException in project gradle by gradle.
the class DefaultComponentMetadataHandler method createModuleSpecConfigurableRule.
private SpecConfigurableRule createModuleSpecConfigurableRule(Object id, ConfigurableRule<ComponentMetadataContext> instantiatingAction) {
ModuleIdentifier moduleIdentifier;
try {
moduleIdentifier = moduleIdentifierNotationParser.parseNotation(id);
} catch (UnsupportedNotationException e) {
throw new InvalidUserCodeException(String.format(INVALID_SPEC_ERROR, id == null ? "null" : id.toString()), e);
}
Spec<ModuleVersionIdentifier> spec = new ModuleVersionIdentifierSpec(moduleIdentifier);
return new SpecConfigurableRule(instantiatingAction, spec);
}
use of org.gradle.api.InvalidUserCodeException in project gradle by gradle.
the class DefaultDependencyResolutionManagement method ruleMutationDisallowedOnProject.
private void ruleMutationDisallowedOnProject(DisplayName ruleName) {
UserCodeApplicationContext.Application current = context.current();
DisplayName displayName = current == null ? null : current.getDisplayName();
if (displayName == null) {
displayName = UNKNOWN_CODE;
}
String message = "Build was configured to prefer settings component metadata rules over project rules but rule '" + ruleName + "' was added by " + displayName;
switch(getConfiguredRulesMode()) {
case FAIL_ON_PROJECT_RULES:
throw new InvalidUserCodeException(message);
case PREFER_SETTINGS:
LOGGER.warn(message);
break;
}
}
Aggregations