mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #34487 from microsoft/skipTsBuildinfoEmit
Do not write build info if there are no files to emit
This commit is contained in:
@@ -251,6 +251,7 @@ namespace ts {
|
||||
state.seenAffectedFiles = createMap<true>();
|
||||
}
|
||||
|
||||
state.emittedBuildInfo = !state.changedFilesSet.size && !state.affectedFilesPendingEmit;
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
@@ -169,9 +169,15 @@ namespace ts {
|
||||
Initial = "initial-build",
|
||||
IncrementalDtsChange = "incremental-declaration-changes",
|
||||
IncrementalDtsUnchanged = "incremental-declaration-doesnt-change",
|
||||
IncrementalHeadersChange = "incremental-headers-change-without-dts-changes"
|
||||
IncrementalHeadersChange = "incremental-headers-change-without-dts-changes",
|
||||
NoChangeRun ="no-change-run"
|
||||
}
|
||||
|
||||
export const noChangeRun: TscIncremental = {
|
||||
buildKind: BuildKind.NoChangeRun,
|
||||
modifyFs: noop
|
||||
};
|
||||
|
||||
export interface TscCompile {
|
||||
scenario: string;
|
||||
subScenario: string;
|
||||
|
||||
@@ -17,13 +17,10 @@ namespace ts {
|
||||
}`,
|
||||
}),
|
||||
commandLineArgs: ["--incremental", "--p", "src/project", "--tsBuildInfoFile", "src/project/.tsbuildinfo"],
|
||||
incrementalScenarios: [{
|
||||
buildKind: BuildKind.IncrementalDtsUnchanged,
|
||||
modifyFs: noop,
|
||||
}]
|
||||
incrementalScenarios: [noChangeRun]
|
||||
});
|
||||
|
||||
verifyTsc({
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "incremental",
|
||||
subScenario: "when passing rootDir from commandline",
|
||||
fs: () => loadProjectFromFiles({
|
||||
@@ -37,6 +34,25 @@ namespace ts {
|
||||
}`,
|
||||
}),
|
||||
commandLineArgs: ["--p", "src/project", "--rootDir", "src/project/src"],
|
||||
incrementalScenarios: [noChangeRun]
|
||||
});
|
||||
|
||||
verifyTscIncrementalEdits({
|
||||
scenario: "incremental",
|
||||
subScenario: "with only dts files",
|
||||
fs: () => loadProjectFromFiles({
|
||||
"/src/project/src/main.d.ts": "export const x = 10;",
|
||||
"/src/project/src/another.d.ts": "export const y = 10;",
|
||||
"/src/project/tsconfig.json": "{}",
|
||||
}),
|
||||
commandLineArgs: ["--incremental", "--p", "src/project"],
|
||||
incrementalScenarios: [
|
||||
noChangeRun,
|
||||
{
|
||||
buildKind: BuildKind.IncrementalDtsUnchanged,
|
||||
modifyFs: fs => appendText(fs, "/src/project/src/main.d.ts", "export const xy = 100;")
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
//// [/lib/incremental-declaration-doesnt-changeOutput.txt]
|
||||
/lib/tsc --incremental --p src/project --tsBuildInfoFile src/project/.tsbuildinfo
|
||||
exitCode:: 0
|
||||
|
||||
|
||||
//// [/src/project/.tsbuildinfo] file written with same contents
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
//// [/lib/incremental-declaration-doesnt-changeOutput.txt]
|
||||
/lib/tsc --incremental --p src/project
|
||||
exitCode:: 0
|
||||
|
||||
|
||||
//// [/src/project/src/main.d.ts]
|
||||
export const x = 10;export const xy = 100;
|
||||
|
||||
//// [/src/project/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; };"
|
||||
},
|
||||
"./src/another.d.ts": {
|
||||
"version": "-13729955264-export const y = 10;",
|
||||
"signature": "-13729955264-export const y = 10;"
|
||||
},
|
||||
"./src/main.d.ts": {
|
||||
"version": "-10808461502-export const x = 10;export const xy = 100;",
|
||||
"signature": "-10808461502-export const x = 10;export const xy = 100;"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"incremental": true,
|
||||
"project": "./",
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"./src/another.d.ts",
|
||||
"./src/main.d.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
//// [/lib/initial-buildOutput.txt]
|
||||
/lib/tsc --incremental --p src/project
|
||||
exitCode:: 0
|
||||
|
||||
|
||||
//// [/src/project/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; };"
|
||||
},
|
||||
"./src/another.d.ts": {
|
||||
"version": "-13729955264-export const y = 10;",
|
||||
"signature": "-13729955264-export const y = 10;"
|
||||
},
|
||||
"./src/main.d.ts": {
|
||||
"version": "-10726455937-export const x = 10;",
|
||||
"signature": "-10726455937-export const x = 10;"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"incremental": true,
|
||||
"project": "./",
|
||||
"configFilePath": "./tsconfig.json"
|
||||
},
|
||||
"referencedMap": {},
|
||||
"exportedModulesMap": {},
|
||||
"semanticDiagnosticsPerFile": [
|
||||
"../../lib/lib.d.ts",
|
||||
"./src/another.d.ts",
|
||||
"./src/main.d.ts"
|
||||
]
|
||||
},
|
||||
"version": "FakeTSVersion"
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
//// [/lib/no-change-runOutput.txt]
|
||||
/lib/tsc --incremental --p src/project --tsBuildInfoFile src/project/.tsbuildinfo
|
||||
exitCode:: 0
|
||||
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
//// [/lib/no-change-runOutput.txt]
|
||||
/lib/tsc --p src/project --rootDir src/project/src
|
||||
exitCode:: 0
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [/lib/no-change-runOutput.txt]
|
||||
/lib/tsc --incremental --p src/project
|
||||
exitCode:: 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user