Skip to content

Commit 2477159

Browse files
committed
Do not schedule updating bundle if the buildInfo file wont be generated for the project
Fixes #30346
1 parent ab81536 commit 2477159

File tree

3 files changed

+776
-8
lines changed

3 files changed

+776
-8
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

0 commit comments

Comments
 (0)