Transitively upstream blocked project should not build

This commit is contained in:
Sheetal Nandi 2019-08-08 12:40:43 -07:00
parent 94d54b967d
commit 9e8fbcd7f8
3 changed files with 55 additions and 4 deletions

View file

@ -4172,6 +4172,14 @@
"category": "Message",
"code": 6381
},
"Skipping build of project '{0}' because its dependency '{1}' was not built": {
"category": "Message",
"code": 6382
},
"Project '{0}' can't be built because its dependency '{1}' was not built": {
"category": "Message",
"code": 6383
},
"The expected type comes from property '{0}' which is declared here on type '{1}'": {
"category": "Message",

View file

@ -116,6 +116,7 @@ namespace ts {
export interface UpstreamBlocked {
type: UpToDateStatusType.UpstreamBlocked;
upstreamProjectName: string;
upstreamProjectBlocked: boolean;
}
/**
@ -1338,7 +1339,16 @@ namespace ts {
if (status.type === UpToDateStatusType.UpstreamBlocked) {
reportAndStoreErrors(state, projectPath, config.errors);
projectPendingBuild.delete(projectPath);
if (options.verbose) reportStatus(state, Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName);
if (options.verbose) {
reportStatus(
state,
status.upstreamProjectBlocked ?
Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built :
Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors,
project,
status.upstreamProjectName
);
}
continue;
}
@ -1540,10 +1550,12 @@ namespace ts {
}
// An upstream project is blocked
if (refStatus.type === UpToDateStatusType.Unbuildable) {
if (refStatus.type === UpToDateStatusType.Unbuildable ||
refStatus.type === UpToDateStatusType.UpstreamBlocked) {
return {
type: UpToDateStatusType.UpstreamBlocked,
upstreamProjectName: ref.path
upstreamProjectName: ref.path,
upstreamProjectBlocked: refStatus.type === UpToDateStatusType.UpstreamBlocked
};
}
@ -2167,7 +2179,9 @@ namespace ts {
case UpToDateStatusType.UpstreamBlocked:
return reportStatus(
state,
Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
status.upstreamProjectBlocked ?
Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built :
Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
relName(state, configFileName),
relName(state, status.upstreamProjectName)
);

View file

@ -107,5 +107,34 @@ namespace ts {
notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()]
});
});
it("in bad-ref branch reports the error about files not in rootDir at the import location", () => {
verifyBuild({
modifyDiskLayout: fs => prependText(
fs,
"/src/core/utilities.ts",
`import * as A from '../animals';
`
),
expectedExitStatus: ExitStatus.DiagnosticsPresent_OutputsSkipped,
expectedDiagnostics: [
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/tsconfig.json"),
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/lib/core/utilities.js"],
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
[Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/animal.ts", "/src/core"],
[Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/dog.ts", "/src/core"],
[Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/index.ts", "/src/core"],
[Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/animal.ts", "/src/core/tsconfig.json"],
[Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/dog.ts", "/src/core/tsconfig.json"],
[Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern, "/src/animals/index.ts", "/src/core/tsconfig.json"],
[Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, "src/animals/tsconfig.json", "src/core"],
[Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, "/src/animals/tsconfig.json", "/src/core"],
[Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built, "src/zoo/tsconfig.json", "src/animals"],
[Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built, "/src/zoo/tsconfig.json", "/src/animals"],
],
expectedOutputs: emptyArray,
notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()]
});
});
});
}