Skip to content

Commit 3a020f4

Browse files
committed
Update bob builder to support multi module programs
Signed-off-by: worksofliam <[email protected]>
1 parent c0ad8c8 commit 3a020f4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cli/src/builders/bob.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,18 @@ export class BobProject {
1515
let list: DirectoryTargets = {};
1616

1717
for (let target of targets.getTargets()) {
18+
let dirname: string|undefined;
1819
if (target.relativePath) {
19-
const dirname = path.dirname(target.relativePath);
20+
dirname = path.dirname(target.relativePath);
21+
} else if (target.type === `PGM`) {
22+
// If there is no relative path, this might mean it's a multimodule program
23+
const possibleModule = targets.getTarget({systemName: target.systemName, type: `MODULE`});
24+
if (possibleModule) {
25+
dirname = path.dirname(possibleModule.relativePath);
26+
}
27+
}
28+
29+
if (dirname) {
2030
if (list[dirname] === undefined) list[dirname] = [];
2131

2232
list[dirname].push(target);
@@ -85,7 +95,7 @@ class RulesFile {
8595

8696
const existingLine = this.parsed.find(r => r.target === objName && r.isUserWritten !== true);
8797

88-
const lineContent = `${path.relative(this.subdir, target.relativePath)} ${target.headers ? target.headers.join(` `) + ` ` : ``}${target.deps.filter(d => d.reference !== true).map(d => `${d.systemName}.${d.type}`).join(` `)}`.trimEnd();
98+
const lineContent = `${target.relativePath ? path.relative(this.subdir, target.relativePath) + ' ' : ``}${target.headers ? target.headers.join(` `) + ` ` : ``}${target.deps.filter(d => d.reference !== true).map(d => `${d.systemName}.${d.type}`).join(` `)}`.trimEnd();
8999

90100
if (existingLine) {
91101
existingLine.ogLine = `${objName}: ${lineContent}`;

0 commit comments

Comments
 (0)