diff --git a/Jakefile.js b/Jakefile.js index 633e4f45cb6..7a16c681b6e 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -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 () { diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 80f6d1c1cc8..97b7c0afad7 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -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 diff --git a/src/testRunner/unittests/tsbuild.ts b/src/testRunner/unittests/tsbuild.ts index 2ae034ff673..bd40c7297d9 100644 --- a/src/testRunner/unittests/tsbuild.ts +++ b/src/testRunner/unittests/tsbuild.ts @@ -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", () => { diff --git a/tests/projects/outfile-concat/first/tsconfig.json b/tests/projects/outfile-concat/first/tsconfig.json index 8370f6512b8..f71a8182585 100644 --- a/tests/projects/outfile-concat/first/tsconfig.json +++ b/tests/projects/outfile-concat/first/tsconfig.json @@ -9,6 +9,11 @@ "declaration": true, "outFile": "./bin/first-output.js" }, + "files": [ + "first_PART1.ts", + "first_part2.ts", + "first_part3.ts" + ], "references": [ ] } diff --git a/tests/projects/outfile-concat/third/tsconfig.json b/tests/projects/outfile-concat/third/tsconfig.json index 18c98608db1..fef85ce8927 100644 --- a/tests/projects/outfile-concat/third/tsconfig.json +++ b/tests/projects/outfile-concat/third/tsconfig.json @@ -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 },