Skip to content

Commit 1a8abac

Browse files
committed
No need to update output timestamps if buildinfo will determine uptodateness
1 parent 7cb0f40 commit 1a8abac

File tree

63 files changed

+466
-1037
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+466
-1037
lines changed

src/compiler/tsbuildPublic.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -1660,26 +1660,30 @@ namespace ts {
16601660

16611661
function updateOutputTimestampsWorker(state: SolutionBuilderState, proj: ParsedCommandLine, anyDtsChange: boolean, verboseMessage: DiagnosticMessage, newestDeclarationFileContentChangedTime?: Date, skipOutputs?: ESMap<Path, string>) {
16621662
if (proj.options.noEmit) return undefined;
1663+
1664+
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(proj.options);
16631665
const { host } = state;
16641666
const outputs = getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
16651667
if (!skipOutputs || outputs.length !== skipOutputs.size) {
16661668
let reportVerbose = !!state.options.verbose;
1667-
const now = host.now ? host.now() : new Date();
1669+
let now: Date | undefined;
16681670
for (const file of outputs) {
16691671
if (skipOutputs && skipOutputs.has(toPath(state, file))) {
16701672
continue;
16711673
}
16721674

1673-
if (reportVerbose) {
1674-
reportVerbose = false;
1675-
reportStatus(state, verboseMessage, proj.options.configFilePath!);
1676-
}
1677-
16781675
if (!anyDtsChange && isDeclarationFileName(file)) {
16791676
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, ts.getModifiedTime(host, file));
16801677
}
16811678

1682-
host.setModifiedTime(file, now);
1679+
if (!buildInfoPath || file === buildInfoPath) {
1680+
if (reportVerbose) {
1681+
reportVerbose = false;
1682+
reportStatus(state, verboseMessage, proj.options.configFilePath!);
1683+
}
1684+
1685+
host.setModifiedTime(file, now ||= host.now ? host.now() : new Date());
1686+
}
16831687
}
16841688
}
16851689

src/testRunner/unittests/tsbuild/sample.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@ export class someClass { }`),
367367
subScenario: "incremental-declaration-doesnt-change",
368368
modifyFs: fs => appendText(fs, "/src/core/index.ts", `
369369
class someClass2 { }`),
370-
}
370+
},
371+
noChangeRun,
371372
];
372373

373374
describe("lists files", () => {

tests/baselines/reference/tsbuild/amdModulesWithOut/modules-and-globals-mixed-in-amd.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -996,8 +996,6 @@ Output::
996996

997997
[12:00:41 AM] Updating output of project '/src/app/tsconfig.json'...
998998

999-
[12:00:46 AM] Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
1000-
1001999
exitCode:: ExitStatus.Success
10021000

10031001
getModifiedTime:: {
@@ -1014,10 +1012,7 @@ getModifiedTime:: {
10141012
"/src/app/module.d.ts": 1
10151013
}
10161014

1017-
setModifiedTime:: {
1018-
"/src/app/module.d.ts": 1,
1019-
"/src/app/module.d.ts.map": 1
1020-
}
1015+
setModifiedTime:: {}
10211016

10221017
fileExists:: {
10231018
"/src/lib/module.js": 1,
@@ -1033,8 +1028,6 @@ directoryExists:: {
10331028
}
10341029

10351030

1036-
//// [/src/app/module.d.ts] file changed its modified time
1037-
//// [/src/app/module.d.ts.map] file changed its modified time
10381031
//// [/src/app/module.js]
10391032
var myGlob = 20;
10401033
define("file1", ["require", "exports"], function (require, exports) {

tests/baselines/reference/tsbuild/amdModulesWithOut/multiple-emitHelpers-in-all-projects.js

+7-21
Original file line numberDiff line numberDiff line change
@@ -2173,8 +2173,6 @@ Output::
21732173

21742174
[12:00:47 AM] Updating output of project '/src/app/tsconfig.json'...
21752175

2176-
[12:00:52 AM] Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
2177-
21782176
exitCode:: ExitStatus.Success
21792177

21802178
getModifiedTime:: {
@@ -2191,10 +2189,7 @@ getModifiedTime:: {
21912189
"/src/app/module.d.ts": 1
21922190
}
21932191

2194-
setModifiedTime:: {
2195-
"/src/app/module.d.ts": 1,
2196-
"/src/app/module.d.ts.map": 1
2197-
}
2192+
setModifiedTime:: {}
21982193

21992194
fileExists:: {
22002195
"/src/lib/module.js": 1,
@@ -2210,8 +2205,6 @@ directoryExists:: {
22102205
}
22112206

22122207

2213-
//// [/src/app/module.d.ts] file changed its modified time
2214-
//// [/src/app/module.d.ts.map] file changed its modified time
22152208
//// [/src/app/module.js]
22162209
var __read = (this && this.__read) || function (o, n) {
22172210
var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -3810,19 +3803,17 @@ export const x = 10;function forlibfile1Rest() { }console.log(x);
38103803

38113804
Output::
38123805
/lib/tsc --b /src/app --verbose
3813-
[[90m12:01:01 AM[0m] Projects in this build:
3806+
[[90m12:00:57 AM[0m] Projects in this build:
38143807
* src/lib/tsconfig.json
38153808
* src/app/tsconfig.json
38163809

3817-
[[90m12:01:02 AM[0m] Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.tsbuildinfo' is older than newest input 'src/lib/file1.ts'
3810+
[[90m12:00:58 AM[0m] Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.tsbuildinfo' is older than newest input 'src/lib/file1.ts'
38183811

3819-
[[90m12:01:03 AM[0m] Building project '/src/lib/tsconfig.json'...
3812+
[[90m12:00:59 AM[0m] Building project '/src/lib/tsconfig.json'...
38203813

3821-
[[90m12:01:11 AM[0m] Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed
3814+
[[90m12:01:07 AM[0m] Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed
38223815

3823-
[12:01:12 AM] Updating output of project '/src/app/tsconfig.json'...
3824-
3825-
[12:01:17 AM] Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
3816+
[12:01:08 AM] Updating output of project '/src/app/tsconfig.json'...
38263817

38273818
exitCode:: ExitStatus.Success
38283819

@@ -3840,10 +3831,7 @@ getModifiedTime:: {
38403831
"/src/app/module.d.ts": 1
38413832
}
38423833

3843-
setModifiedTime:: {
3844-
"/src/app/module.d.ts": 1,
3845-
"/src/app/module.d.ts.map": 1
3846-
}
3834+
setModifiedTime:: {}
38473835

38483836
fileExists:: {
38493837
"/src/lib/module.js": 1,
@@ -3859,8 +3847,6 @@ directoryExists:: {
38593847
}
38603848

38613849

3862-
//// [/src/app/module.d.ts] file changed its modified time
3863-
//// [/src/app/module.d.ts.map] file changed its modified time
38643850
//// [/src/app/module.js]
38653851
var __read = (this && this.__read) || function (o, n) {
38663852
var m = typeof Symbol === "function" && o[Symbol.iterator];

tests/baselines/reference/tsbuild/amdModulesWithOut/multiple-prologues-in-all-projects.js

+7-19
Original file line numberDiff line numberDiff line change
@@ -1282,8 +1282,6 @@ Output::
12821282

12831283
[12:00:48 AM] Updating output of project '/src/app/tsconfig.json'...
12841284

1285-
[12:00:53 AM] Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
1286-
12871285
exitCode:: ExitStatus.Success
12881286

12891287
getModifiedTime:: {
@@ -1300,10 +1298,7 @@ getModifiedTime:: {
13001298
"/src/app/module.d.ts": 1
13011299
}
13021300

1303-
setModifiedTime:: {
1304-
"/src/app/module.d.ts": 1,
1305-
"/src/app/module.d.ts.map": 1
1306-
}
1301+
setModifiedTime:: {}
13071302

13081303
fileExists:: {
13091304
"/src/lib/module.js": 1,
@@ -1319,8 +1314,6 @@ directoryExists:: {
13191314
}
13201315

13211316

1322-
//// [/src/app/module.d.ts] file changed its modified time
1323-
//// [/src/app/module.d.ts.map] file changed its modified time
13241317
//// [/src/app/module.js]
13251318
"use strict";
13261319
"myPrologue";
@@ -2191,19 +2184,17 @@ export const x = 10;console.log(x);
21912184

21922185
Output::
21932186
/lib/tsc --b /src/app --verbose
2194-
[[90m12:01:02 AM[0m] Projects in this build:
2187+
[[90m12:00:58 AM[0m] Projects in this build:
21952188
* src/lib/tsconfig.json
21962189
* src/app/tsconfig.json
21972190

2198-
[12:01:03 AM] Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.tsbuildinfo' is older than newest input 'src/lib/file1.ts'
2199-
2200-
[12:01:04 AM] Building project '/src/lib/tsconfig.json'...
2191+
[12:00:59 AM] Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.tsbuildinfo' is older than newest input 'src/lib/file1.ts'
22012192

2202-
[[90m12:01:12 AM[0m] Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed
2193+
[[90m12:01:00 AM[0m] Building project '/src/lib/tsconfig.json'...
22032194

2204-
[[90m12:01:13 AM[0m] Updating output of project '/src/app/tsconfig.json'...
2195+
[[90m12:01:08 AM[0m] Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed
22052196

2206-
[[90m12:01:19 AM[0m] Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
2197+
[[90m12:01:09 AM[0m] Updating output of project '/src/app/tsconfig.json'...
22072198

22082199
exitCode:: ExitStatus.Success
22092200

@@ -2221,9 +2212,7 @@ getModifiedTime:: {
22212212
"/src/app/module.d.ts": 1
22222213
}
22232214

2224-
setModifiedTime:: {
2225-
"/src/app/module.d.ts": 1
2226-
}
2215+
setModifiedTime:: {}
22272216

22282217
fileExists:: {
22292218
"/src/lib/module.js": 1,
@@ -2239,7 +2228,6 @@ directoryExists:: {
22392228
}
22402229

22412230

2242-
//// [/src/app/module.d.ts] file changed its modified time
22432231
//// [/src/app/module.d.ts.map]
22442232
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../lib/file0.ts","../lib/file1.ts","../lib/file2.ts","../lib/global.ts","file3.ts","file4.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC;;ICAvB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,KAAK,KAAK,CAAC"}
22452233

tests/baselines/reference/tsbuild/amdModulesWithOut/shebang-in-all-projects.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,6 @@ Output::
10181018

10191019
[12:00:44 AM] Updating output of project '/src/app/tsconfig.json'...
10201020

1021-
[12:00:49 AM] Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
1022-
10231021
exitCode:: ExitStatus.Success
10241022

10251023
getModifiedTime:: {
@@ -1036,10 +1034,7 @@ getModifiedTime:: {
10361034
"/src/app/module.d.ts": 1
10371035
}
10381036

1039-
setModifiedTime:: {
1040-
"/src/app/module.d.ts": 1,
1041-
"/src/app/module.d.ts.map": 1
1042-
}
1037+
setModifiedTime:: {}
10431038

10441039
fileExists:: {
10451040
"/src/lib/module.js": 1,
@@ -1055,8 +1050,6 @@ directoryExists:: {
10551050
}
10561051

10571052

1058-
//// [/src/app/module.d.ts] file changed its modified time
1059-
//// [/src/app/module.d.ts.map] file changed its modified time
10601053
//// [/src/app/module.js]
10611054
#!someshebang lib file0
10621055
var myGlob = 20;

tests/baselines/reference/tsbuild/amdModulesWithOut/stripInternal.js

+6-13
Original file line numberDiff line numberDiff line change
@@ -4923,8 +4923,6 @@ Output::
49234923

49244924
[12:00:44 AM] Updating output of project '/src/app/tsconfig.json'...
49254925

4926-
[12:00:49 AM] Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
4927-
49284926
exitCode:: ExitStatus.Success
49294927

49304928
getModifiedTime:: {
@@ -4941,10 +4939,7 @@ getModifiedTime:: {
49414939
"/src/app/module.d.ts": 1
49424940
}
49434941

4944-
setModifiedTime:: {
4945-
"/src/app/module.d.ts": 1,
4946-
"/src/app/module.d.ts.map": 1
4947-
}
4942+
setModifiedTime:: {}
49484943

49494944
fileExists:: {
49504945
"/src/lib/module.js": 1,
@@ -4960,8 +4955,6 @@ directoryExists:: {
49604955
}
49614956

49624957

4963-
//// [/src/app/module.d.ts] file changed its modified time
4964-
//// [/src/app/module.d.ts.map] file changed its modified time
49654958
//// [/src/app/module.js]
49664959
/*@internal*/ var myGlob = 20;
49674960
define("file1", ["require", "exports"], function (require, exports) {
@@ -8751,17 +8744,17 @@ export namespace normalN {
87518744

87528745
Output::
87538746
/lib/tsc --b /src/app --verbose
8754-
[12:00:58 AM] Projects in this build:
8747+
[12:00:54 AM] Projects in this build:
87558748
* src/lib/tsconfig.json
87568749
* src/app/tsconfig.json
87578750

8758-
[12:00:59 AM] Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.tsbuildinfo' is older than newest input 'src/lib/file1.ts'
8751+
[12:00:55 AM] Project 'src/lib/tsconfig.json' is out of date because oldest output 'src/lib/module.tsbuildinfo' is older than newest input 'src/lib/file1.ts'
87598752

8760-
[12:01:00 AM] Building project '/src/lib/tsconfig.json'...
8753+
[12:00:56 AM] Building project '/src/lib/tsconfig.json'...
87618754

8762-
[12:01:08 AM] Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed
8755+
[12:01:04 AM] Project 'src/app/tsconfig.json' is out of date because output of its dependency 'src/lib' has changed
87638756

8764-
[12:01:09 AM] Updating output of project '/src/app/tsconfig.json'...
8757+
[12:01:05 AM] Updating output of project '/src/app/tsconfig.json'...
87658758

87668759
exitCode:: ExitStatus.Success
87678760

tests/baselines/reference/tsbuild/amdModulesWithOut/triple-slash-refs-in-all-projects.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -1233,8 +1233,6 @@ Output::
12331233

12341234
[12:00:45 AM] Updating output of project '/src/app/tsconfig.json'...
12351235

1236-
[12:00:50 AM] Updating unchanged output timestamps of project '/src/app/tsconfig.json'...
1237-
12381236
exitCode:: ExitStatus.Success
12391237

12401238
getModifiedTime:: {
@@ -1253,10 +1251,7 @@ getModifiedTime:: {
12531251
"/src/app/module.d.ts": 1
12541252
}
12551253

1256-
setModifiedTime:: {
1257-
"/src/app/module.d.ts": 1,
1258-
"/src/app/module.d.ts.map": 1
1259-
}
1254+
setModifiedTime:: {}
12601255

12611256
fileExists:: {
12621257
"/src/lib/module.js": 1,
@@ -1272,8 +1267,6 @@ directoryExists:: {
12721267
}
12731268

12741269

1275-
//// [/src/app/module.d.ts] file changed its modified time
1276-
//// [/src/app/module.d.ts.map] file changed its modified time
12771270
//// [/src/app/module.js]
12781271
///<reference path="./tripleRef.d.ts"/>
12791272
var file0Const = new libfile0();

tests/baselines/reference/tsbuild/emitDeclarationOnly/only-dts-output-in-non-circular-imports-project-with-emitDeclarationOnly.js

+4-12
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ Output::
229229

230230
[12:00:23 AM] Building project '/src/tsconfig.json'...
231231

232-
[12:00:28 AM] Updating unchanged output timestamps of project '/src/tsconfig.json'...
233-
234232
exitCode:: ExitStatus.Success
235233

236234
getModifiedTime:: {
@@ -243,12 +241,7 @@ getModifiedTime:: {
243241
"/src/lib/c.d.ts": 1
244242
}
245243

246-
setModifiedTime:: {
247-
"/src/lib/b.d.ts": 1,
248-
"/src/lib/b.d.ts.map": 1,
249-
"/src/lib/c.d.ts": 1,
250-
"/src/lib/c.d.ts.map": 1
251-
}
244+
setModifiedTime:: {}
252245

253246
fileExists:: {
254247
"/src/src/c.ts": 1,
@@ -266,7 +259,6 @@ directoryExists:: {
266259
//// [/src/lib/a.d.ts.map]
267260
{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["../src/a.ts"],"names":[],"mappings":"AAAA,qBAAa,CAAC;IAAG,IAAI,SAAW;CAAE;AAGlC,MAAM,WAAW,CAAC;IAChB,CAAC,EAAE,CAAC,CAAC;CACN"}
268261

269-
//// [/src/lib/b.d.ts] file changed its modified time
270262
//// [/src/tsconfig.tsbuildinfo]
271263
{"program":{"fileNames":["../lib/lib.d.ts","./src/a.ts","./src/c.ts","./src/b.ts"],"fileInfos":[{"version":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"6651905050-export class B { prop = \"hello\"; }\n\nclass C { }\nexport interface A {\n b: B;\n}\n","signature":"-4181862109-export declare class B {\r\n prop: string;\r\n}\r\nexport interface A {\r\n b: B;\r\n}\r\n"},{"version":"429593025-import { A } from \"./a\";\n\nexport interface C {\n a: A;\n}\n","signature":"-2697851509-import { A } from \"./a\";\r\nexport interface C {\r\n a: A;\r\n}\r\n"},{"version":"-2273488249-import { C } from \"./c\";\n\nexport interface B {\n b: C;\n}\n","signature":"20298635505-import { C } from \"./c\";\r\nexport interface B {\r\n b: C;\r\n}\r\n"}],"options":{"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"module":1,"outDir":"./lib","rootDir":"./src","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[3],[2]],"referencedMap":[[4,1],[3,2]],"exportedModulesMap":[[4,1],[3,2]],"semanticDiagnosticsPerFile":[1,2,4,3]},"version":"FakeTSVersion"}
272264

@@ -363,12 +355,12 @@ export interface A {
363355

364356
Output::
365357
/lib/tsc --b /src --verbose
366-
[[90m12:00:35 AM[0m] Projects in this build:
358+
[[90m12:00:29 AM[0m] Projects in this build:
367359
* src/tsconfig.json
368360

369-
[[90m12:00:36 AM[0m] Project 'src/tsconfig.json' is out of date because oldest output 'src/tsconfig.tsbuildinfo' is older than newest input 'src/src/a.ts'
361+
[[90m12:00:30 AM[0m] Project 'src/tsconfig.json' is out of date because oldest output 'src/tsconfig.tsbuildinfo' is older than newest input 'src/src/a.ts'
370362

371-
[[90m12:00:37 AM[0m] Building project '/src/tsconfig.json'...
363+
[[90m12:00:31 AM[0m] Building project '/src/tsconfig.json'...
372364

373365
exitCode:: ExitStatus.Success
374366

0 commit comments

Comments
 (0)