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(builtin): link module_name to directories recursively to avoid directory clashes #1432

Merged
merged 4 commits into from
Dec 18, 2019

Conversation

jbedard
Copy link
Collaborator

@jbedard jbedard commented Dec 7, 2019

Fixes #1411

The overall change is to build a recursive hierarchy instead of just an array of arrays (one level of the hierarchy?). That hierarchy is then the order changes must be processed in, siblings in the hierarchy can be processed concurrently as long as the parent was already processed.

IDK if such a drastic change was really necessary, but it's the path I started down. Maybe we can just adjust the existing implementation but keep the tests?

This also does a bit less mkdirp calls, the @foo/c/c/c/c test now has I think 17 mkdirp/symlink calls instead of 21 🤷‍♂

2 of the tests fail before the change, I might try finding more cases though...
5 of the tests fail before the change, I think all of which are ~unique situations. I've outlined these more in the issue.

@gregmagolan
Copy link
Collaborator

Nice! Thanks for taking a look at this @jbedard . I'll TAL on Friday after BazelCon.

.toEqual('/*@foo/d/bar/fum/far*/exports = {}');
});

it('should handle first-party packages with sibling directories', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

These tests talking to the real FS are slower. It seems like you add all the same coverage below as in the IN/OUT unit tests above. Do we really need both? Do these new tests below add coverage that we don't get from the ones above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They go one step further and test the use of that OUT tree, concurrently traversing it and applying it to the FS.

They could also be run with both the old and new code so I could assure I'm actually fixing things, the test failed before and passes now etc.

We could potentially remove a few now that we're (I hope) more confident everything is working. Only keep the ones that concentrate more on applying the tree to the FS...

@jbedard jbedard force-pushed the overlapping-module_name branch from 006a844 to 234a959 Compare December 18, 2019 07:27
…void directory clashes

Update comments/formatting
…void directory clashes

ensure all FS test cases have equivelent reduceModules cases
…void directory clashes

update fs module-name tests to test unique link fs-layouts, not unique module_name=>link conversions
@buildsize
Copy link

buildsize bot commented Dec 18, 2019

File name Previous Size New Size Change
release.tar.gz 959.53 KB 960.29 KB 771 bytes (0%)

@jbedard
Copy link
Collaborator Author

jbedard commented Dec 18, 2019

I've updated this with a couple changes:

  • rebased
  • updated some comments
  • added some reduceLink tests for some cases previously only the fs tests covered
  • adjustd the fs tests to test the unique fs/link layouts, not the unique module_name => link conversions (that's what the IN/OUT tests are for). This includes deleting some cases which I think are unique module_name=> link cases, not unique fs/link cases. @alexeagle I think this addresses your point and reduces the number of these tests.

I've left those as fixup commits for now so you can see the changes. If we're good I or whoever can squash+merge.

Copy link
Collaborator

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

awesome clean up

@alexeagle alexeagle merged commit 0217724 into bazel-contrib:master Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

module_name linking creates invalid links in some cases
4 participants