Skip to content
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

fix(core): handle self-referencing build dependencies #5177

Merged
merged 4 commits into from
Jan 18, 2023

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Jan 5, 2023

What's the problem this PR addresses?

#5162 didn't handle self-referencing build dependencies.

Fixes https://github.com/yarnpkg/berry/actions/runs/3848381377/jobs/6556091151#step:4:65 and https://github.com/yarnpkg/berry/actions/runs/3848381374/jobs/6556092179#step:4:52

How did you fix it?

Handle self-referencing build dependencies.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@merceyz merceyz marked this pull request as ready for review January 5, 2023 19:55
@@ -1351,7 +1351,7 @@ export class Project {

const workspace = this.tryWorkspaceByLocator(dependencyPkg);
if (workspace) {
if (buildablePackages.has(workspace.anchoredLocator.locatorHash))
if (resolution !== workspace.anchoredLocator.locatorHash && buildablePackages.has(workspace.anchoredLocator.locatorHash))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps I'm too tired and reading this incorrectly, but isn't this checking whether the transitive workspace dependency is different from the devirtualized workspace?

Shouldn't it be?

Suggested change
if (resolution !== workspace.anchoredLocator.locatorHash && buildablePackages.has(workspace.anchoredLocator.locatorHash))
if (resolution !== locator.locatorHash && buildablePackages.has(workspace.anchoredLocator.locatorHash))

Copy link
Member Author

@merceyz merceyz Jan 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're reading it correctly, that's a mistake on my part however your suggested change isn't correct either, the check was supposed to check that the devirtualized workspace wasn't the original locator. I changed it to workspace.anchoredLocator.locatorHash !== locator.locatorHash and added a new test.

@arcanis arcanis merged commit ed90191 into master Jan 18, 2023
@arcanis arcanis deleted the merceyz/fix/self-referencing-build branch January 18, 2023 15:08
merceyz added a commit that referenced this pull request Jan 29, 2023
* fix(core): handle self-referencing build dependencies

* chore: revert e2e trigger

* fix(core): handle self-referencing virtual workspace build dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants