Skip to content

Commit fc5ff03

Browse files
Merge branch 'release/0.4.4'
2 parents dcb8b30 + 2859a71 commit fc5ff03

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>io.github.coffeelibs</groupId>
55
<artifactId>jextract-maven-plugin</artifactId>
66
<packaging>maven-plugin</packaging>
7-
<version>0.4.3</version>
7+
<version>0.4.4</version>
88
<name>jextract Maven Plugin</name>
99
<description>A Maven plugin to invokes jextract.</description>
1010
<inceptionYear>2022</inceptionYear>

src/main/java/io/github/coffeelibs/maven/jextract/SourcesMojo.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
import java.io.File;
1111
import java.io.IOException;
12+
import java.io.UncheckedIOException;
1213
import java.nio.charset.StandardCharsets;
1314
import java.nio.file.Files;
1415
import java.util.ArrayList;
1516
import java.util.Arrays;
1617
import java.util.List;
18+
import java.util.concurrent.CompletableFuture;
1719

1820
@SuppressWarnings({"unused", "MismatchedReadAndWriteOfArray"})
1921
@Mojo(name = "sources", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true, requiresOnline = true)
@@ -215,9 +217,25 @@ public void execute() throws MojoFailureException {
215217
try (var stdout = new LoggingOutputStream(getLog()::info, StandardCharsets.UTF_8);
216218
var stderr = new LoggingOutputStream(getLog()::warn, StandardCharsets.UTF_8)) {
217219
Process process = command.start();
218-
process.getInputStream().transferTo(stdout);
219-
process.getErrorStream().transferTo(stderr);
220+
221+
final var stdoutFuture = CompletableFuture.runAsync(() -> {
222+
try {
223+
process.getInputStream().transferTo(stdout);
224+
} catch (IOException e) {
225+
throw new UncheckedIOException("Error while writing jextract stdout to logs", e);
226+
}
227+
});
228+
229+
final var stderrFuture = CompletableFuture.runAsync(() -> {
230+
try {
231+
process.getErrorStream().transferTo(stderr);
232+
} catch (IOException e) {
233+
throw new UncheckedIOException("Error while writing jextract stderr to logs", e);
234+
}
235+
});
236+
220237
int result = process.waitFor();
238+
CompletableFuture.allOf(stdoutFuture, stderrFuture).join();
221239
if (result != 0) {
222240
throw new MojoFailureException("jextract returned error code " + result);
223241
}

0 commit comments

Comments
 (0)