use of org.gradle.plugin.management.internal.DefaultPluginRequest in project gradle by gradle.
the class DefaultAutoAppliedPluginRegistry method createGradleEnterprisePluginRequest.
private static PluginRequestInternal createGradleEnterprisePluginRequest() {
ModuleIdentifier moduleIdentifier = DefaultModuleIdentifier.newId(AutoAppliedGradleEnterprisePlugin.GROUP, AutoAppliedGradleEnterprisePlugin.NAME);
ModuleVersionSelector artifact = DefaultModuleVersionSelector.newSelector(moduleIdentifier, AutoAppliedGradleEnterprisePlugin.VERSION);
return new DefaultPluginRequest(AutoAppliedGradleEnterprisePlugin.ID, AutoAppliedGradleEnterprisePlugin.VERSION, true, null, getScriptDisplayName(), artifact);
}
use of org.gradle.plugin.management.internal.DefaultPluginRequest in project gradle by gradle.
the class PluginRequestCollector method listPluginRequests.
@VisibleForTesting
List<PluginRequestInternal> listPluginRequests() {
List<PluginRequestInternal> pluginRequests = collect(specs, new Transformer<PluginRequestInternal, PluginDependencySpecImpl>() {
@Override
public PluginRequestInternal transform(PluginDependencySpecImpl original) {
return new DefaultPluginRequest(original.id, original.version, original.apply, original.lineNumber, scriptSource);
}
});
Map<PluginId, Collection<PluginRequestInternal>> groupedById = CollectionUtils.groupBy(pluginRequests, new Transformer<PluginId, PluginRequestInternal>() {
@Override
public PluginId transform(PluginRequestInternal pluginRequest) {
return pluginRequest.getId();
}
});
// Check for duplicates
for (PluginId key : groupedById.keySet()) {
Collection<PluginRequestInternal> pluginRequestsForId = groupedById.get(key);
if (pluginRequestsForId.size() > 1) {
Iterator<PluginRequestInternal> iterator = pluginRequestsForId.iterator();
PluginRequestInternal first = iterator.next();
PluginRequestInternal second = iterator.next();
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