|
38 | 38 | import java.io.File; |
39 | 39 | import java.nio.file.Paths; |
40 | 40 | import java.util.List; |
| 41 | +import java.util.Map; |
41 | 42 |
|
42 | 43 | public abstract class JavaModulesExtension { |
43 | 44 |
|
@@ -69,18 +70,21 @@ public void directory(String path) { |
69 | 70 | } |
70 | 71 |
|
71 | 72 | public void directory(String path, Action<Directory> action) { |
72 | | - Directory directory = getObjects().newInstance(Directory.class, new File(settings.getRootDir(), path)); |
| 73 | + File modulesDirectory = new File(settings.getRootDir(), path); |
| 74 | + Directory directory = getObjects().newInstance(Directory.class, modulesDirectory); |
73 | 75 | action.execute(directory); |
74 | 76 |
|
75 | | - File[] projectDirs = new File(settings.getRootDir(), path).listFiles(); |
| 77 | + File[] projectDirs = modulesDirectory.listFiles(); |
76 | 78 | if (projectDirs == null) { |
77 | | - throw new RuntimeException("Failed to inspect: " + new File(settings.getRootDir(), path)); |
| 79 | + throw new RuntimeException("Failed to inspect: " + modulesDirectory); |
| 80 | + } |
| 81 | + |
| 82 | + for (Module module : directory.customizedModules.values()) { |
| 83 | + includeModule(module, new File(modulesDirectory, module.getDirectory().get())); |
78 | 84 | } |
79 | 85 |
|
80 | 86 | for (File projectDir : projectDirs) { |
81 | | - if (directory.customizedModules.containsKey(projectDir.getName())) { |
82 | | - includeModule(directory.customizedModules.get(projectDir.getName()), projectDir); |
83 | | - } else { |
| 87 | + if (!directory.customizedModules.containsKey(projectDir.getName())) { |
84 | 88 | includeModule(directory.addModule(projectDir.getName()), projectDir); |
85 | 89 | } |
86 | 90 | } |
|
0 commit comments