• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wurstscript / WurstScript / 259

27 Jun 2025 02:54PM UTC coverage: 62.224% (-0.007%) from 62.231%
259

push

circleci

Frotty
Allow game exe override

Supports specifying a specific file that will be run for the runmap commands, overriding other config

17261 of 27740 relevant lines covered (62.22%)

0.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java
1
package de.peeeq.wurstio.languageserver.requests;
2

3
import com.google.common.base.Charsets;
4
import com.google.common.io.Files;
5
import config.WurstProjectConfigData;
6
import de.peeeq.wurstio.Pjass;
7
import de.peeeq.wurstio.TimeTaker;
8
import de.peeeq.wurstio.UtilsIO;
9
import de.peeeq.wurstio.WurstCompilerJassImpl;
10
import de.peeeq.wurstio.languageserver.ModelManager;
11
import de.peeeq.wurstio.languageserver.ProjectConfigBuilder;
12
import de.peeeq.wurstio.languageserver.WFile;
13
import de.peeeq.wurstio.languageserver.WurstLanguageServer;
14
import de.peeeq.wurstio.mpq.MpqEditor;
15
import de.peeeq.wurstio.mpq.MpqEditorFactory;
16
import de.peeeq.wurstio.utils.W3InstallationData;
17
import de.peeeq.wurstscript.RunArgs;
18
import de.peeeq.wurstscript.WLogger;
19
import de.peeeq.wurstscript.ast.CompilationUnit;
20
import de.peeeq.wurstscript.ast.WImport;
21
import de.peeeq.wurstscript.ast.WPackage;
22
import de.peeeq.wurstscript.ast.WurstModel;
23
import de.peeeq.wurstscript.attributes.CompileError;
24
import de.peeeq.wurstscript.gui.WurstGui;
25
import de.peeeq.wurstscript.jassAst.JassProg;
26
import de.peeeq.wurstscript.jassprinter.JassPrinter;
27
import de.peeeq.wurstscript.luaAst.LuaCompilationUnit;
28
import de.peeeq.wurstscript.parser.WPos;
29
import de.peeeq.wurstscript.utils.LineOffsets;
30
import de.peeeq.wurstscript.utils.Utils;
31
import net.moonlightflower.wc3libs.bin.app.W3I;
32
import net.moonlightflower.wc3libs.port.GameVersion;
33
import net.moonlightflower.wc3libs.port.Orient;
34
import org.apache.commons.lang.StringUtils;
35
import org.eclipse.lsp4j.MessageParams;
36
import org.eclipse.lsp4j.MessageType;
37
import org.eclipse.lsp4j.services.LanguageClient;
38
import org.jetbrains.annotations.Nullable;
39

40
import java.io.File;
41
import java.io.FileNotFoundException;
42
import java.io.IOException;
43
import java.nio.channels.NonWritableChannelException;
44
import java.nio.charset.StandardCharsets;
45
import java.nio.file.Path;
46
import java.nio.file.Paths;
47
import java.nio.file.StandardOpenOption;
48
import java.time.Duration;
49
import java.util.*;
50
import java.util.concurrent.CompletableFuture;
51
import java.util.concurrent.atomic.AtomicReference;
52
import java.util.stream.Collectors;
53

