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

Introduce scheme #2086

Merged
merged 14 commits into from
May 7, 2019
Merged

Introduce scheme #2086

merged 14 commits into from
May 7, 2019

Conversation

aalekseyev
Copy link
Collaborator

@aalekseyev aalekseyev commented Apr 25, 2019

  • Introduce a composable type Scheme.t for expressing lazily generated subtree rules.
  • Rules.t representation is ugly and temporary. See Move rules collector out of build system #2089 where we turn it into a passive data structure instead.

@aalekseyev aalekseyev requested a review from a user April 25, 2019 16:13
@aalekseyev aalekseyev force-pushed the introduce-scheme branch 4 times, most recently from de44ec5 to 57ad0ee Compare April 26, 2019 10:47
@aalekseyev aalekseyev force-pushed the introduce-scheme branch 3 times, most recently from dcd255e to dccb094 Compare May 1, 2019 10:38
@ghost
Copy link

ghost commented May 6, 2019

BTW, would it be hard to extract 0a9c83a into a separate PR? It looks independant from this PR.

@aalekseyev
Copy link
Collaborator Author

@diml, I don't think it's independent.
Without that change, to use scheme we need to call add_rule for every directory we have rules for. The point of Scheme is to make that process demand-driven.

I could move it together with the rest of install_rules changes easily enough though. That would leave scheme unused in this feature.

@rgrinberg
Copy link
Member

I will give this a review today. Sorry for the delay. Splitting this PR would be highly appreciated and make review easier for me.

@aalekseyev aalekseyev requested a review from rgrinberg May 7, 2019 08:33
aalekseyev and others added 4 commits May 7, 2019 11:06
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
- add more doc and try to make the API more "progressive",
  i.e. going from simple to complex concepts
- reduce the number of intermediate maps in the various operations
- use a more compact representation
- rename `intersect` to `inter` to match `Set`'s API

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
…uite

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
@aalekseyev aalekseyev force-pushed the introduce-scheme branch 2 times, most recently from fbecd1e to 0662dc6 Compare May 7, 2019 10:10
@aalekseyev
Copy link
Collaborator Author

aalekseyev commented May 7, 2019

Moved the install rules changes to #2130. I also squashed much of the early history of the feature.

jeremiedimino and others added 3 commits May 7, 2019 12:13
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
aalekseyev added 2 commits May 7, 2019 14:00
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
in
fun x ~of_ ->
match loop x of_ with
| (_ : t) -> true
Copy link
Member

Choose a reason for hiding this comment

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

Why do we return t here and not unit for example?

Copy link

Choose a reason for hiding this comment

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

It was just so that I could write merge... ~f:loop which wants f to return a t.

| Approximation (paths, rules) ->
if
not (Dir_set.is_subset paths ~of_:env)
&& not (Dir_set.is_subset (Dir_set.negate paths) ~of_:env)
Copy link
Member

Choose a reason for hiding this comment

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

What is this env parameter for? It seems to always be Universal, so these is_subset calls will always be true. Do we expect it to vary down the line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, that's a bug. Thanks for catching. I pushed a fix.

The purpose of the parameter is to catch errors when rules are generated for directories outside of env. Speaking of which, that's not checked in the Finite branch at all.

I'm making a fix for that too.

| Union of 'rules t * 'rules t
| Approximation of Dir_set.t * 'rules t
| Finite of 'rules Path.Build.Map.t
| Thunk of (unit -> 'rules t)
Copy link
Member

Choose a reason for hiding this comment

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

I would add a comment to each of these constructors.

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 approve because it seems like any concerns should be addressed in the subsequent PR. The utility of having this PR independently isn't that clear then of course.

aalekseyev added 4 commits May 7, 2019 16:08
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
@aalekseyev aalekseyev merged commit 30d2400 into ocaml:master May 7, 2019
@aalekseyev
Copy link
Collaborator Author

@rgrinberg, the utility is having fewer PRs in flight at a time :-) and having github understand what the diff of the follow-up PRs is.

mlasson pushed a commit to mlasson/dune that referenced this pull request Jul 19, 2019
* Introduce Scheme

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Signed-off-by: Arseniy Alekseyev <aalekseyev@janestreet.com>
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