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

Register more dependencies statically #667

Merged
merged 9 commits into from
Apr 8, 2018
Merged

Register more dependencies statically #667

merged 9 commits into from
Apr 8, 2018

Conversation

ghost
Copy link

@ghost ghost commented Mar 31, 2018

Most of the dependencies on files of library dependencies used to be declared dynamically. For instance the dependencies on <lib-dir>/*.cmi for every library dependency. As a result jbuilder external-lib-deps was quite often broken.

This PR changes that by passing the requires variable as a value of type (Lib.t list, exn) result instead of (unit, Lib.t list) Build.t. This usually simplify a bit the code as we have to go less through the build arrow. The dependency on the .merlin file and the Build.record_lib_deps that used to be encoded in requires are now done with prefix_rules.

One negative consequence of these changes is that we often have to pass two arguments instead of one to various functions that call the compiler: we have to pass requires as well as the dependencies on of the files of library dependencies. So the last few commits add Arg_spec.Hidden_deps, which allows to declare additional dependencies that are not present on the command line. This is used to represent include directory: we can pack together the -I flags and the file dependencies.

@ghost ghost force-pushed the more-static-deps branch from 5f034a6 to 2a991f9 Compare March 31, 2018 02:14
@bubba0823
Copy link

Thanks

@ghost ghost changed the title Register mode dependencies statically Register more dependencies statically Mar 31, 2018
@rgrinberg
Copy link
Member

I rebased this on top of master due to some blackbox test changes. Now every commit passes all the tests.

~f:Build.return
in
let requires =
let with_lib_deps t compile_info ~dir ~has_dot_merlin ~f =
Copy link
Member

Choose a reason for hiding this comment

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

I think you might be forgetting to set ~has_dot_merlin correctly. I see it's being set to true everywhere rather than being based on the context.

@rgrinberg rgrinberg merged commit 02b04e1 into master Apr 8, 2018
@rgrinberg
Copy link
Member

I just ended up merging this to avoid keeping the PR up to date. Created an issue for the has_dot_merlin question so that we don't forget: #684

@emillon emillon deleted the more-static-deps branch December 13, 2018 16:05
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.

2 participants