Skip to content

Begin factoring out the PPX - #481

Merged
aantron merged 3 commits into
masterfrom
ppx-packaging
Oct 20, 2017
Merged

aantron merged 3 commits into
masterfrom
ppx-packaging

Conversation

@aantron

@aantron aantron commented Oct 13, 2017

Copy link
Copy Markdown
Collaborator

Discussed in #338.

This is pretty much following our "normal" procedure:

  1. This commit creates an opam package lwt_ppx, containing a Findlib package lwt_ppx, which is a proxy for the current lwt.ppx (which is in opam package lwt). We will release the commit as part of 3.2.0, and announce the upcoming change.
  2. In 4.0.0, we will delete lwt.ppx and move the PPX fully to lwt_ppx.

There is one flaw: even when using lwt_ppx, PPX options still have to be passed to lwt.ppx, not to lwt_ppx. Once 4.0.0 lands, they will suddenly have to be passed to lwt_ppx. This applies only to ocamlfind and tools that use it (like Ocamlbuild). Jbuilder, or any other build tool that runs the PPX as a library linked into a driver, will handle options correctly. I looked through opam users of Lwt, and only sqlexpr seems to use lwt.ppx options, in its README and a test (cc @mfp). So, we can hope that this breakage in 4.0.0 won't be too bad.

@aantron aantron added this to the 3.2.0 milestone Oct 13, 2017
@aantron

aantron commented Oct 13, 2017

Copy link
Copy Markdown
Collaborator Author

I guess we could try duplicating the PPX in both lwt.ppx and lwt_ppx to avoid the option problem, like proposed in #370 (comment). I don't think duplicating PPXs is as harmful as duplicating libraries, though I'm not sure what will happen if there is a PPX driver being used, and one project somehow pulls both lwt.ppx and lwt_ppx in. I'd imagine that's very rare.

This commit creates a new opam package lwt_ppx, and a new Findlib
package of the same name. This Findlib package will replace lwt.ppx,
from existing opam package lwt.

For now, lwt_ppx is just an alias for lwt.ppx, so that users have
several months to gently switch over.

There is one defect: with ocamlfind and Ocamlbuild, PPX options have to
be passed to lwt.ppx, not lwt_ppx. When the switchover is complete,
uses will suddenly have to pass options to lwt_ppx. This is not a
problem when using Jbuilder and/or a PPX driver.
@aantron
aantron merged commit f7de864 into master Oct 20, 2017
@Drup

Drup commented Oct 20, 2017

Copy link
Copy Markdown
Member

Applying a ppx twice shouldn't be an issue, it should be idempotent.

How do you handle ppx.log ?

@aantron

aantron commented Oct 20, 2017

Copy link
Copy Markdown
Collaborator Author

There is no ppx.log, I think only lwt.syntax.log for the Camlp4 extension. Not yet sure what to do with Camlp4 exactly, see #370 (comment).

@aantron
aantron deleted the ppx-packaging branch October 20, 2017 12:16
aantron added a commit that referenced this pull request Nov 7, 2017
Lwt is factoring out the PPX as package lwt_ppx. We are currently in an
intermediate state, where lwt.ppx still exists as a subpackage of lwt,
but there is also lwt_ppx.

Before this commit, lwt_ppx was an alias for lwt.ppx. An unpleasant side
effect of this was that with ocamlfind, options passed to lwt_ppx were
not forwarded to lwt.ppx.

This commit instead packages the PPX independently in both lwt.ppx and
lwt_ppx. Options passed to lwt_ppx are consumed by lwt_ppx as one would
expect.

This dual packaging causes Findlib warnings about duplicate interface
ppx_lwt.cmi in packages lwt (lwt.ppx) and lwt_ppx. This shouldn't cause
problems in practice, since we expect each separate build process to
always use exactly one of lwt.ppx and lwt_ppx. The warnings should
disppear when lwt.ppx is eliminated.

Resolves #486.
See #338, #481.
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