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

Dunification #197

Merged
merged 19 commits into from
Apr 12, 2018
Merged

Dunification #197

merged 19 commits into from
Apr 12, 2018

Conversation

Drup
Copy link
Member

@Drup Drup commented Apr 9, 2018

I think we can do it this time! :)
It's not completely finished: I need to look at the ppx failing tests, the ocsigen doc generation and sort out CI. But otherwise, it should be on the right track.

cc @rgrinberg (and @aantron ?), I would appreciate review!

tools/jbuild Outdated
(public_name tyxml.tools)
(wrapped false)
(modules tyxml_name)
(libraries (bytes))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to ever use the bytes lib with jbuilder. This library is only useful for building on <4.02 which you can't do anyway with jbuilder. On the other hand, it forces you to declare a dependency on base-bytes which depend on findlib. A big negative IMO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough!

test/jbuild Outdated
; (alias
; ((name runtest)
; (deps (html_fail.result html_fail.expected))
; (action (run diff -dEbZBt html_fail.result html_fail.expected))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you revive this test, take a look at the diff action. It streamlines the definition of such tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know about it, but it doesn't support custom flags. :/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's --diff-command to set it for your project. But you're right, this should be customizable per action as well. I'd open a ticket regarding this.

@@ -0,0 +1,2 @@
# JBUILDER_GEN
archive(byte,toploop) += "tyxml_top.cma"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to use requires and tyxml.top as opposed to archive here? It's a bit more general.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal of this is to auto-load tyxml.top in the toplevel when tyxml is #required. Do you have another way of doing that?

Copy link
Contributor

@rgrinberg rgrinberg Apr 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires(byte, toploop) += "tyxml.top" should do the same thing but also handle dependencies if your toplevel lib has dependencies. Anyway, I'm not too sure what's best here. None of it is gonna work with $ jbuilder utop anyway :/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Yes, your version is better. I should probably open a ticket about better support for this.

@Drup Drup force-pushed the dunification branch 2 times, most recently from 3b16d5e to af6f7e5 Compare April 9, 2018 19:36
@Drup Drup mentioned this pull request Apr 9, 2018
@Drup Drup force-pushed the dunification branch 3 times, most recently from f53b6b3 to 378fb09 Compare April 11, 2018 16:03
@Drup
Copy link
Member Author

Drup commented Apr 11, 2018

@rgrinberg I fixed the toplevel test in a way that is utterly disgusting, but I don't know how to do better. Do you have any propositions ?

@rgrinberg
Copy link
Contributor

What you can try and do is manually create a driver executable using your local ppx and then see if you can massage the flags to make it output what you want.

I managed to do this in my ppx_getenv2 example project: https://github.com/rgrinberg/ppx_getenv2/blob/master/test/jbuild#L16

But I used ppx_driver. You can probably get it to work with omp.driver as well.

@Drup
Copy link
Member Author

Drup commented Apr 11, 2018

@rgrinberg the ppx is not the problem. The issue is that the code that is executed by the toplevel should have visibility over the tyxml library. So, it needs a -I <the path where .cmis are>. I couldn't find a way to do that propery, so the current version just hardcode the path inside _build.

@rgrinberg
Copy link
Contributor

Oh, I see that's a bit shitty. However, can't you build a custom toplevel as an executable, include tyxml normally as a library and then use that to execute your code? You can the preprocessing of the code using the manual driver as I showed.

@Drup
Copy link
Member Author

Drup commented Apr 11, 2018

Building a custom toplevel that -linkall against a library only handles the runtime part (cmo and cmas). It doesn't bundle the cmis for typechecking. For that, you still need -I.

@rgrinberg
Copy link
Contributor

Oh yeah, I remember having to do that to make $ jbuilder utop work. Sounds like what you need are some decent rules for making toplevels. We should generalize $ jbuilder utop, I suppose. First make the utop dependency optional, and also allow the user to refer to it as a target.

@Drup
Copy link
Member Author

Drup commented Apr 12, 2018

Everything seem to be as good as it can possibly be. Merging!

@Drup Drup merged commit ee8bd04 into master Apr 12, 2018
@Drup Drup deleted the dunification branch April 13, 2018 14:44
Drup added a commit to Drup/opam-repository that referenced this pull request Nov 18, 2018
CHANGES:

* Dunify
  This also removes all the deprecated libraries (`tyxml.syntax`, `tyxml.parser`)
  and removes the ocamlfind library `tyxml.ppx` in favor of `tyxml-ppx`.
  (ocsigen/tyxml#197 by Drup, Rudi Grinberg and Anton Bachin)
* Add simplistic indentation for the Format-based printer (ocsigen/tyxml#187 by Drup)
* Allow the ppx to be used for more exotic tyxml instances, such
  as reactive elements (ocsigen/tyxml#200 by Drup)
* Add `Html.of_seq` and `Svg.of_seq`, which allow to easily import
  HTML parsed with markup in TyXML (ocsigen/tyxml#221 by Drup)

## Elements and attributes
* Add Html.txt and Svg.txt as an alias for `pcdata` (ocsigen/tyxml#222 by Drup)
* Add noopener link types (ocsigen/tyxml#198 by Jérôme Vouillon)
* Slightly relax dt content type (ocsigen/tyxml#193 by Anton Bachin)
* Add touch events (ocsigen/tyxml#211 by Malthe Borch)
* Fix handling of figcaption in the PPX (ocsigen/tyxml#219 by Drup)
Drup added a commit to Drup/opam-repository that referenced this pull request Nov 18, 2018
CHANGES:

* Dunify
  This also removes all the deprecated libraries (`tyxml.syntax`, `tyxml.parser`)
  and removes the ocamlfind library `tyxml.ppx` in favor of `tyxml-ppx`.
  (ocsigen/tyxml#197 by Drup, Rudi Grinberg and Anton Bachin)
* Add simplistic indentation for the Format-based printer (ocsigen/tyxml#187 by Drup)
* Allow the ppx to be used for more exotic tyxml instances, such
  as reactive elements (ocsigen/tyxml#200 by Drup)
* Add `Html.of_seq` and `Svg.of_seq`, which allow to easily import
  HTML parsed with markup in TyXML (ocsigen/tyxml#221 by Drup)

## Elements and attributes
* Add Html.txt and Svg.txt as an alias for `pcdata` (ocsigen/tyxml#222 by Drup)
* Add noopener link types (ocsigen/tyxml#198 by Jérôme Vouillon)
* Slightly relax dt content type (ocsigen/tyxml#193 by Anton Bachin)
* Add touch events (ocsigen/tyxml#211 by Malthe Borch)
* Fix handling of figcaption in the PPX (ocsigen/tyxml#219 by Drup)
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