-
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
(no_dynlink)
: do not build .cmxs
#11176
Conversation
@rgrinberg: do you think this change would need to be versioned? |
|
||
$ touch a.ml | ||
|
||
$ dune build --display short |
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.
Could you replace the --display short with just an explicit target such as
mylib.cmxs?
This extra output makes the tests fragile and hard to understand
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.
Fixed, thanks.
@@ -0,0 +1,37 @@ | |||
$ cat >dune-project <<EOF |
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.
Can you add a few sentences here to describe the test?
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.
Fixed, thanks.
It does sound fine to not version this. The old behavior was useless, so I Could you add a CHANGES entry? |
It already has one :) |
Thanks for the review @rgrinberg! I think all points are addressed. |
does this still build & install the |
No. The |
I disagree: before this PR, a after this PR, a it's technically a breaking change if these 2 points are true at the same time:
note: no strong opinions whether you want to support this (arguable) edge case. i realize that this will help your builds internally and is indeed an edge case (and a new field) so i'm not opposed to it. |
I cannot reproduce this behaviour with Dune 3.16:
|
@anmonteiro can you confirm whether you are observing the installation of |
Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
8a6b87d
to
2efeefc
Compare
@nojb I can confirm that Dune 3.16 has the behavior you describe (also I rebased the branch to get the fix for macOS CI failures in). |
Thanks! |
I understand now that dune 3.16 didn't install the cmxs in the first place. that means i'm wrong, please proceed. |
but something has changed between 3.16 and this PR where a |
|
||
$ dune clean | ||
|
||
$ dune build _build/default/mylib.cmxs |
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.
Could you add some tests for the .install file as well?
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.
Good idea. Fixed, thanks.
To re-iterate nojb, I don't see how this PR changes installation. However, this PR is indeed breaking users that relied on building a cmxs but not installing it. I think such an edge case is useless enough that we can let it slide. |
That is correct. With this PR, the cmxs won't even be built. |
All issues having been addressed, planning to merge once CI passes. |
* Do not build .cmxs when library is (no_dynlink) Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> * Add test Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> * Changes Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> * Improve test Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> * Add test Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> --------- Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> (cherry picked from commit 41212a5)
* `(no_dynlink)`: do not build `.cmxs` (#11176) * Do not build .cmxs when library is (no_dynlink) Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> * Add test Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> * Changes Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> * Improve test Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> * Add test Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> --------- Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com> (cherry picked from commit 41212a5) * Fix ignored-dune-lock test on macos (#11179) The macos patch utility doesn't like it when a patch contains no hunks, so this change adds a hunk to the patch used in the ignored-dune-lock test. Signed-off-by: Stephen Sherratt <stephen@sherra.tt> --------- Signed-off-by: Stephen Sherratt <stephen@sherra.tt> Co-authored-by: Stephen Sherratt <stephen@sherra.tt>
CHANGES: ### Fixed - When a library declares `(no_dynlink)`, then the `.cmxs` file for it is no longer built. (ocaml/dune#11176, @nojb) - Fix bug that could result in corrupted file copies by Dune, for example when using the `copy_files#` stanza or the `copy#` action. (@nojb, ocaml/dune#11194, fixes ocaml/dune#11193) - Remove useless error message when running `$ dune subst` in empty projects. (@rgrinberg, ocaml/dune#11204, fixes ocaml/dune#11200)
What it says on the tin: when the library declares
(no_dynlink)
, then the.cmxs
should not be built. On large codebases, this can save considerable time (especially on Windows).