-
Notifications
You must be signed in to change notification settings - Fork 413
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 native code incremental compilation #238
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9180f88
Add Path.change_extension
dra27 77c79eb
Ensure executables depend on object files
dra27 1053d4e
Ensure .cmxa files depend on object files
dra27 da24046
Ensure .cmxs depends on archive file
dra27 ab4ff09
Ensure executables also depend on archive files
dra27 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding of jbuilder's internals here is a bit shaky, so I'm curious:
why do you need
Build.dyn_paths
overBuild.paths
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think (my understanding's often shaky too - there's a virtuous project in the making to write a big document on Jbuilder's internals, just for the exercise of thoroughly understanding it all oneself!) that it's because it's a generated target - so
paths
is things which should exist already (sources, etc.) anddyn_paths
is things which are generated.However, my change is based more on the fact that the .cmx and .cmxa files elsewhere are incorporated using dyn_paths (via Arg_spec, which generates that part of the build arrow as a side effect).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rules are build arrow of types
(unit, Action.t) Build.t
, but really they could be(unit, { runtime_deps : Path.Set.t; action : Action.t }) Build.t
. It is however simpler to build the set of runtime dependencies implicitly since all we do with it is always pass it through or extend it.In the expanded version,
Build.dyn_paths l
basically means:Build.arr (fun x -> { x with runtime_deps = Path.Set.union x.runtime_deps (Path.Set.of_list l) })
. In any case,Build.paths l
is always the same asBuild.dyn_paths (Build.arr (fun _ -> l))
.The only difference between the two is that with
Build.paths
, the dependencies are known statically. This means that we can get most of the DAG without running any command and this is enough to generate the list of package dependencies that goes into the opam file. We use that feature to generate the opam files of all Jane Street packages without hassle.Additionally, in some cases using
Build.paths
can improve compilation times as static dependencies are known earlier.In the end, we should use
Build.paths
wherever possible.