mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Merge pull request #25049 from RyanCavanaugh/tsbuild-fixes
Fixes downstream prepend projects not being built correctly on upstream changes
This commit is contained in:
commit
4fafe0b502
@ -204,7 +204,7 @@ task(TaskNames.lint, [TaskNames.buildRules], () => {
|
||||
if (fold.isTravis()) console.log(fold.end("lint"));
|
||||
complete();
|
||||
}));
|
||||
});
|
||||
}, { async: true });
|
||||
|
||||
desc("Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable");
|
||||
task('diff', function () {
|
||||
|
||||
@ -777,6 +777,7 @@ namespace ts {
|
||||
|
||||
let pseudoUpToDate = false;
|
||||
let usesPrepend = false;
|
||||
let upstreamChangedProject: string | undefined;
|
||||
if (project.projectReferences) {
|
||||
for (const ref of project.projectReferences) {
|
||||
usesPrepend = usesPrepend || !!(ref.prepend);
|
||||
@ -809,6 +810,7 @@ namespace ts {
|
||||
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
|
||||
if (refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
|
||||
pseudoUpToDate = true;
|
||||
upstreamChangedProject = ref.path;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -837,8 +839,12 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
if (usesPrepend) {
|
||||
pseudoUpToDate = false;
|
||||
if (usesPrepend && pseudoUpToDate) {
|
||||
return {
|
||||
type: UpToDateStatusType.OutOfDateWithUpstream,
|
||||
outOfDateOutputFileName: oldestOutputFileName,
|
||||
newerProjectName: upstreamChangedProject!
|
||||
};
|
||||
}
|
||||
|
||||
// Up to date
|
||||
|
||||
@ -259,6 +259,23 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - downstream prepend projects always get rebuilt", () => {
|
||||
const fs = outFileFs.shadow();
|
||||
const host = new fakes.CompilerHost(fs);
|
||||
const builder = createSolutionBuilder(host, buildHost, ["/src/third"], { dry: false, force: false, verbose: false });
|
||||
clearDiagnostics();
|
||||
builder.buildAllProjects();
|
||||
assertDiagnosticMessages(/*none*/);
|
||||
assert.equal(fs.statSync("src/third/thirdjs/output/third-output.js").mtimeMs, time(), "First build timestamp is correct");
|
||||
tick();
|
||||
replaceText(fs, "src/first/first_PART1.ts", "Hello", "Hola");
|
||||
tick();
|
||||
builder.resetBuildContext();
|
||||
builder.buildAllProjects();
|
||||
assertDiagnosticMessages(/*none*/);
|
||||
assert.equal(fs.statSync("src/third/thirdjs/output/third-output.js").mtimeMs, time(), "Second build timestamp is correct");
|
||||
});
|
||||
}
|
||||
|
||||
describe("tsbuild - graph-ordering", () => {
|
||||
|
||||
@ -9,6 +9,11 @@
|
||||
"declaration": true,
|
||||
"outFile": "./bin/first-output.js"
|
||||
},
|
||||
"files": [
|
||||
"first_PART1.ts",
|
||||
"first_part2.ts",
|
||||
"first_part3.ts"
|
||||
],
|
||||
"references": [
|
||||
]
|
||||
}
|
||||
|
||||
@ -9,6 +9,9 @@
|
||||
"declaration": true,
|
||||
"outFile": "./thirdjs/output/third-output.js"
|
||||
},
|
||||
"files": [
|
||||
"third_part1.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../first", "prepend": true },
|
||||
{ "path": "../second", "prepend": true },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user