-
Notifications
You must be signed in to change notification settings - Fork 157
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
Use MDX to test the README example #991
Conversation
Following the recent MDX release (thanks @NathanReb!), this can now be considered for merge. |
CI fails due to ocaml/dune#3650, so this is blocked. |
The issue in dune has been fixed in 2.7.0. Could you rebase your PR and see if that makes things go better? |
aa95ed4
to
06b52af
Compare
Travis isn't updating properly to demonstrate it, but I'm fairly sure that this issue hasn't been fixed in Dune 2.7.0. In the linked PR, I improved the error message in the case where not all packages listed in the @NathanReb is aware of the issue and seems to have plans to fix it, although I don't know if there's an issue anywhere tracking that. Until that's fixed, we're once again blocked on using MDX this way. |
|
||
(* Run the program *) | ||
let () = Lwt_main.run main | ||
``` | ||
|
||
The example is contained in `examples/readme.ml`. It can be compiled and executed with dune: | ||
|
||
```bash | ||
<!-- $MDX skip --> |
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.
Why is this skipped?
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.
I think mdx
has issues with running Dune from inside Dune:
|```sh
|$ dune build examples/readme.exe
-|$ dune exec examples/readme.exe
-|foo/bar => 'testing 123'
+|Error: Multiple rules generated for _build/default/examples/readme.exe:
+|- file present in source tree
+|- examples/dune:2
+|Hint: rm -f examples/readme.exe
+|[1]
+|$ dune exec examples/readme.exe
+|Error: Multiple rules generated for _build/default/examples/readme.exe:
+|- file present in source tree
+|- examples/dune:2
+|Hint: rm -f examples/readme.exe
+|[1]
but I may just be missing something 🙂
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.
that's weird, as it's something that is done in RWO without much trouble. Again please report it upstream so that it's tracked and solved properly :-)
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.
Looks to me like RWO is cheating slightly by unsetting INSIDE_DUNE
: https://github.com/realworldocaml/book/blame/master/book/testing/README.md#L544. I'll discuss this with @NathanReb when he gets back from holiday next week.
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.
Please open an issue so I can follow the discussion too ;-)
Please make sure an issue is open to keep track of this issue -- we should make sure this is fixed properly! |
The blocking problem is now tracked by ocaml/dune#3756 in Dune. |
@voodoos is the feature now available in |
I was not aware of the request for a However the development of the new stanza was slowed down after we discover an issue with ocamlfind in opam monorepos (that is in fact not related to the MDX stanza). We recently decided to resume work on it with @NathanReb. I rebased the MDX part and will probably rework the Dune part soon. I guess we can take that opportunity to add this For now it is planned for milestone 3.0. @NathanReb do you have more input on this ? |
Not particularly but being able to attach an MDX stanza to a package is definitely a required feature for multi-opam repositories. |
FYI, |
Dune 2.9 is now out with that feature. |
9029dd5
to
a0d1929
Compare
a0d1929
to
a20e99d
Compare
a20e99d
to
7f8b0c7
Compare
7f8b0c7
to
bc7f663
Compare
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.
LGTM, this makes updating the README much less error prone!
Seeing this makes me wonder if it would make sense for the tutorial code to live in the main repo so it can automatically be checked as well. I can imagine several reasons not to do that, but perhaps at some point in the future.
Resolves #986.
Requires Dune 2.4.0 for the
(mdx)
stanza. Dune 2.0+ locks are currently broken (soon to be fixed by Fix locks in rules without targets ocaml/dune#3366). This adds a fake dependencytest/irmin-unix/runtest
→test/irmin-http/runtest
to ensure that those are serialised.Requires unreleased MDX support for labels in HTML comments, so marked as draft until those are released.