use of org.gradle.api.UncheckedIOException in project gradle by gradle.
the class GUtil method serialize.
public static void serialize(Object object, OutputStream outputStream) {
try {
ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);
objectOutputStream.writeObject(object);
objectOutputStream.close();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.gradle.api.UncheckedIOException in project gradle by gradle.
the class GUtil method loadProperties.
public static Properties loadProperties(InputStream inputStream) {
Properties properties = new Properties();
try {
properties.load(inputStream);
inputStream.close();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return properties;
}
use of org.gradle.api.UncheckedIOException in project gradle by gradle.
the class DefaultBuildCacheTempFileStore method withTempFile.
@Override
public void withTempFile(BuildCacheKey key, Action<? super File> action) {
String hashCode = key.getHashCode();
File tempFile = null;
try {
try {
tempFile = File.createTempFile(hashCode + "-", PARTIAL_FILE_SUFFIX, dir);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
action.execute(tempFile);
} finally {
GFileUtils.deleteQuietly(tempFile);
}
}
use of org.gradle.api.UncheckedIOException in project gradle by gradle.
the class FileToArchiveEntrySetTransformer method transform.
public Set<ArchiveEntry> transform(File archiveFile) {
FileInputStream fileInputStream;
try {
fileInputStream = new FileInputStream(archiveFile);
} catch (FileNotFoundException e) {
throw new UncheckedIOException(e);
}
ImmutableSet.Builder<ArchiveEntry> allEntries = ImmutableSet.builder();
walk(fileInputStream, allEntries, ImmutableList.<String>of());
return allEntries.build();
}
use of org.gradle.api.UncheckedIOException in project gradle by gradle.
the class CacheBackedTaskHistoryRepository method snapshotDiscoveredInputs.
private static FileCollectionSnapshot snapshotDiscoveredInputs(Task task, InputNormalizationStrategy normalizationStrategy, Collection<File> discoveredInputs, FileCollectionSnapshotterRegistry snapshotterRegistry, FileCollectionFactory fileCollectionFactory) {
FileCollectionSnapshotter snapshotter = snapshotterRegistry.getSnapshotter(GenericFileNormalizer.class);
if (discoveredInputs.isEmpty()) {
LOGGER.debug("No discovered inputs for {}", task);
return EmptyFileCollectionSnapshot.INSTANCE;
}
LOGGER.debug("Snapshotting discovered inputs for {}", task);
try {
return snapshotter.snapshot(fileCollectionFactory.fixed("Discovered input files", discoveredInputs), ABSOLUTE, normalizationStrategy);
} catch (Exception e) {
throw new UncheckedIOException(String.format("Failed to capture snapshot of discovered input files for %s during up-to-date check.", task), e);
}
}
Aggregations