use of org.gradle.internal.resource.transport.http.DefaultHttpSettings in project gradle by gradle.
the class DefaultHttpBuildCacheServiceFactory method createBuildCacheService.
@Override
public BuildCacheService createBuildCacheService(HttpBuildCache configuration) {
URI url = configuration.getUrl();
if (url == null) {
throw new IllegalStateException("HTTP build cache has no URL configured");
}
Collection<Authentication> authentications = Collections.emptyList();
if (configuration.getCredentials().getUsername() != null && configuration.getCredentials().getPassword() != null) {
try {
url = new URI(url.getScheme(), null, url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getFragment());
} catch (URISyntaxException e) {
throw new GradleException("Error constructing URL for http build cache", e);
}
DefaultBasicAuthentication basicAuthentication = new DefaultBasicAuthentication("basic");
basicAuthentication.setCredentials(configuration.getCredentials());
authentications = Collections.<Authentication>singleton(basicAuthentication);
}
HttpClientHelper httpClientHelper = new HttpClientHelper(new DefaultHttpSettings(authentications, sslContextFactory));
return new HttpBuildCacheService(httpClientHelper, url);
}
Aggregations