mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 12:03:44 -05:00
Remove resetBuildContext
This commit is contained in:
@@ -260,7 +260,6 @@ namespace ts {
|
||||
|
||||
// Currently used for testing but can be made public if needed:
|
||||
/*@internal*/ getBuildOrder(): ReadonlyArray<ResolvedConfigFileName>;
|
||||
/*@internal*/ resetBuildContext(opts?: BuildOptions): void;
|
||||
|
||||
// Testing only
|
||||
/*@internal*/ getUpToDateStatusOfProject(project: string): UpToDateStatus;
|
||||
@@ -337,8 +336,8 @@ namespace ts {
|
||||
const parseConfigFileHost = parseConfigHostFromCompilerHostLike(host);
|
||||
|
||||
// State of the solution
|
||||
let options = defaultOptions;
|
||||
let baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
|
||||
const options = defaultOptions;
|
||||
const baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
|
||||
const resolvedConfigFilePaths = createMap<ResolvedConfigFilePath>();
|
||||
type ConfigFileCacheEntry = ParsedCommandLine | Diagnostic;
|
||||
const configFileCache = createMap() as ConfigFileMap<ConfigFileCacheEntry>;
|
||||
@@ -380,7 +379,6 @@ namespace ts {
|
||||
buildAllProjects,
|
||||
cleanAllProjects,
|
||||
getBuildOrder,
|
||||
resetBuildContext,
|
||||
getUpToDateStatusOfProject,
|
||||
invalidateProject,
|
||||
buildInvalidatedProject,
|
||||
@@ -399,29 +397,6 @@ namespace ts {
|
||||
return resolvedPath;
|
||||
}
|
||||
|
||||
function resetBuildContext(opts?: BuildOptions) {
|
||||
options = opts || defaultOptions;
|
||||
baseCompilerOptions = getCompilerOptionsOfBuildOptions(options);
|
||||
resolvedConfigFilePaths.clear();
|
||||
configFileCache.clear();
|
||||
projectStatus.clear();
|
||||
buildOrder = undefined;
|
||||
buildInfoChecked.clear();
|
||||
|
||||
diagnostics.clear();
|
||||
projectPendingBuild.clear();
|
||||
projectErrorsReported.clear();
|
||||
if (timerToBuildInvalidatedProject) {
|
||||
clearTimeout(timerToBuildInvalidatedProject);
|
||||
timerToBuildInvalidatedProject = undefined;
|
||||
}
|
||||
reportFileChangeDetected = false;
|
||||
clearMap(allWatchedWildcardDirectories, wildCardWatches => clearMap(wildCardWatches, closeFileWatcherOf));
|
||||
clearMap(allWatchedInputFiles, inputFileWatches => clearMap(inputFileWatches, closeFileWatcher));
|
||||
clearMap(allWatchedConfigFiles, closeFileWatcher);
|
||||
builderPrograms.clear();
|
||||
}
|
||||
|
||||
function isParsedCommandLine(entry: ConfigFileCacheEntry): entry is ParsedCommandLine {
|
||||
return !!(entry as ParsedCommandLine).options;
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ namespace ts {
|
||||
...outputFiles[project.third]
|
||||
];
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host);
|
||||
let builder = createSolutionBuilder(host);
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(...initialExpectedDiagnostics);
|
||||
// Verify they exist
|
||||
@@ -398,7 +398,7 @@ namespace ts {
|
||||
// Delete bundle info
|
||||
host.clearDiagnostics();
|
||||
host.deleteFile(outputFiles[project.first][ext.buildinfo]);
|
||||
builder.resetBuildContext();
|
||||
builder = createSolutionBuilder(host);
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]),
|
||||
@@ -428,11 +428,11 @@ namespace ts {
|
||||
it("rebuilds completely when version in tsbuildinfo doesnt match ts version", () => {
|
||||
const fs = outFileFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host);
|
||||
let builder = createSolutionBuilder(host);
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(...initialExpectedDiagnostics);
|
||||
host.clearDiagnostics();
|
||||
builder.resetBuildContext();
|
||||
builder = createSolutionBuilder(host);
|
||||
changeCompilerVersion(host);
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
@@ -453,7 +453,7 @@ namespace ts {
|
||||
|
||||
// Build with command line incremental
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host, { incremental: true });
|
||||
let builder = createSolutionBuilder(host, { incremental: true });
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(...initialExpectedDiagnostics);
|
||||
host.clearDiagnostics();
|
||||
@@ -461,7 +461,7 @@ namespace ts {
|
||||
|
||||
// Make non incremental build with change in file that doesnt affect dts
|
||||
appendText(fs, relSources[project.first][source.ts][part.one], "console.log(s);");
|
||||
builder.resetBuildContext({ verbose: true });
|
||||
builder = createSolutionBuilder(host, { verbose: true });
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(getExpectedDiagnosticForProjectsInBuild(relSources[project.first][source.config], relSources[project.second][source.config], relSources[project.third][source.config]),
|
||||
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relSources[project.first][source.config], relOutputFiles[project.first][ext.js], relSources[project.first][source.ts][part.one]],
|
||||
@@ -475,7 +475,7 @@ namespace ts {
|
||||
|
||||
// Make incremental build with change in file that doesnt affect dts
|
||||
appendText(fs, relSources[project.first][source.ts][part.one], "console.log(s);");
|
||||
builder.resetBuildContext({ verbose: true, incremental: true });
|
||||
builder = createSolutionBuilder(host, { verbose: true, incremental: true });
|
||||
builder.buildAllProjects();
|
||||
// Builds completely because tsbuildinfo is old.
|
||||
host.assertDiagnosticMessages(
|
||||
|
||||
@@ -64,7 +64,7 @@ export default hello.hello`);
|
||||
const configFile = "src/tsconfig_withFiles.json";
|
||||
replaceText(fs, configFile, `"composite": true,`, `"composite": true, "sourceMap": true,`);
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
let builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(configFile),
|
||||
@@ -75,7 +75,7 @@ export default hello.hello`);
|
||||
assert(fs.existsSync(output), `Expect file ${output} to exist`);
|
||||
}
|
||||
host.clearDiagnostics();
|
||||
builder.resetBuildContext();
|
||||
builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
tick();
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
@@ -89,7 +89,7 @@ export default hello.hello`);
|
||||
const configFile = "src/tsconfig_withFiles.json";
|
||||
replaceText(fs, configFile, `"outDir": "dist",`, "");
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
let builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(configFile),
|
||||
@@ -100,7 +100,7 @@ export default hello.hello`);
|
||||
assert(fs.existsSync(output), `Expect file ${output} to exist`);
|
||||
}
|
||||
host.clearDiagnostics();
|
||||
builder.resetBuildContext();
|
||||
builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
tick();
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
@@ -128,7 +128,7 @@ export default hello.hello`);
|
||||
const stringsConfigFile = "src/strings/tsconfig.json";
|
||||
const mainConfigFile = "src/main/tsconfig.json";
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
let builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild(stringsConfigFile, mainConfigFile, configFile),
|
||||
@@ -139,7 +139,7 @@ export default hello.hello`);
|
||||
);
|
||||
assert(fs.existsSync(expectedOutput), `Expect file ${expectedOutput} to exist`);
|
||||
host.clearDiagnostics();
|
||||
builder.resetBuildContext();
|
||||
builder = createSolutionBuilder(host, [configFile], { verbose: true });
|
||||
tick();
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
|
||||
@@ -171,11 +171,11 @@ namespace ts {
|
||||
function initializeWithBuild(opts?: BuildOptions) {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
||||
let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
||||
builder.buildAllProjects();
|
||||
host.clearDiagnostics();
|
||||
tick();
|
||||
builder.resetBuildContext(opts ? { ...opts, verbose: true } : undefined);
|
||||
builder = createSolutionBuilder(host, ["/src/tests"], { ...(opts || {}), verbose: true });
|
||||
return { fs, host, builder };
|
||||
}
|
||||
|
||||
@@ -183,7 +183,6 @@ namespace ts {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
||||
builder.resetBuildContext();
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
@@ -288,7 +287,7 @@ namespace ts {
|
||||
fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: { target: "es3" } }));
|
||||
replaceText(fs, "/src/tests/tsconfig.json", `"references": [`, `"extends": "./tsconfig.base.json", "references": [`);
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
||||
let builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||
@@ -301,7 +300,7 @@ namespace ts {
|
||||
);
|
||||
host.clearDiagnostics();
|
||||
tick();
|
||||
builder.resetBuildContext();
|
||||
builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
||||
fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: {} }));
|
||||
builder.buildAllProjects();
|
||||
host.assertDiagnosticMessages(
|
||||
|
||||
Reference in New Issue
Block a user