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

If a dune file uses OCaml syntax, use ocamlformat #2014

Merged
merged 1 commit into from
Apr 9, 2019

Conversation

emillon
Copy link
Collaborator

@emillon emillon commented Apr 3, 2019

Closes #2012

I'm not sure what causes the difference in order.

Notes on this patch:

  • this reads dune files during rule generation. This might be a problem. Alternatively, it might be possible to do that in the build action.
  • enabling/disabling is defined by the formatter used, not on the file name. That is, (only dune) will not format dune files in ocaml syntax.

@emillon emillon requested review from rgrinberg and a user April 3, 2019 12:39
@emillon emillon force-pushed the format-rules-dune-ocaml-syntax branch from 1be4341 to 50ce95c Compare April 3, 2019 12:40
@ghost
Copy link

ghost commented Apr 4, 2019

BTW, I suggest to simply make dune format-dune-files ignore dune files in OCaml syntax. It's less work for the main dune doing the build and in practice dune files in OCaml syntax are not really recommended.

@rgrinberg
Copy link
Member

Btw, once we have generic actions, dune format-dune-file can be eliminated. We can just use a generic action to set up the formatting rules.

@emillon
Copy link
Collaborator Author

emillon commented Apr 9, 2019

OK I'll make the formatting rules ignore ocaml syntax. Seems simpler indeed!

@emillon emillon force-pushed the format-rules-dune-ocaml-syntax branch from 50ce95c to f52c9dd Compare April 9, 2019 11:50
@emillon
Copy link
Collaborator Author

emillon commented Apr 9, 2019

Done!

@emillon emillon force-pushed the format-rules-dune-ocaml-syntax branch from f52c9dd to 637ef8f Compare April 9, 2019 12:31
@emillon emillon merged commit 64382f8 into ocaml:master Apr 9, 2019
@emillon emillon deleted the format-rules-dune-ocaml-syntax branch April 9, 2019 12:49
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Apr 9, 2019
CHANGES:

- Warn when generated `.merlin` does not reflect the preprocessing
  specification. This occurs when multiple stanzas in the same directory use
  different preprocessing specifications. This warning can now be disabled with
  `allow_approx_merlin` (ocaml/dune#1947, fix ocaml/dune#1946, @rgrinberg)

- Watch mode: display "Success" in green and "Had errors" in red (ocaml/dune#1956,
  @emillon)

- Fix glob dependencies on installed directories (ocaml/dune#1965, @rgrinberg)

- Add support for library variants and default implementations. (ocaml/dune#1900,
  @TheLortex)

- Add experimental `$ dune init` command. This command is used to create or
  update project boilerplate. (ocaml/dune#1448, fixes ocaml/dune#159, @shonfeder)

- Experimental Coq support (fix ocaml/dune#1466, @ejgallego)

- Install .cmi files of private modules in a `.private` directory (ocaml/dune#1983, fix
  ocaml/dune#1973 @rgrinberg)

- Fix `dune subst` attempting to substitute on directories. (ocaml/dune#2000, fix ocaml/dune#1997,
  @rgrinberg)

- Do not list private modules in the generated index. (ocaml/dune#2009, fix ocaml/dune#2008,
  @rgrinberg)

- Warn instead of failing if an opam file fails to parse. This opam file can
  still be used to define scope. (ocaml/dune#2023, @rgrinberg)

- Do not crash if unable to read a directory when traversing to find root
  (ocaml/dune#2024, @rgrinberg)

- Do not exit dune if some source directories are unreadable. Instead, warn the
  user that such directories need to be ignored (ocaml/dune#2004, fix ocaml/dune#310, @rgrinberg)

- Fix nested `(binaries ..)` fields in the `env` stanza. Previously, parent
  `binaries` fields would be ignored, but instead they should be combined.
  (ocaml/dune#2029, @rgrinberg)

- Allow "." in `c_names` and `cxx_names` (ocaml/dune#2036, fix ocaml/dune#2033, @rgrinberg)

- Format rules: if a dune file uses OCaml syntax, do not format it.
  (ocaml/dune#2014, fix ocaml/dune#2012, @emillon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants