wasm gc: fix maven mojo that copies runtime

This commit is contained in:
Alexey Andreev 2024-10-22 18:20:47 +02:00
parent 5c743bc9a4
commit 7a2cf555e3

View File

@ -59,6 +59,7 @@ public class TeaVMCopyWebassemblyGCRuntimeMojo extends AbstractMojo {
var resourceName = "org/teavm/backend/wasm/" + name + ".js"; var resourceName = "org/teavm/backend/wasm/" + name + ".js";
var classLoader = TeaVMCopyWebassemblyGCRuntimeMojo.class.getClassLoader(); var classLoader = TeaVMCopyWebassemblyGCRuntimeMojo.class.getClassLoader();
var output = new File(targetDirectory, runtimeFileName); var output = new File(targetDirectory, runtimeFileName);
output.getParentFile().mkdirs();
try (var input = classLoader.getResourceAsStream(resourceName)) { try (var input = classLoader.getResourceAsStream(resourceName)) {
Files.copy(input, output.toPath(), StandardCopyOption.REPLACE_EXISTING); Files.copy(input, output.toPath(), StandardCopyOption.REPLACE_EXISTING);
} }
@ -66,6 +67,7 @@ public class TeaVMCopyWebassemblyGCRuntimeMojo extends AbstractMojo {
if (deobfuscator) { if (deobfuscator) {
resourceName = "org/teavm/backend/wasm/deobfuscator.wasm"; resourceName = "org/teavm/backend/wasm/deobfuscator.wasm";
output = new File(targetDirectory, deobfuscatorFileName); output = new File(targetDirectory, deobfuscatorFileName);
output.getParentFile().mkdirs();
try (var input = classLoader.getResourceAsStream(resourceName)) { try (var input = classLoader.getResourceAsStream(resourceName)) {
Files.copy(input, output.toPath(), StandardCopyOption.REPLACE_EXISTING); Files.copy(input, output.toPath(), StandardCopyOption.REPLACE_EXISTING);
} }