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

Refactor Dune_engine.Targets #9407

Merged
merged 6 commits into from
Dec 12, 2023
Merged

Conversation

rleshchinskiy
Copy link
Collaborator

This is a bunch of refactoring around Targets and especially Targets.Produced. The main changes are:

  • We had similar but subtly different code for sandboxed and non-sandboxed directory targets which is now unified. As part of this, we no longer promote empty (sub)directories. Previously, this was only the case for sandboxed directory targets because we didn't move empty (sub)directories from the sandbox to the build dir.
  • We generalise Targets.Produced.collect_digests which allows us to remove Targets.Produced.Option.
  • We move everything to do with async file operations in Build_system which really is the only user of those, anyway.
  • We remove all dependencies on Dune_engine from Targets. A later PR will move those into a separate library which will allow us to use them in the cache as well.

@rleshchinskiy rleshchinskiy marked this pull request as ready for review December 11, 2023 17:07
Copy link
Collaborator

@snowleopard snowleopard left a comment

Choose a reason for hiding this comment

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

Thanks! All reviewed, benchmarked and battle-tested internally.

@rgrinberg rgrinberg force-pushed the refactor-targets branch 3 times, most recently from faa0d18 to 46011a8 Compare December 12, 2023 04:46
Copy link
Member

@rgrinberg rgrinberg left a comment

Choose a reason for hiding this comment

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

I've replaced the use of symlinking to create a directory target with just normal copying as an experiment and it didn't seem to help. I've also experimented with sandboxing to make sure that we specified all dependencies correctly and again without success.

The fact that doing a clean build gives us the right answer in the install rules is rather concerning and my first assumption is that there's some bug in the engine.

Unfortunately, I didn't get anywhere investigating. I'll keep investigating, but I don't think this should block the PR.

I've left a commit (which I later reverted) switching the symlinking to copying in case anyone wants to experiment.

Roman Leshchinskiy and others added 6 commits December 12, 2023 09:47
We had similar but subtly different code for sandboxed and non-sandboxed directory targets. This patch unifies the two.

We also no longer promote empty (sub)directories. Previously, this was only the case for sandboxed directory targets because we didn't move empty (sub)directories from the sandbox to the build dir.

Signed-off-by: Roman Leshchinskiy <rleshchinskiy@janestreet.com>
There was some code duplication here which gets in the way of subsequent refactoring.  Let's get rid of it.

Signed-off-by: Roman Leshchinskiy <rleshchinskiy@janestreet.com>
This is a pure refactoring. The main goal is to be able to move Dune_engine.Targets into a separate package which can be used from dune_cache. However, I believe that it also makes the code simpler to follow overall.

The main change is that we move everything to do with async file operations into Build_system which really is the only user of those, anyway.

In addition, we also slightly generalise [Targets.Produced.collect_digests] and remove an unused pretty-printing function.

Signed-off-by: Roman Leshchinskiy <rleshchinskiy@janestreet.com>
The test was creating a broken symlink which was subsequently ignored by
Dune. We no longer ignore symlinks so this fails at a later stage. This
patch makes the symlink be valid.

Signed-off-by: Roman Leshchinskiy <rleshchinskiy@janestreet.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
This reverts commit 46011a8.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
@rleshchinskiy rleshchinskiy merged commit 1bdf15d into ocaml:main Dec 12, 2023
27 checks passed
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.

None yet

3 participants