valepakh commented on code in PR #7402:
URL: https://github.com/apache/ignite-3/pull/7402#discussion_r2686763548
##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/call/cluster/unit/DeployUnitCall.java:
##########
@@ -96,6 +124,95 @@ public CompletableFuture<CallOutput<String>>
execute(DeployUnitCallInput input)
});
}
+ private static File createZipFromDirectory(Path sourceDir) throws
IOException {
+ Path zipPath = Files.createTempFile("deploy-unit-", ".zip");
+ try (OutputStream os = Files.newOutputStream(zipPath);
+ ZipOutputStream zos = new ZipOutputStream(os)) {
+ try (Stream<Path> stream = Files.walk(sourceDir)) {
+ stream.filter(Files::isRegularFile).forEach(filePath -> {
+ Path relativePath = sourceDir.relativize(filePath);
+ try {
+ ZipEntry zipEntry = new
ZipEntry(relativePath.toString().replace('\\', '/'));
+ zos.putNextEntry(zipEntry);
+ Files.copy(filePath, zos);
+ zos.closeEntry();
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to add file to ZIP:
" + filePath, e);
Review Comment:
Maybe use `sneakyThrow` here? This exception won't be caught by the `catch
(IOException`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]