fix(bin-pform): use installed filenames in Windows layouts - #15518
Merged
Conversation
Alizter
force-pushed
the
bin-layout-installed-filenames
branch
from
July 17, 2026 20:01
1c64076 to
325c4e7
Compare
rgrinberg
reviewed
Jul 19, 2026
| ] | ||
| ;; | ||
|
|
||
| let compare x y = |
Member
There was a problem hiding this comment.
You can use Repr.Poly here so we don't have to write boilerplate.
Collaborator
Author
There was a problem hiding this comment.
I thought so too, but Filename.repr is a Repr.view, which Repr.Poly rejects during runtime validation. On closer inspection, Filename.t is a validated path component backed by a string, and its comparison is exactly String.compare, so polymorphic comparison is sound here; ./foo is not a valid Filename.t. The remaining obstacle is the conservative validation of views. Changing Filename.repr to expose its structural string representation would allow us to use Repr.Poly; for now I’ll keep the explicit comparison and leave a CR for that cleanup.
rgrinberg
approved these changes
Jul 19, 2026
Artifact lookup intentionally removes the .exe suffix from local binary keys
on Windows. Bin layouts reused those lookup keys as physical filenames, so an
action with %{bin:launcher} in its dependencies received a PATH directory
containing launcher rather than launcher.exe.
Keep the installed filename of the selected local package binary together with
the lookup name when constructing the layout. Key the layout by both names and
use the recorded lookup name when resolving the original artifact. This creates
launcher.exe for native executables while preserving declared names such as
tool.cmd.
Add a native Windows regression test covering both kinds of bin entry.
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter
force-pushed
the
bin-layout-installed-filenames
branch
from
July 20, 2026 07:55
325c4e7 to
892d033
Compare
Alizter
added a commit
that referenced
this pull request
Jul 20, 2026
avsm
pushed a commit
to ocaml/opam-repository
that referenced
this pull request
Jul 23, 2026
CHANGES: ### Fixed - Fix an internal error (`modules_and_obj_dir: failed lookup`) when generating `js_of_ocaml` archive rules for a dune file that defines two libraries with the same name distinguished by mutually exclusive `enabled_if` clauses, as `ocaml-re` does for `ppx_expect_common` (ocaml/dune#14904, fixes ocaml/dune#14775, @vouillon) - Fix passing environment variables to formatter actions (ocaml/dune#15386, @anmonteiro) - Fix missing source dependency in the sandbox when preprocessing Melange sources (ocaml/dune#15395, @anmonteiro) - Treat OCaml compiler packages version 5.5 or newer as relocatable so their installations do not use the toolchain cache (ocaml/dune#15444, fixes ocaml/dune#15443, @Alizter) - Fix `build_runtime_flags` given in a `js_of_ocaml`/`wasm_of_ocaml` field of an executable being silently ignored in separate compilation mode: such executables were given the workspace-shared standalone runtime, which is built with the default flags. Executables customizing `build_runtime_flags` now get their own standalone runtime again. (ocaml/dune#15455, @hhugo) - Use installed filenames for local package binaries in `%{bin:...}` PATH layouts on Windows (ocaml/dune#15518, fixes ocaml/dune#15512, @Alizter) ### Changed - Revert sandboxing Melange rules by default in the `(library ..)` and `(melange.emit ..)` stanzas. In Melange libraries with many modules, sandbox creation / destruction dominates build time and adds significant overhead to build time (ocaml/dune#15418, @anmonteiro)
craff
pushed a commit
to craff/opam-repository
that referenced
this pull request
Jul 25, 2026
CHANGES: ### Fixed - Fix an internal error (`modules_and_obj_dir: failed lookup`) when generating `js_of_ocaml` archive rules for a dune file that defines two libraries with the same name distinguished by mutually exclusive `enabled_if` clauses, as `ocaml-re` does for `ppx_expect_common` (ocaml/dune#14904, fixes ocaml/dune#14775, @vouillon) - Fix passing environment variables to formatter actions (ocaml/dune#15386, @anmonteiro) - Fix missing source dependency in the sandbox when preprocessing Melange sources (ocaml/dune#15395, @anmonteiro) - Treat OCaml compiler packages version 5.5 or newer as relocatable so their installations do not use the toolchain cache (ocaml/dune#15444, fixes ocaml/dune#15443, @Alizter) - Fix `build_runtime_flags` given in a `js_of_ocaml`/`wasm_of_ocaml` field of an executable being silently ignored in separate compilation mode: such executables were given the workspace-shared standalone runtime, which is built with the default flags. Executables customizing `build_runtime_flags` now get their own standalone runtime again. (ocaml/dune#15455, @hhugo) - Use installed filenames for local package binaries in `%{bin:...}` PATH layouts on Windows (ocaml/dune#15518, fixes ocaml/dune#15512, @Alizter) ### Changed - Revert sandboxing Melange rules by default in the `(library ..)` and `(melange.emit ..)` stanzas. In Melange libraries with many modules, sandbox creation / destruction dominates build time and adds significant overhead to build time (ocaml/dune#15418, @anmonteiro)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Use installed filenames when materializing
%{bin:...}PATH layouts for local package binaries.Artifact lookup keys intentionally omit
.exeon Windows, but those keys were also being used as physical layout filenames. Carry the lookup name together with the installed filename of the selected binary through the layout key instead. Native executables are therefore materialized aslauncher.exe, while explicitly named entries such astool.cmdremain unchanged.This updates the Windows regression test added in #15517 from the documented failure to the corrected behavior.
Related Issue and Motivation
Fixes #15512.
Validation
./dune.exe build @check @fmtmingw-5.4opam switch on native Windows 11Checklist