Skip to content

Commit

Permalink
Do not list output files that just change their modified time when us…
Browse files Browse the repository at this point in the history
…ing --listEmittedFiles (#35714)

* Baseline incremental scenarios for listEmittedFiles

* Do not list output file that just changes modified time stamp as emitted file
Fixes #35605
  • Loading branch information
sheetalkamat committed Dec 18, 2019
1 parent 8c1900c commit 8535076
Show file tree
Hide file tree
Showing 6 changed files with 586 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/compiler/tsbuildPublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,6 @@ namespace ts {
}

host.setModifiedTime(file, now);
listEmittedFile(state, proj, file);
}
}

Expand Down
30 changes: 18 additions & 12 deletions src/testRunner/unittests/tsbuild/sample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,33 @@ export class cNew {}`);
});
});

const coreChanges: TscIncremental[] = [
{
buildKind: BuildKind.IncrementalDtsChange,
modifyFs: fs => appendText(fs, "/src/core/index.ts", `
export class someClass { }`),
},
{
buildKind: BuildKind.IncrementalDtsUnchanged,
modifyFs: fs => appendText(fs, "/src/core/index.ts", `
class someClass { }`),
}
];

describe("lists files", () => {
verifyTsc({
verifyTscIncrementalEdits({
scenario: "sample1",
subScenario: "listFiles",
fs: () => projFs,
commandLineArgs: ["--b", "/src/tests", "--listFiles"],
incrementalScenarios: coreChanges
});
verifyTsc({
verifyTscIncrementalEdits({
scenario: "sample1",
subScenario: "listEmittedFiles",
fs: () => projFs,
commandLineArgs: ["--b", "/src/tests", "--listEmittedFiles"],
incrementalScenarios: coreChanges
});
});

Expand All @@ -382,16 +397,7 @@ export class cNew {}`);
baselineSourceMap: true,
baselineReadFileCalls: true,
incrementalScenarios: [
{
buildKind: BuildKind.IncrementalDtsChange,
modifyFs: fs => appendText(fs, "/src/core/index.ts", `
export class someClass { }`),
},
{
buildKind: BuildKind.IncrementalDtsUnchanged,
modifyFs: fs => appendText(fs, "/src/core/index.ts", `
class someClass { }`),
},
...coreChanges,
{
subScenario: "when logic config changes declaration dir",
buildKind: BuildKind.IncrementalDtsChange,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
//// [/lib/incremental-declaration-changesOutput.txt]
/lib/tsc --b /src/tests --listEmittedFiles
TSFILE: /src/core/index.js
TSFILE: /src/core/index.d.ts.map
TSFILE: /src/core/index.d.ts
TSFILE: /src/core/tsconfig.tsbuildinfo
TSFILE: /src/logic/index.js.map
TSFILE: /src/logic/index.js
TSFILE: /src/logic/index.d.ts
TSFILE: /src/logic/tsconfig.tsbuildinfo
TSFILE: /src/tests/index.js
TSFILE: /src/tests/index.d.ts
TSFILE: /src/tests/tsconfig.tsbuildinfo
exitCode:: ExitStatus.Success


//// [/src/core/index.d.ts]
export declare const someString: string;
export declare function leftPad(s: string, n: number): string;
export declare function multiply(a: number, b: number): number;
export declare class someClass {
}
//# sourceMappingURL=index.d.ts.map

//// [/src/core/index.d.ts.map]
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAEhE,qBAAa,SAAS;CAAI"}

//// [/src/core/index.js]
"use strict";
exports.__esModule = true;
exports.someString = "HELLO WORLD";
function leftPad(s, n) { return s + n; }
exports.leftPad = leftPad;
function multiply(a, b) { return a * b; }
exports.multiply = multiply;
var someClass = /** @class */ (function () {
function someClass() {
}
return someClass;
}());
exports.someClass = someClass;


//// [/src/core/index.ts]
export const someString: string = "HELLO WORLD";
export function leftPad(s: string, n: number) { return s + n; }
export function multiply(a: number, b: number) { return a * b; }

export class someClass { }

//// [/src/core/tsconfig.tsbuildinfo]
{
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"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; };",
"signature": "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; };"
},
"./anothermodule.ts": {
"version": "-2676574883-export const World = \"hello\";\r\n",
"signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map"
},
"./index.ts": {
"version": "-13387000654-export const someString: string = \"HELLO WORLD\";\r\nexport function leftPad(s: string, n: number) { return s + n; }\r\nexport function multiply(a: number, b: number) { return a * b; }\r\n\nexport class someClass { }",
"signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map"
},
"./some_decl.d.ts": {
"version": "-9253692965-declare const dts: any;\r\n",
"signature": "-9253692965-declare const dts: any;\r\n"
}
},
"options": {
"composite": true,
"declaration": true,
"declarationMap": true,
"skipDefaultLibCheck": true,
"listEmittedFiles": true,
"configFilePath": "./tsconfig.json"
},
"referencedMap": {},
"exportedModulesMap": {},
"semanticDiagnosticsPerFile": [
"../../lib/lib.d.ts",
"./anothermodule.ts",
"./index.ts",
"./some_decl.d.ts"
]
},
"version": "FakeTSVersion"
}

