use of org.gradle.plugin.management.internal.InvalidPluginRequestException in project gradle by gradle.
the class NotNonCorePluginOnClasspathCheckPluginResolver method resolve.
public void resolve(PluginRequestInternal pluginRequest, PluginResolutionResult result) {
PluginId pluginId = pluginRequest.getId();
PluginDescriptor pluginDescriptor = pluginDescriptorLocator.findPluginDescriptor(pluginId.toString());
if (pluginDescriptor == null || isCorePlugin(pluginId)) {
delegate.resolve(pluginRequest, result);
} else {
throw new InvalidPluginRequestException(pluginRequest, pluginOnClasspathErrorMessage(pluginId.toString()));
}
}
use of org.gradle.plugin.management.internal.InvalidPluginRequestException in project gradle by gradle.
the class PluginRequestCollector method listPluginRequests.
public List<PluginRequestInternal> listPluginRequests() {
List<PluginRequestInternal> pluginRequests = collect(specs, new Transformer<PluginRequestInternal, DependencySpecImpl>() {
public PluginRequestInternal transform(DependencySpecImpl original) {
return new DefaultPluginRequest(original.id, original.version, original.apply, original.lineNumber, scriptSource);
}
});
ListMultimap<PluginId, PluginRequestInternal> groupedById = CollectionUtils.groupBy(pluginRequests, new Transformer<PluginId, PluginRequestInternal>() {
public PluginId transform(PluginRequestInternal pluginRequest) {
return pluginRequest.getId();
}
});
// Check for duplicates
for (PluginId key : groupedById.keySet()) {
List<PluginRequestInternal> pluginRequestsForId = groupedById.get(key);
if (pluginRequestsForId.size() > 1) {
PluginRequestInternal first = pluginRequests.get(0);
PluginRequestInternal second = pluginRequests.get(1);
InvalidPluginRequestException exception = new InvalidPluginRequestException(second, "Plugin with id '" + key + "' was already requested at line " + first.getLineNumber());
throw new LocationAwareException(exception, second.getScriptDisplayName(), second.getLineNumber());
}
}
return pluginRequests;
}
Aggregations