|
2 | 2 |
|
3 | 3 | import com.google.common.base.Charsets; |
4 | 4 | import com.google.common.base.Preconditions; |
5 | | -import com.google.common.collect.ImmutableList; |
6 | 5 | import com.google.common.collect.Lists; |
7 | 6 | import com.google.common.collect.Maps; |
8 | 7 | import com.google.common.collect.Sets; |
|
41 | 40 |
|
42 | 41 | import java.io.*; |
43 | 42 | import java.lang.ref.WeakReference; |
44 | | -import java.nio.charset.StandardCharsets; |
45 | 43 | import java.util.*; |
46 | 44 | import java.util.Map.Entry; |
47 | 45 | import java.util.function.Function; |
@@ -148,49 +146,12 @@ public void loadWurstFilesInDir(File dir) { |
148 | 146 | loadWurstFilesInDir(f); |
149 | 147 | } else if (Utils.isWurstFile(f)) { |
150 | 148 | loadFile(f); |
151 | | - } else if (f.getName().equals("wurst.dependencies")) { |
152 | | - dependencies.addAll(checkDependencyFile(f, gui)); |
153 | 149 | } else if ((!mapFile.isPresent() || runArgs.isNoExtractMapScript()) && f.getName().equals("war3map.j")) { |
154 | 150 | loadFile(f); |
155 | 151 | } |
156 | 152 | } |
157 | 153 | } |
158 | 154 |
|
159 | | - public static ImmutableList<File> checkDependencyFile(File depFile, WurstGui gui) { |
160 | | - List<String> lines; |
161 | | - try { |
162 | | - lines = Files.readLines(depFile, StandardCharsets.UTF_8); |
163 | | - } catch (IOException e) { |
164 | | - e.printStackTrace(); |
165 | | - throw new Error(e); |
166 | | - } |
167 | | - LineOffsets offsets = new LineOffsets(); |
168 | | - int lineNr = 0; |
169 | | - int offset = 0; |
170 | | - for (String line : lines) { |
171 | | - offsets.set(lineNr, offset); |
172 | | - lineNr++; |
173 | | - offset += line.length() + 1; |
174 | | - } |
175 | | - offsets.set(lineNr, offset); |
176 | | - lineNr = 0; |
177 | | - ImmutableList.Builder<File> dependencies = ImmutableList.builder(); |
178 | | - for (String line : lines) { |
179 | | - int lineOffset = offsets.get(lineNr); |
180 | | - WPos pos = new WPos(depFile.getAbsolutePath(), offsets, lineOffset + 1, lineOffset + line.length() + 1); |
181 | | - File folder = new File(line); |
182 | | - if (!folder.exists()) { |
183 | | - gui.sendError(new CompileError(pos, "Folder " + line + " not found.")); |
184 | | - } else if (!folder.isDirectory()) { |
185 | | - gui.sendError(new CompileError(pos, line + " is not a folder.")); |
186 | | - } else { |
187 | | - dependencies.add(folder); |
188 | | - } |
189 | | - lineNr++; |
190 | | - } |
191 | | - return dependencies.build(); |
192 | | - } |
193 | | - |
194 | 155 | @Override |
195 | 156 | public @Nullable WurstModel parseFiles() { |
196 | 157 |
|
@@ -220,10 +181,6 @@ public static ImmutableList<File> checkDependencyFile(File depFile, WurstGui gui |
220 | 181 | } else { |
221 | 182 | WLogger.info("No wurst folder found in " + relativeWurstDir); |
222 | 183 | } |
223 | | - File dependencyFile = new File(projectFolder, "wurst.dependencies"); |
224 | | - if (dependencyFile.exists()) { |
225 | | - dependencies.addAll(checkDependencyFile(dependencyFile, gui)); |
226 | | - } |
227 | 184 | addDependenciesFromFolder(projectFolder, dependencies); |
228 | 185 | } |
229 | 186 |
|
@@ -373,7 +330,7 @@ private void resolveImport(Function<File, CompilationUnit> addCompilationUnit, S |
373 | 330 | private CompilationUnit loadLibPackage(Function<File, CompilationUnit> addCompilationUnit, String imp) { |
374 | 331 | File file = getLibs().get(imp); |
375 | 332 | if (file == null) { |
376 | | - gui.sendError(new CompileError(new WPos("", null, 0, 0), "Could not find lib-package " + imp + ". Are you missing your wurst.dependencies file?")); |
| 333 | + gui.sendError(new CompileError(new WPos("", null, 0, 0), "Could not find lib-package " + imp + ". Is your dependency present in _build/dependencies?")); |
377 | 334 | return Ast.CompilationUnit(new CompilationUnitInfo(errorHandler), Ast.JassToplevelDeclarations(), Ast.WPackages()); |
378 | 335 | } else { |
379 | 336 | return addCompilationUnit.apply(file); |
|
0 commit comments