//// [/src/logic/index.d.ts] file written with same contents
//// [/src/logic/index.js] file written with same contents
//// [/src/logic/index.js.map] file written with same contents
//// [/src/logic/tsconfig.tsbuildinfo]
{
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"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; };",
"signature": "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; };"
},
"../core/index.ts": {
"version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map",
"signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map"
},
"../core/anothermodule.ts": {
"version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map",
"signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map"
},
"./index.ts": {
"version": "-5786964698-import * as c from '../core/index';\r\nexport function getSecondsInDay() {\r\n return c.multiply(10, 15);\r\n}\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n",
"signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n"
}
},
"options": {
"composite": true,
"declaration": true,
"sourceMap": true,
"forceConsistentCasingInFileNames": true,
"skipDefaultLibCheck": true,
"listEmittedFiles": true,
"configFilePath": "./tsconfig.json"
},
"referencedMap": {
"./index.ts": [
"../core/anothermodule.d.ts",
"../core/index.d.ts"
]
},
"exportedModulesMap": {
"./index.ts": [
"../core/anothermodule.d.ts"
]
},
"semanticDiagnosticsPerFile": [
"../../lib/lib.d.ts",
"../core/anothermodule.ts",
"../core/index.ts",
"./index.ts"
]
},
"version": "FakeTSVersion"
}

//// [/src/tests/index.d.ts] file written with same contents
//// [/src/tests/index.js] file written with same contents
//// [/src/tests/tsconfig.tsbuildinfo]
{
"program": {
"fileInfos": {
"../../lib/lib.d.ts": {
"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; };",
"signature": "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; };"
},
"../core/index.ts": {
"version": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map",
"signature": "-2069755619-export declare const someString: string;\r\nexport declare function leftPad(s: string, n: number): string;\r\nexport declare function multiply(a: number, b: number): number;\r\nexport declare class someClass {\r\n}\r\n//# sourceMappingURL=index.d.ts.map"
},
"../core/anothermodule.ts": {
"version": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map",
"signature": "7652028357-export declare const World = \"hello\";\r\n//# sourceMappingURL=anotherModule.d.ts.map"
},
"../logic/index.ts": {
"version": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n",
"signature": "-6548680073-export declare function getSecondsInDay(): number;\r\nimport * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n"
},
"./index.ts": {
"version": "12336236525-import * as c from '../core/index';\r\nimport * as logic from '../logic/index';\r\n\r\nc.leftPad(\"\", 10);\r\nlogic.getSecondsInDay();\r\n\r\nimport * as mod from '../core/anotherModule';\r\nexport const m = mod;\r\n",
"signature": "-9209611-import * as mod from '../core/anotherModule';\r\nexport declare const m: typeof mod;\r\n"
}
},
"options": {
"composite": true,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"skipDefaultLibCheck": true,
"listEmittedFiles": true,
"configFilePath": "./tsconfig.json"
},
"referencedMap": {
"../logic/index.ts": [
"../core/anothermodule.d.ts"
],
"./index.ts": [
"../core/anothermodule.d.ts",
"../core/index.d.ts",
"../logic/index.d.ts"
]
},
"exportedModulesMap": {
"../logic/index.ts": [
"../core/anothermodule.d.ts"
],
"./index.ts": [
"../core/anothermodule.d.ts"
]
},
"semanticDiagnosticsPerFile": [
"../../lib/lib.d.ts",
"../core/anothermodule.ts",
"../core/index.ts",
"../logic/index.ts",
"./index.ts"
]
},
"version": "FakeTSVersion"
}

Loading

0 comments on commit 8535076

Please sign in to comment.