Skip to content

Commit 65b9c74

Browse files
committed
More improvements to partial builds for makefiles
Signed-off-by: worksofliam <[email protected]>
1 parent 298c8de commit 65b9c74

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

cli/src/builders/make/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type PartialOptions = { partial: boolean, parents: boolean };
2828

2929
interface PartialTargets {
3030
partial: ILEObject[];
31-
children: ILEObject[];
31+
children?: ILEObject[];
3232
}
3333

3434
export class MakeProject {
@@ -231,7 +231,7 @@ export class MakeProject {
231231
* If `parents` is true, it will return all parent objects of the partial build objects, and their children/
232232
*/
233233
private getPartialTargets(partialBuild?: ILEObject[]): PartialTargets|undefined {
234-
if (!partialBuild) {
234+
if (partialBuild === undefined) {
235235
return;
236236
}
237237

@@ -288,9 +288,9 @@ export class MakeProject {
288288
)
289289
}
290290

291-
if (buildObjects) {
291+
if (buildObjects && buildObjects.children) {
292292
// If we don't want the children to get built, we only generate the targets for the specific objects
293-
for (const obj of buildObjects.children || []) {
293+
for (const obj of buildObjects.children) {
294294
if (obj.reference) continue; // Skip references
295295

296296
const target = this.targets.getTarget(obj);
@@ -376,7 +376,7 @@ export class MakeProject {
376376
for (const ileObject of objects) {
377377
if (ileObject.reference) continue;
378378

379-
if (buildObjects && !buildObjects.children.some(o => o.systemName === ileObject.systemName && o.type === ileObject.type)) {
379+
if (buildObjects && buildObjects.children && !buildObjects.children.some(o => o.systemName === ileObject.systemName && o.type === ileObject.type)) {
380380
continue; // Skip this object
381381
}
382382

cli/src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ export let cliSettings = {
88
withActions: false,
99
fixIncludes: false,
1010
autoRename: false,
11-
fileList: false,
12-
lookupFiles: [] as string[],
11+
lookupFiles: undefined as string[]|undefined,
1312
userBranch: ``,
13+
makefileIsPartial: false,
1414
makefileWithParents: false,
1515
assumeSourcesArePrograms: false,
1616
};

cli/src/index.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ async function main() {
6767
warningOut(`--no-children is deprecated and is default when doing partial builds.`);
6868
break;
6969

70+
case `-ip`:
71+
case `--is-partial`:
72+
cliSettings.makefileIsPartial = true;
73+
break;
74+
7075
case `-wp`:
7176
case `--with-parents`:
7277
cliSettings.makefileWithParents = true;
@@ -84,7 +89,7 @@ async function main() {
8489
case `-f`:
8590
case `--files`:
8691
case `-l`:
87-
cliSettings.fileList = true;
92+
cliSettings.lookupFiles = [];
8893
break;
8994

9095
case `-h`:
@@ -132,6 +137,10 @@ async function main() {
132137
console.log(``);
133138
console.log(`Options specific to '-bf make':`);
134139
console.log(``);
140+
console.log(`\t-ip`);
141+
console.log(`\t--is-partial\tWill only generate targets that are needed for`);
142+
console.log(`\t\t\tthe objects that are being built.`);
143+
console.log(``);
135144
console.log(`\t-wp`);
136145
console.log(`\t--with-parents\tUsed with '-bf make' and will add parents of`);
137146
console.log(`\t\t\tobjects being partially built to the makefile.`);
@@ -140,7 +149,7 @@ async function main() {
140149
break;
141150

142151
default:
143-
if (cliSettings.fileList) {
152+
if (cliSettings.lookupFiles !== undefined) {
144153
cliSettings.lookupFiles.push(parms[i]);
145154
}
146155
break;
@@ -237,9 +246,12 @@ async function main() {
237246

238247
await makeProj.setupSettings();
239248

240-
makeProj.setPartialWithImpacts(cliSettings.makefileWithParents);
249+
makeProj.setPartialOptions({
250+
partial: cliSettings.makefileIsPartial,
251+
parents: cliSettings.makefileWithParents
252+
})
241253

242-
let specificObjects: ILEObject[] | undefined = cliSettings.fileList ? cliSettings.lookupFiles.map(f => targets.getResolvedObject(path.join(cwd, f))).filter(o => o) : undefined;
254+
let specificObjects: ILEObject[] | undefined = cliSettings.lookupFiles ? cliSettings.lookupFiles.map(f => targets.getResolvedObject(path.join(cwd, f))).filter(o => o) : undefined;
243255
writeFileSync(path.join(cwd, `makefile`), makeProj.getMakefile(specificObjects).join(`\n`));
244256

245257
break;

0 commit comments

Comments
 (0)