Skip to content

Container only ref needs to be ignored from uptodate status #32027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/compiler/tsbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,8 @@ namespace ts {
const refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);

// Its a circular reference ignore the status of this project
if (refStatus.type === UpToDateStatusType.ComputingUpstream) {
if (refStatus.type === UpToDateStatusType.ComputingUpstream ||
refStatus.type === UpToDateStatusType.ContainerOnly) { // Container only ignore this project
continue;
}

Expand Down
1 change: 1 addition & 0 deletions src/testRunner/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"unittests/services/textChanges.ts",
"unittests/services/transpile.ts",
"unittests/tsbuild/amdModulesWithOut.ts",
"unittests/tsbuild/containerOnlyReferenced.ts",
"unittests/tsbuild/emptyFiles.ts",
"unittests/tsbuild/graphOrdering.ts",
"unittests/tsbuild/inferredTypeFromTransitiveModule.ts",
Expand Down
48 changes: 48 additions & 0 deletions src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
namespace ts {
describe("unittests:: tsbuild:: when containerOnly project is referenced", () => {
let projFs: vfs.FileSystem;
before(() => {
projFs = loadProjectFromDisk("tests/projects/containerOnlyReferenced");
});

after(() => {
projFs = undefined!; // Release the contents
});

function outputs(folder: string) {
return [
`${folder}/index.js`,
`${folder}/index.d.ts`,
`${folder}/tsconfig.tsbuildinfo`
];
}

it("verify that subsequent builds after initial build doesnt build anything", () => {
const fs = projFs.shadow();
const host = new fakes.SolutionBuilderHost(fs);
createSolutionBuilder(host, ["/src"], { verbose: true }).build();
host.assertDiagnosticMessages(
getExpectedDiagnosticForProjectsInBuild("src/src/folder/tsconfig.json", "src/src/folder2/tsconfig.json", "src/src/tsconfig.json", "src/tests/tsconfig.json", "src/tsconfig.json"),
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/folder/tsconfig.json", "src/src/folder/index.js"],
[Diagnostics.Building_project_0, "/src/src/folder/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/src/folder2/tsconfig.json", "src/src/folder2/index.js"],
[Diagnostics.Building_project_0, "/src/src/folder2/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"],
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"],
);
verifyOutputsPresent(fs, [
...outputs("/src/src/folder"),
...outputs("/src/src/folder2"),
...outputs("/src/tests"),
]);
host.clearDiagnostics();
createSolutionBuilder(host, ["/src"], { verbose: true }).build();
host.assertDiagnosticMessages(
getExpectedDiagnosticForProjectsInBuild("src/src/folder/tsconfig.json", "src/src/folder2/tsconfig.json", "src/src/tsconfig.json", "src/tests/tsconfig.json", "src/tsconfig.json"),
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/src/folder/tsconfig.json", "src/src/folder/index.ts", "src/src/folder/index.js"],
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/src/folder2/tsconfig.json", "src/src/folder2/index.ts", "src/src/folder2/index.js"],
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/tests/tsconfig.json", "src/tests/index.ts", "src/tests/index.js"],
);
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace ts {
});

it("verify that it builds correctly", () => {
const projFs = loadProjectFromDisk("tests/projects/projectReferenceWithRootDirInParent");
const allExpectedOutputs = [
"/src/dist/other/other.js", "/src/dist/other/other.d.ts",
"/src/dist/main/a.js", "/src/dist/main/a.d.ts",
Expand Down
1 change: 1 addition & 0 deletions tests/projects/containerOnlyReferenced/src/folder/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const x = 10;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files": ["index.ts"],
"compilerOptions": {
"composite": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const x = 10;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files": ["index.ts"],
"compilerOptions": {
"composite": true
}
}
10 changes: 10 additions & 0 deletions tests/projects/containerOnlyReferenced/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"files": [],
"compilerOptions": {
"composite": true
},
"references": [
{ "path": "./folder" },
{ "path": "./folder2"}
]
}
1 change: 1 addition & 0 deletions tests/projects/containerOnlyReferenced/tests/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const x = 10;
9 changes: 9 additions & 0 deletions tests/projects/containerOnlyReferenced/tests/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"files": ["index.ts"],
"compilerOptions": {
"composite": true
},
"references": [
{ "path": "../src" }
]
}
10 changes: 10 additions & 0 deletions tests/projects/containerOnlyReferenced/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"files": [],
"compilerOptions": {
"composite": true
},
"references": [
{ "path": "./src" },
{ "path": "./tests"}
]
}