Passing --force option to build, builds project from start
This commit is contained in:
parent
cabf72b514
commit
52641c531a
2 changed files with 17 additions and 2 deletions
|
@ -1178,6 +1178,7 @@ namespace ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOldProgram(proj: ResolvedConfigFileName, parsed: ParsedCommandLine) {
|
function getOldProgram(proj: ResolvedConfigFileName, parsed: ParsedCommandLine) {
|
||||||
|
if (options.force) return undefined;
|
||||||
const value = builderPrograms.getValue(proj);
|
const value = builderPrograms.getValue(proj);
|
||||||
if (value) return value;
|
if (value) return value;
|
||||||
return readBuilderProgram(parsed.options, readFileWithCache) as any as T;
|
return readBuilderProgram(parsed.options, readFileWithCache) as any as T;
|
||||||
|
|
|
@ -168,14 +168,14 @@ namespace ts {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("can detect when and what to rebuild", () => {
|
describe("can detect when and what to rebuild", () => {
|
||||||
function initializeWithBuild() {
|
function initializeWithBuild(opts?: BuildOptions) {
|
||||||
const fs = projFs.shadow();
|
const fs = projFs.shadow();
|
||||||
const host = new fakes.SolutionBuilderHost(fs);
|
const host = new fakes.SolutionBuilderHost(fs);
|
||||||
const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
|
||||||
builder.buildAllProjects();
|
builder.buildAllProjects();
|
||||||
host.clearDiagnostics();
|
host.clearDiagnostics();
|
||||||
tick();
|
tick();
|
||||||
builder.resetBuildContext();
|
builder.resetBuildContext(opts ? { ...opts, verbose: true } : undefined);
|
||||||
return { fs, host, builder };
|
return { fs, host, builder };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,6 +254,20 @@ namespace ts {
|
||||||
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"],
|
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("rebuilds from start if --f is passed", () => {
|
||||||
|
const { host, builder } = initializeWithBuild({ force: true });
|
||||||
|
builder.buildAllProjects();
|
||||||
|
host.assertDiagnosticMessages(
|
||||||
|
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
|
||||||
|
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
|
||||||
|
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
|
||||||
|
[Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/logic/tsconfig.json"],
|
||||||
|
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
|
||||||
|
[Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/tests/tsconfig.json"],
|
||||||
|
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("downstream-blocked compilations", () => {
|
describe("downstream-blocked compilations", () => {
|
||||||
|
|
Loading…
Reference in a new issue