54
public abstract class MapRequest extends UserRequest<Object> {
55
    protected final WurstLanguageServer langServer;
56
    protected final Optional<File> map;
57
    protected final List<String> compileArgs;
58
    protected final WFile workspaceRoot;
59
    protected final RunArgs runArgs;
60
    protected final Optional<String> wc3Path;
61
    protected final W3InstallationData w3data;
62
    protected final TimeTaker timeTaker;
63

64
    public static long mapLastModified = 0L;
×
65
    public static String mapPath = "";
×
66

67
    private static Long lastMapModified = 0L;
×
68
    private static String lastMapPath = "";
×
69

70
    /**
71
     * makes the compilation slower, but more safe by discarding results from the editor and working on a copy of the model
72
     */
73
    protected SafetyLevel safeCompilation = SafetyLevel.KindOfSafe;
×
74

75
    public TimeTaker getTimeTaker() {
76
        return timeTaker;
×
77
    }
78

79

80
    enum SafetyLevel {
×
81
        QuickAndDirty, KindOfSafe
×
82
    }
83

84
    public static class CompilationResult {
×
85
        public File script;
86
        public File w3i;
87
    }
88

89
    public MapRequest(WurstLanguageServer langServer, Optional<File> map, List<String> compileArgs, WFile workspaceRoot,
90
                      Optional<String> wc3Path, Optional<String> gameExePath) {
×
91
        this.langServer = langServer;
×
92
        this.map = map;
×
93
        this.compileArgs = compileArgs;
×
94
        this.workspaceRoot = workspaceRoot;
×
95
        this.runArgs = new RunArgs(compileArgs);
×
96
        this.wc3Path = wc3Path;
×
97
        if (gameExePath.isPresent() && StringUtils.isNotBlank(gameExePath.get())) {
×
98
            this.w3data = new W3InstallationData(Optional.of(new File(gameExePath.get())), Optional.of(GameVersion.VERSION_1_29));
×
99
        } else {
100
            this.w3data = getBestW3InstallationData();
×
101
        }
102
        if (runArgs.isMeasureTimes()) {
×
103
            this.timeTaker = new TimeTaker.Recording();
×
104
        } else {
105
            this.timeTaker = new TimeTaker.Default();
×
106
        }
107
    }
×
108

109
    @Override
110
    public void handleException(LanguageClient languageClient, Throwable err, CompletableFuture<Object> resFut) {
111
        if (err instanceof RequestFailedException) {
×
112
            RequestFailedException rfe = (RequestFailedException) err;
×
113
            languageClient.showMessage(new MessageParams(rfe.getMessageType(), rfe.getMessage()));
×
114
            resFut.complete(new Object());
×
115
        } else {
×
116
            super.handleException(languageClient, err, resFut);
×
117
        }
118
    }
×
119

120
    protected File compileMap(File projectFolder, WurstGui gui, Optional<File> mapCopy, RunArgs runArgs, WurstModel model,
121
                              WurstProjectConfigData projectConfigData, boolean isProd) {
122
        try (@Nullable MpqEditor mpqEditor = MpqEditorFactory.getEditor(mapCopy)) {
×
123
            if (mpqEditor != null && !mpqEditor.canWrite()) {
×
124
                WLogger.severe("The supplied map is invalid/corrupted/protected and Wurst cannot write to it.\n" +
×
125
                    "Please supply a valid .w3x input map that can be opened in the world editor.");
126
                throw new NonWritableChannelException();
×
127
            }
128
            WurstCompilerJassImpl compiler = new WurstCompilerJassImpl(timeTaker, projectFolder, gui, mpqEditor, runArgs);
×
129
            compiler.setMapFile(mapCopy);
×
130
            purgeUnimportedFiles(model);
×
131

132
            gui.sendProgress("Check program");
×
133
            compiler.checkProg(model);
×
134

135
            if (gui.getErrorCount() > 0) {
×
136
                throw new RequestFailedException(MessageType.Warning, "Could not compile project: ", gui.getErrorList().get(0));
×
137
            }
138

139
            print("translating program ... ");
×
140
            compiler.translateProgToIm(model);
×
141

142
            if (gui.getErrorCount() > 0) {
×
143
                throw new RequestFailedException(MessageType.Error, "Could not compile project (error in translation): " + gui.getErrorList().get(0));
×
144
            }
145

146
            timeTaker.measure("Runinng Compiletime Functions", () -> compiler.runCompiletime(projectConfigData, isProd, runArgs.isCompiletimeCache()));
×
147

148
            if (runArgs.isLua()) {
×
149
                print("Translating program to Lua ... ");
×
150
                Optional<LuaCompilationUnit> luaCode = Optional.ofNullable(compiler.transformProgToLua());
×
151

152
                if (!luaCode.isPresent()) {
×
153
                    print("Could not compile project\n");
×
154
                    throw new RuntimeException("Could not compile project (error in LUA translation)");
×
155
                }
156

157
                StringBuilder sb = new StringBuilder();
×
158
                luaCode.get().print(sb, 0);
×
159

160
                String compiledMapScript = sb.toString();
×
161
                File buildDir = getBuildDir();
×
162
                File outFile = new File(buildDir, "compiled.lua");
×
163
                Files.write(compiledMapScript.getBytes(Charsets.UTF_8), outFile);
×
164
                return outFile;
×
165

166
            } else {
167
                print("Translating program to jass ... ");
×
168
                compiler.transformProgToJass();
×
169

170
                Optional<JassProg> jassProg = Optional.ofNullable(compiler.getProg());
×
171
                if (!jassProg.isPresent()) {
×
172
                    print("Could not compile project\n");
×
173
                    throw new RuntimeException("Could not compile project (error in JASS translation)");
×
174
                }
175

176
                gui.sendProgress("Printing program");
×
177
                JassPrinter printer = new JassPrinter(!runArgs.isOptimize(), jassProg.get());
×
178
                String compiledMapScript = printer.printProg();
×
179
                File buildDir = getBuildDir();
×
180
                File outFile = new File(buildDir, "compiled.j.txt");
×
181
                Files.write(compiledMapScript.getBytes(Charsets.UTF_8), outFile);
×
182

183
                if (!runArgs.isDisablePjass()) {
×
184
                    gui.sendProgress("Running PJass");
×
185
                    Pjass.Result pJassResult = Pjass.runPjass(outFile,
×
186
                        new File(buildDir, "common.j").getAbsolutePath(),
×
187
                        new File(buildDir, "blizzard.j").getAbsolutePath());
×
188
                    WLogger.info(pJassResult.getMessage());
×
189
                    if (!pJassResult.isOk()) {
×
190
                        for (CompileError err : pJassResult.getErrors()) {
×
191
                            gui.sendError(err);
×
192
                        }
×
193
                        throw new RuntimeException("Could not compile project (PJass error)");
×
194
                    }
195
                }
196

197
                if (runArgs.isHotStartmap()) {
×
198
                    gui.sendProgress("Running JHCR");
×
199
                    return runJassHotCodeReload(outFile);
×
200
                }
201
                return outFile;
×
202
            }
203
        } catch (Exception e) {
×
204
            throw new RuntimeException(e);
×
205
        }
206
    }
207

208
    private File runJassHotCodeReload(File mapScript) throws IOException, InterruptedException {
209
        File buildDir = getBuildDir();
×
210
        File commonJ = new File(buildDir, "common.j");
×
211
        File blizzardJ = new File(buildDir, "blizzard.j");
×
212

213
        if (!commonJ.exists()) {
×
214
            throw new IOException("Could not find file " + commonJ.getAbsolutePath());
×
215
        }
216

217
        if (!blizzardJ.exists()) {
×
218
            throw new IOException("Could not find file " + blizzardJ.getAbsolutePath());
×
219
        }
220

221
        ProcessBuilder pb = new ProcessBuilder(langServer.getConfigProvider().getJhcrExe(), "init", commonJ.getName(), blizzardJ.getName(), mapScript.getName());
×
222
        pb.directory(buildDir);
×
223
        Utils.exec(pb, Duration.ofSeconds(30), System.err::println);
×
224
        return new File(buildDir, "jhcr_war3map.j");
×
225
    }
226

227
    /**
228
     * removes everything compilation unit which is neither
229
     * - inside a wurst folder
230
     * - a jass file
231
     * - imported by a file in a wurst folder
232
     */
233
    private void purgeUnimportedFiles(WurstModel model) {
234

235
        Set<CompilationUnit> imported = model.stream()
×
236
            .filter(cu -> isInWurstFolder(cu.getCuInfo().getFile()) || cu.getCuInfo().getFile().endsWith(".j")).collect(Collectors.toSet());
×
237
        addImports(imported, imported);
×
238

239
        model.removeIf(cu -> !imported.contains(cu));
×
240
    }
×
241

242
    private boolean isInWurstFolder(String file) {
243
        Path p = Paths.get(file);
×
244
        Path w;
245
        try {
246
            w = workspaceRoot.getPath();
×
247
        } catch (FileNotFoundException e) {
×
248
            return false;
×
249
        }
×
250
        return p.startsWith(w)
×
251
            && java.nio.file.Files.exists(p)
×
252
            && Utils.isWurstFile(file);
×
253
    }
254

255
    protected File getBuildDir() {
256
        File buildDir;
257
        try {
258
            buildDir = new File(workspaceRoot.getFile(), "_build");
×
259
        } catch (FileNotFoundException e) {
×
260
            throw new RuntimeException("Cannot get build dir", e);
×
261
        }
×
262
        if (!buildDir.exists()) {
×
263
            UtilsIO.mkdirs(buildDir);
×
264
        }
265
        return buildDir;
×
266
    }
267

268
    private void addImports(Set<CompilationUnit> result, Set<CompilationUnit> toAdd) {
269
        Set<CompilationUnit> imported =
×
270
            toAdd.stream()
×
271
                .flatMap((CompilationUnit cu) -> cu.getPackages().stream())
×
272
                .flatMap((WPackage p) -> p.getImports().stream())
×
273
                .map(WImport::attrImportedPackage)
×
274
                .filter(Objects::nonNull)
×
275
                .map(WPackage::attrCompilationUnit)
×
276
                .collect(Collectors.toSet());
×
277
        boolean changed = result.addAll(imported);
×
278
        if (changed) {
×
279
            // recursive call terminates, as there are only finitely many compilation units
280
            addImports(result, imported);
×
281
        }
282
    }
×
283

284
    protected void print(String s) {
285
        WLogger.info(s);
×
286
    }
×
287

288
    protected void println(String s) {
289
        WLogger.info(s);
×
290
    }
×
291

292

293
    protected File compileScript(WurstGui gui, ModelManager modelManager, List<String> compileArgs, Optional<File> mapCopy,
294
                                 WurstProjectConfigData projectConfigData, boolean isProd, File scriptFile) throws Exception {
295
        RunArgs runArgs = new RunArgs(compileArgs);
×
296

297
        gui.sendProgress("Compiling Script");
×
298
        print("Compile Script : ");
×
299
        for (File dep : modelManager.getDependencyWurstFiles()) {
×
300
            WLogger.info("dep: " + dep.getPath());
×
301
        }
×
302
        print("Dependencies done.");
×
303
        if (safeCompilation != RunMap.SafetyLevel.QuickAndDirty) {
×
304
            // it is safer to rebuild the project, instead of taking the current editor state
305
            gui.sendProgress("Cleaning project");
×
306
            modelManager.clean();
×
307
            gui.sendProgress("Building project");
×
308
            modelManager.buildProject();
×
309
        }
310

311
        replaceBaseScriptWithConfig(modelManager, scriptFile);
×
312

313
        if (modelManager.hasErrors()) {
×
314
            for (CompileError compileError : modelManager.getParseErrors()) {
×
315
                gui.sendError(compileError);
×
316
            }
×
317
            throw new RequestFailedException(MessageType.Warning, "Cannot run code with syntax errors.");
×
318
        }
319

320
        WurstModel model = modelManager.getModel();
×
321
        if (safeCompilation != RunMap.SafetyLevel.QuickAndDirty) {
×
322
            // compilation will alter the model (e.g. remove unused imports),
323
            // so it is safer to create a copy
324
            model = ModelManager.copy(model);
×
325
        }
326

327
        return compileMap(modelManager.getProjectPath(), gui, mapCopy, runArgs, model, projectConfigData, isProd);
×
328
    }
329

330
    private static void replaceBaseScriptWithConfig(ModelManager modelManager, File scriptFile) throws IOException {
331
        Optional<CompilationUnit> war3mapJ = modelManager.getModel()
×
332
            .stream()
×
333
            .filter((CompilationUnit cu) -> cu.getCuInfo().getFile().endsWith("war3map.j"))
×
334
            .findFirst();
×
335

336
        if (war3mapJ.isPresent()) {
×
337
            modelManager.syncCompilationUnitContent(WFile.create(war3mapJ.get().getCuInfo().getFile()),
×
338
                java.nio.file.Files.readString(scriptFile.toPath()));
×
339
        }
340
    }
×
341

342

343
    protected CompilationResult compileScript(ModelManager modelManager, WurstGui gui, Optional<File> testMap, WurstProjectConfigData projectConfigData, File buildDir, boolean isProd) throws Exception {
344
        if (testMap.isPresent() && testMap.get().exists()) {
×
345
            boolean deleteOk = testMap.get().delete();
×
346
            if (!deleteOk) {
×
347
                throw new RequestFailedException(MessageType.Error, "Could not delete old mapfile: " + testMap);
×
348
            }
349
        }
350
        if (map.isPresent() && testMap.isPresent()) {
×
351
            Files.copy(map.get(), testMap.get());
×
352
        }
353

354
        CompilationResult result;
355

356
        if (runArgs.isHotReload()) {
×
357
            // For hot reload use cached war3map if it exists
358
            result = new CompilationResult();
×
359
            result.script = new File(buildDir, "war3mapj_with_config.j.txt");
×
360
            if (!result.script.exists()) {
×
361
                result.script = new File(new File(workspaceRoot.getFile(), "wurst"), "war3map.j");
×
362
            }
363
            if (!result.script.exists()) {
×
364
                throw new RequestFailedException(MessageType.Error, "Could not find war3map.j file");
×
365
            }
366
        } else {
367
            timeTaker.beginPhase("load map script");
×
368
            File scriptFile = loadMapScript(testMap, modelManager, gui);
×
369
            timeTaker.endPhase();
×
370
            result = applyProjectConfig(gui, testMap, buildDir, projectConfigData, scriptFile);
×
371
        }
372

373

374
        // first compile the script:
375
        result.script = compileScript(gui, modelManager, compileArgs, testMap, projectConfigData, isProd, result.script);
×
376

377
        Optional<WurstModel> model = Optional.ofNullable(modelManager.getModel());
×
378
        if (!model.isPresent()
×
379
            || model
380
            .get()
×
381
            .stream()
×
382
            .noneMatch((CompilationUnit cu) -> cu.getCuInfo().getFile().endsWith("war3map.j"))) {
×
383
            println("No 'war3map.j' file could be found inside the map nor inside the wurst folder");
×
384
            println("If you compile the map with WurstPack once, this file should be in your wurst-folder. ");
×
385
            println("We will try to start the map now, but it will probably fail. ");
×
386
        }
387
        return result;
×
388
    }
389

390

391
    private File loadMapScript(Optional<File> mapCopy, ModelManager modelManager, WurstGui gui) throws Exception {
392
        File scriptFile = new File(new File(workspaceRoot.getFile(), "wurst"), "war3map.j");
×
393
        // If runargs are no extract, either use existing or throw error
394
        // Otherwise try loading from map, if map was saved with wurst, try existing script, otherwise error
395
        if (!mapCopy.isPresent() || runArgs.isNoExtractMapScript()) {
×
396
            if (scriptFile.exists()) {
×
397
                modelManager.syncCompilationUnit(WFile.create(scriptFile));
×
398
                return scriptFile;
×
399
            } else {
400
                throw new CompileError(new WPos("", new LineOffsets(), 0, 0),
×
401
                    "RunArg noExtractMapScript is set but no mapscript is provided inside the wurst folder");
402
            }
403
        }
404
        if (MapRequest.mapLastModified > lastMapModified || !MapRequest.mapPath.equals(lastMapPath)) {
×
405
            lastMapModified = MapRequest.mapLastModified;
×
406
            lastMapPath = MapRequest.mapPath;
×
407
            System.out.println("Map not cached yet, extracting script");
×
408
            byte[] extractedScript = null;
×
409
            try (@Nullable MpqEditor mpqEditor = MpqEditorFactory.getEditor(mapCopy, true)) {
×
410
                if (mpqEditor.hasFile("war3map.j")) {
×
411
                    extractedScript = mpqEditor.extractFile("war3map.j");
×
412
                }
413
            }
414
            if (extractedScript == null) {
×
415
                if (scriptFile.exists()) {
×
416
                    String msg = "No war3map.j in map file, using old extracted file";
×
417
                    WLogger.info(msg);
×
418
                } else {
×
419
                    CompileError err = new CompileError(new WPos(mapCopy.toString(), new LineOffsets(), 0, 0),
×
420
                        "No war3map.j found in map file.");
421
                    gui.showInfoMessage(err.getMessage());
×
422
                    WLogger.severe(err);
×
423
                }
×
424
            } else if (new String(extractedScript, StandardCharsets.UTF_8).startsWith(JassPrinter.WURST_COMMENT_RAW)) {
×
425
                WLogger.info("map has already been compiled with wurst");
×
426
                // file generated by wurst, do not use
427
                if (scriptFile.exists()) {
×
428
                    String msg = "Cannot use war3map.j from map file, because it already was compiled with wurst. " + "Using war3map.j from Wurst directory instead.";
×
429
                    WLogger.info(msg);
×
430
                } else {
×
431
                    CompileError err = new CompileError(new WPos(mapCopy.toString(), new LineOffsets(), 0, 0),
×
432
                        "Cannot use war3map.j from map file, because it already was compiled with wurst. " + "Please add war3map.j to the wurst directory.");
433
                    gui.showInfoMessage(err.getMessage());
×
434
                    WLogger.severe(err);
×
435
                }
×
436
            } else {
437
                WLogger.info("new map, use extracted");
×
438
                // write mapfile from map to workspace
439
                Files.write(extractedScript, scriptFile);
×
440
            }
441
        } else {
×
442
            System.out.println("Map not modified, not extracting script");
×
443
        }
444

445

446
        return scriptFile;
×
447
    }
448

449
    private CompilationResult applyProjectConfig(WurstGui gui, Optional<File> testMap, File buildDir, WurstProjectConfigData projectConfig, File scriptFile) {
450
        AtomicReference<CompilationResult> result = new AtomicReference<>();
×
451
        gui.sendProgress("Applying Map Config...");
×
452
        timeTaker.measure("Applying Map Config", () -> {
×
453
            try {
454
                result.set(ProjectConfigBuilder.apply(projectConfig, testMap.get(), scriptFile, buildDir, runArgs, w3data));
×
455
            } catch (IOException e) {
×
456
                throw new RuntimeException(e);
×
457
            }
×
458
        });
×
459
        return result.get();
×
460
    }
461

462
    private W3InstallationData getBestW3InstallationData() throws RequestFailedException {
463
        if (Orient.isLinuxSystem()) {
×
464
            // no Warcraft installation supported on Linux
465
            return new W3InstallationData(Optional.empty(), Optional.empty());
×
466
        }
467
        if (wc3Path.isPresent() && StringUtils.isNotBlank(wc3Path.get())) {
×
468
            W3InstallationData w3data = new W3InstallationData(langServer, new File(wc3Path.get()),
×
469
                this instanceof RunMap && !runArgs.isHotReload());
×
470
            if (w3data.getWc3PatchVersion().isEmpty()) {
×
471
                throw new RequestFailedException(MessageType.Error, "Could not find Warcraft III installation at specified path: " + wc3Path);
×
472
            }
473

474
            return w3data;
×
475
        } else {
476
            return new W3InstallationData(langServer, this instanceof RunMap && !runArgs.isHotReload());
×
477
        }
478
    }
479

480
    protected void injectMapData(WurstGui gui, Optional<File> testMap, CompilationResult result) throws Exception {
481
        gui.sendProgress("Injecting map data");
×
482
        try (MpqEditor mpqEditor = MpqEditorFactory.getEditor(testMap)) {
×
483
            String mapScriptName;
484
            if (runArgs.isLua()) {
×
485
                mapScriptName = "war3map.lua";
×
486
                injectExternalLuaFiles(result.script);
×
487
            } else {
488
                mapScriptName = "war3map.j";
×
489
            }
490
            // delete both original mapscripts, just to be sure:
491
            mpqEditor.deleteFile("war3map.j");
×
492
            mpqEditor.deleteFile("war3map.lua");
×
493
            if (result.w3i != null) {
×
494
                mpqEditor.deleteFile(W3I.GAME_PATH.getName());
×
495
                mpqEditor.insertFile(W3I.GAME_PATH.getName(), result.w3i);
×
496
            }
497
            mpqEditor.insertFile(mapScriptName, result.script);
×
498
        }
499
    }
×
500

501
    private void injectExternalLuaFiles(File script) {
502
        File luaDir;
503
        try {
504
            luaDir = new File(workspaceRoot.getFile(), "lua");
×
505
        } catch (FileNotFoundException e) {
×
506
            throw new RuntimeException("Cannot get build dir", e);
×
507
        }
×
508
        if (luaDir.exists()) {
×
509
            File[] children = luaDir.listFiles();
×
510
            if (children != null) {
×
511
                Arrays.stream(children).forEach(child -> {
×
512
                    try {
513
                        byte[] bytes = java.nio.file.Files.readAllBytes(child.toPath());
×
514
                        if (child.getName().startsWith("pre_")) {
×
515
                            byte[] existingBytes = java.nio.file.Files.readAllBytes(script.toPath());
×
516
                            java.nio.file.Files.write(
×
517
                                script.toPath(),
×
518
                                bytes);
519
                            java.nio.file.Files.write(
×
520
                                script.toPath(),
×
521
                                existingBytes,
522
                                StandardOpenOption.APPEND);
523
                        } else {
×
524
                            java.nio.file.Files.write(
×
525
                                script.toPath(),
×
526
                                bytes,
527
                                StandardOpenOption.APPEND);
528
                        }
529
                    } catch (IOException e) {
×
530
                        throw new RuntimeException(e);
×
531
                    }
×
532
                });
×
533
            }
534
        }
535
    }
×
536

537

538
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc