use of org.gradle.api.UncheckedIOException in project gradle by gradle.
the class DispatchingBuildCacheService method pushToLocalAndRemote.
private void pushToLocalAndRemote(BuildCacheKey key, BuildCacheEntryWriter writer) {
File destination = temporaryFileProvider.createTemporaryFile("gradle_cache", "entry");
try {
writeCacheEntryLocally(writer, destination);
BuildCacheEntryWriter copier = new CopyBuildCacheEntryWriter(destination);
local.store(key, copier);
remote.store(key, copier);
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
GFileUtils.deleteQuietly(destination);
}
}
use of org.gradle.api.UncheckedIOException in project gradle by gradle.
the class DefaultCacheAwareExternalResourceAccessor method getResourceSha1.
private HashValue getResourceSha1(URI location, boolean revalidate) {
try {
URI sha1Location = new URI(location.toASCIIString() + ".sha1");
ExternalResource resource = delegate.getResource(sha1Location, revalidate);
if (resource == null) {
return null;
}
try {
return resource.withContent(new Transformer<HashValue, InputStream>() {
@Override
public HashValue transform(InputStream inputStream) {
try {
String sha = IOUtils.toString(inputStream, "us-ascii");
return HashValue.parse(sha);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
});
} finally {
resource.close();
}
} catch (Exception e) {
throw new ResourceException(location, String.format("Failed to download SHA1 for resource '%s'.", location), e);
}
}
use of org.gradle.api.UncheckedIOException in project gradle by gradle.
the class ReportGenerator method generateReport.
public void generateReport(Set<Project> projects) {
try {
ReportRenderer renderer = getRenderer();
renderer.setClientMetaData(getClientMetaData());
File outputFile = getOutputFile();
if (outputFile != null) {
renderer.setOutputFile(outputFile);
} else {
renderer.setOutput(getTextOutputFactory().create(getClass()));
}
for (Project project : projects) {
renderer.startProject(project);
projectReportGenerator.generateReport(project);
renderer.completeProject(project);
}
renderer.complete();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.gradle.api.UncheckedIOException in project gradle by gradle.
the class DefaultDeploymentDescriptor method readFrom.
@Override
public boolean readFrom(Object path) {
if (fileResolver == null) {
return false;
}
File descriptorFile = fileResolver.resolve(path);
if (descriptorFile == null || !descriptorFile.exists()) {
return false;
}
try {
FileReader reader = new FileReader(descriptorFile);
readFrom(reader);
return true;
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.gradle.api.UncheckedIOException in project gradle by gradle.
the class PathFactory method getPathList.
private static List<String> getPathList(File f) {
try {
List<String> list = Lists.newArrayList();
File r = f.getCanonicalFile();
while (r != null) {
File parent = r.getParentFile();
list.add(parent != null ? r.getName() : r.getAbsolutePath());
r = parent;
}
return list;
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}
Aggregations