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

Run ocamlformat from build context root #2196

Merged
merged 1 commit into from
May 27, 2019
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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ unreleased

- Support the `.cc` extension fro C++ sources (#2195, fixes #83, @rgrinberg)

- Run `ocamlformat` relative to the context root. This improves the locations of
errors. (#2196, fixes #1370, @rgrinberg)

1.9.3 (06/05/2019)
------------------

Expand Down
3 changes: 2 additions & 1 deletion src/format_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ let gen_rules_output sctx (config : Dune_file.Auto_format.t) ~output_dir =
; Target output
]
in
Some (Lazy.force ocamlformat_deps >>> Build.run ~dir exe args)
Some (Lazy.force ocamlformat_deps
>>> Build.run ~dir:(Super_context.build_dir sctx) exe args)
else
None
in
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/formatting/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ And fixable files can be promoted:
Promoting _build/default/enabled/.formatted/ocaml_file.ml to enabled/ocaml_file.ml.
Promoting _build/default/enabled/.formatted/reason_file.re to enabled/reason_file.re.
$ cat enabled/ocaml_file.ml
Sys.argv: ../../install/default/bin/ocamlformat --impl ocaml_file.ml --name ../../../enabled/ocaml_file.ml -o .formatted/ocaml_file.ml
Sys.argv: ../install/default/bin/ocamlformat --impl enabled/ocaml_file.ml --name ../../enabled/ocaml_file.ml -o enabled/.formatted/ocaml_file.ml
ocamlformat output
$ cat enabled/reason_file.re
Sys.argv: ../../install/default/bin/refmt reason_file.re
Expand Down