Skip to content

Commit 1463b32

Browse files
authored
Merge pull request #30348 from Microsoft/nonIncrementalPrepend
Schedule bundle update only if project supports incremental build
2 parents ddf8fad + 73f6886 commit 1463b32

File tree

4 files changed

+778
-9
lines changed

4 files changed

+778
-9
lines changed

src/compiler/tsbuild.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,9 +1012,9 @@ namespace ts {
10121012
return;
10131013
}
10141014

1015-
const buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend ?
1016-
updateBundle(resolved) : // Fake that files have been built by manipulating prepend and existing output
1017-
buildSingleProject(resolved); // Actual build
1015+
const buildResult = needsBuild(status, resolved) ?
1016+
buildSingleProject(resolved) : // Actual build
1017+
updateBundle(resolved); // Fake that files have been built by manipulating prepend and existing output
10181018
if (buildResult & BuildResultFlags.AnyErrors) return;
10191019

10201020
const { referencingProjectsMap, buildQueue } = getGlobalDependencyGraph();
@@ -1424,9 +1424,10 @@ namespace ts {
14241424
continue;
14251425
}
14261426

1427-
const buildResult = status.type === UpToDateStatusType.OutOfDateWithPrepend && !options.force ?
1428-
updateBundle(next) : // Fake that files have been built by manipulating prepend and existing output
1429-
buildSingleProject(next); // Actual build
1427+
const buildResult = needsBuild(status, next) ?
1428+
buildSingleProject(next) : // Actual build
1429+
updateBundle(next); // Fake that files have been built by manipulating prepend and existing output
1430+
14301431
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
14311432
}
14321433
reportErrorSummary();
@@ -1440,6 +1441,15 @@ namespace ts {
14401441
return anyFailed ? ExitStatus.DiagnosticsPresent_OutputsSkipped : ExitStatus.Success;
14411442
}
14421443

1444+
function needsBuild(status: UpToDateStatus, configFile: ResolvedConfigFileName) {
1445+
if (status.type !== UpToDateStatusType.OutOfDateWithPrepend || options.force) return true;
1446+
const config = parseConfigFile(configFile);
1447+
return !config ||
1448+
config.fileNames.length === 0 ||
1449+
!!config.errors.length ||
1450+
!isIncrementalCompilation(config.options);
1451+
}
1452+
14431453
function reportParseConfigFileDiagnostic(proj: ResolvedConfigFileName) {
14441454
reportAndStoreErrors(proj, [configFileCache.getValue(proj) as Diagnostic]);
14451455
}

src/testRunner/unittests/tsbuild/outFile.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,11 @@ namespace ts {
322322
modifyFs: noop
323323
});
324324

325-
// Verify baseline with build info
325+
// Verify baseline with build info + dts unChanged
326326
verifyOutFileScenario({
327327
scenario: "when final project is not composite but uses project references",
328328
modifyFs: fs => replaceText(fs, sources[project.third][source.config], `"composite": true,`, ""),
329329
ignoreDtsChanged: true,
330-
ignoreDtsUnchanged: true,
331330
baselineOnly: true
332331
});
333332

src/tsc/tsconfig.release.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"declaration": false,
88
"declarationMap": false,
99
"sourceMap": false,
10-
"composite": false
10+
"composite": false,
11+
"incremental": true
1112
},
1213
"files": [
1314
"tsc.ts"

0 commit comments

Comments
 (0)