Search in sources :

Example 1 with ExternalResourceMetaData

use of org.gradle.internal.resource.metadata.ExternalResourceMetaData in project gradle by gradle.

the class BuildOperationExternalResource method createBuildOperationDetails.

private BuildOperationDetails createBuildOperationDetails() {
    ExternalResourceMetaData metaData = getMetaData();
    DownloadBuildOperationDescriptor downloadBuildOperationDescriptor = new DownloadBuildOperationDescriptor(metaData.getLocation(), metaData.getContentLength(), metaData.getContentType());
    BuildOperationDetails buildOperationDetails = BuildOperationDetails.displayName("Download " + metaData.getLocation().toString()).parent(buildOperationExecutor.getCurrentOperation()).operationDescriptor(downloadBuildOperationDescriptor).build();
    return buildOperationDetails;
}
Also used : DownloadBuildOperationDescriptor(org.gradle.internal.resource.transfer.DownloadBuildOperationDescriptor) BuildOperationDetails(org.gradle.internal.progress.BuildOperationDetails) ExternalResourceMetaData(org.gradle.internal.resource.metadata.ExternalResourceMetaData)

Example 2 with ExternalResourceMetaData

use of org.gradle.internal.resource.metadata.ExternalResourceMetaData in project gradle by gradle.

the class HttpResourceAccessor method getMetaData.

public ExternalResourceMetaData getMetaData(URI uri, boolean revalidate) {
    String location = uri.toString();
    LOGGER.debug("Constructing external resource metadata: {}", location);
    CloseableHttpResponse response = http.performHead(location, revalidate);
    ExternalResourceMetaData result = null;
    if (response != null) {
        HttpResponseResource resource = new HttpResponseResource("HEAD", uri, response);
        try {
            result = resource.getMetaData();
        } finally {
            IoActions.closeQuietly(resource);
        }
    }
    return result;
}
Also used : CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) ExternalResourceMetaData(org.gradle.internal.resource.metadata.ExternalResourceMetaData)

Aggregations

ExternalResourceMetaData (org.gradle.internal.resource.metadata.ExternalResourceMetaData)2 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)1 BuildOperationDetails (org.gradle.internal.progress.BuildOperationDetails)1 DownloadBuildOperationDescriptor (org.gradle.internal.resource.transfer.DownloadBuildOperationDescriptor)1