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

melange: use the correct order for include_dirs load path #492

Merged
merged 2 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Unreleased
([#482](https://github.com/melange-re/melange/pull/482))
- melange: fix codegen issue accessing a nested module path that is also
`include`d ([#487](https://github.com/melange-re/melange/pull/487))
- melange: preserve the correct command-line order for load path directories
([#492](https://github.com/melange-re/melange/pull/492))

0.3.2 2022-11-19
---------------
Expand Down
6 changes: 4 additions & 2 deletions jscomp/core/res_compmisc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ let init_path () =
List.map (Misc.expand_directory Config.standard_library) dirs
in
Load_path.reset ();
List.iter Load_path.add_dir
(List.rev (Lazy.force Js_config.stdlib_path :: exp_dirs));
let exp_dirs =
List.rev_append exp_dirs [ Lazy.force Js_config.stdlib_path ]
in
List.iter Load_path.add_dir exp_dirs;
Ext_log.dwarn ~__POS__ "Compiler include dirs: %s@."
(String.concat "; " (Load_path.get_paths ()));

Expand Down
5 changes: 4 additions & 1 deletion jscomp/main/melc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ let main: Melc_cli.t -> _ Cmdliner.Term.ret
} ->
if help then `Help (`Auto, None)
else begin try
Clflags.include_dirs := include_dirs @ !Clflags.include_dirs;
Clflags.include_dirs :=
(* The OCaml compiler expects include_dirs in reverse CLI order, but
cmdliner returns it in CLI order. *)
List.rev_append include_dirs !Clflags.include_dirs;
Ext_list.iter alerts Warnings.parse_alert_option;
Ext_list.iter warnings (fun w ->
Option.iter
Expand Down