From ec0a9e54d3a301ab197e73f9a7ade54bb650ae5f Mon Sep 17 00:00:00 2001 From: Frotty Date: Wed, 3 Jan 2024 19:32:09 +0100 Subject: [PATCH] Critical fix: Use script file with build config in compilation --- .../wurstio/languageserver/requests/MapRequest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java index 814b7b86d..a33fba2f1 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java @@ -285,6 +285,17 @@ protected void println(String s) { protected File compileScript(WurstGui gui, ModelManager modelManager, List compileArgs, Optional mapCopy, WurstProjectConfigData projectConfigData, boolean isProd, File scriptFile) throws Exception { RunArgs runArgs = new RunArgs(compileArgs); + + Optional war3mapJ = modelManager.getModel() + .stream() + .filter((CompilationUnit cu) -> cu.getCuInfo().getFile().endsWith("war3map.j")) + .findFirst(); + + if (war3mapJ.isPresent()) { + modelManager.syncCompilationUnitContent(WFile.create(war3mapJ.get().getCuInfo().getFile()), + java.nio.file.Files.readString(scriptFile.toPath())); + } + gui.sendProgress("Compiling Script"); print("Compile Script : "); for (File dep : modelManager.getDependencyWurstFiles()) {