Skip to content

Commit 9e8fbcd

Browse files
committed
Transitively upstream blocked project should not build
1 parent 94d54b9 commit 9e8fbcd

File tree

3 files changed

+55
-4
lines changed

3 files changed

+55
-4
lines changed

src/compiler/diagnosticMessages.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4172,6 +4172,14 @@
41724172
"category": "Message",
41734173
"code": 6381
41744174
},
4175+
"Skipping build of project '{0}' because its dependency '{1}' was not built": {
4176+
"category": "Message",
4177+
"code": 6382
4178+
},
4179+
"Project '{0}' can't be built because its dependency '{1}' was not built": {
4180+
"category": "Message",
4181+
"code": 6383
4182+
},
41754183

41764184
"The expected type comes from property '{0}' which is declared here on type '{1}'": {
41774185
"category": "Message",

src/compiler/tsbuild.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ namespace ts {
116116
export interface UpstreamBlocked {
117117
type: UpToDateStatusType.UpstreamBlocked;
118118
upstreamProjectName: string;
119+
upstreamProjectBlocked: boolean;
119120
}
120121

121122
/**
@@ -1338,7 +1339,16 @@ namespace ts {
13381339
if (status.type === UpToDateStatusType.UpstreamBlocked) {
13391340
reportAndStoreErrors(state, projectPath, config.errors);
13401341
projectPendingBuild.delete(projectPath);
1341-
if (options.verbose) reportStatus(state, Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, project, status.upstreamProjectName);
1342+
if (options.verbose) {
1343+
reportStatus(
1344+
state,
1345+
status.upstreamProjectBlocked ?
1346+
Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built :
1347+
Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors,
1348+
project,
1349+
status.upstreamProjectName
1350+
);
1351+
}
13421352
continue;
13431353
}
13441354

@@ -1540,10 +1550,12 @@ namespace ts {
15401550
}
15411551

15421552
// An upstream project is blocked
1543-
if (refStatus.type === UpToDateStatusType.Unbuildable) {
1553+
if (refStatus.type === UpToDateStatusType.Unbuildable ||
1554+
refStatus.type === UpToDateStatusType.UpstreamBlocked) {
15441555
return {
15451556
type: UpToDateStatusType.UpstreamBlocked,
1546-
upstreamProjectName: ref.path
1557+
upstreamProjectName: ref.path,
1558+
upstreamProjectBlocked: refStatus.type === UpToDateStatusType.UpstreamBlocked
15471559
};
15481560
}
15491561

@@ -2167,7 +2179,9 @@ namespace ts {
21672179
case UpToDateStatusType.UpstreamBlocked:
21682180
return reportStatus(
21692181
state,
2170-
Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
2182+
status.upstreamProjectBlocked ?
2183+
Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built :
2184+
Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
21712185
relName(state, configFileName),
21722186
relName(state, status.upstreamProjectName)
21732187
);

src/testRunner/unittests/tsbuild/demo.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,34 @@ namespace ts {
107107
notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()]
108108
});
109109
});
110+
111+
it("in bad-ref branch reports the error about files not in rootDir at the import location", () => {
112+
verifyBuild({
113+
modifyDiskLayout: fs => prependText(
114+
fs,
115+
"/src/core/utilities.ts",
116+
`import * as A from '../animals';
117+
`
118+
),
119+
expectedExitStatus: ExitStatus.DiagnosticsPresent_OutputsSkipped,
120+
expectedDiagnostics: [
121+
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/tsconfig.json"),
122+
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/lib/core/utilities.js"],
123+
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
124+
[Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/animal.ts", "/src/core"],
125+
[Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/dog.ts", "/src/core"],
126+
[Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, "/src/animals/index.ts", "/src/core"],
127+
[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"],
128+
[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"],
129+
[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"],
130+
[Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, "src/animals/tsconfig.json", "src/core"],
131+
[Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors, "/src/animals/tsconfig.json", "/src/core"],
132+
[Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built, "src/zoo/tsconfig.json", "src/animals"],
133+
[Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built, "/src/zoo/tsconfig.json", "/src/animals"],
134+
],
135+
expectedOutputs: emptyArray,
136+
notExpectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()]
137+
});
138+
});
110139
});
111140
}

0 commit comments

Comments
 (0)