diff options
| author | Michael Williamson <mike@zwobble.org> | 2025-01-11 11:44:45 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2025-01-12 14:32:55 +0000 |
| commit | 0d2ac550c25550f9588ec0a1b5885169260f67d6 (patch) | |
| tree | 68d8b36a98a6d58314bf6e14aba6d8b629805d59 /src/main/java/org/shedlang/compiler/ShedCompiler.java | |
| parent | 7b3405d766195f50bcb69f1c17f07b45fa0516eb (diff) | |
Support local project dependencies
Diffstat (limited to 'src/main/java/org/shedlang/compiler/ShedCompiler.java')
| -rw-r--r-- | src/main/java/org/shedlang/compiler/ShedCompiler.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/main/java/org/shedlang/compiler/ShedCompiler.java b/src/main/java/org/shedlang/compiler/ShedCompiler.java index a57a3386..af47ff5c 100644 --- a/src/main/java/org/shedlang/compiler/ShedCompiler.java +++ b/src/main/java/org/shedlang/compiler/ShedCompiler.java @@ -36,11 +36,24 @@ public class ShedCompiler { ) throws IOException, InterruptedException { var config = ProjectConfig.read(projectRoot); - var sourceRoot = projectRoot.resolve("src"); - - var sourceFilePaths = collectSourceFilePaths(sourceRoot); + // TODO: recursive dependencies + var projectRoots = new ArrayList<Path>(); + projectRoots.add(projectRoot); + for (var dependency : config.dependencies()) { + projectRoots.add(dependency.path()); + } - var untypedNamespaceNodes = parseSource(sourceRoot, sourceFilePaths); + var untypedNamespaceNodes = projectRoots.stream() + .flatMap(root -> { + var sourceRoot = root.resolve("src"); + try { + var sourceFilePaths = collectSourceFilePaths(sourceRoot); + return parseSource(sourceRoot, sourceFilePaths).stream(); + } catch (IOException exception) { + throw new RuntimeException(exception); + } + }) + .toList(); var namespaces = new ArrayList<ShidNamespace>(); |
