-
Notifications
You must be signed in to change notification settings - Fork 176
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
Is it possible to remove the .cppo extensions? #411
Comments
I think my reading of the docs is the same as yours, however, the |
Ok, if that's the case, maybe it's better to leave it alone for now. On a bit of a tangent, I had some difficulty combining both a PPX and cppo with a We may need this to port coverage to the new Jbuilder (which I am working on now by finishing off the port of Bisect). |
I suspect the pps stanza is just about flexible enough to support a simple project with cppo, but is really all about efficiently applying a dozen ppx's at a time. I would keep up with the push to get Bisect as a first class citizen in the jbuilder world. Having used Bisect (both old and new) a few times, I find it really useful. |
Ok, it is possible to both apply a PPX and preprocess with cppo, but it requires the cppo cc @diml. This is not a high priority, but it would make files like |
It's not hard to support as jbuilder already uses intermediate files to handle preprocessing. We just need to support chains of preprocessors. Can you open a ticket on jbuilder so that we keep track of this? |
@andrewray Indeed, I remember seeing what you are reporting as well, i.e. PPX triggered before the cppo rule, and the build completely failing. That's why I applied Bisect to only the core in my crappy WIP PR :p However, I tried this more recently:
#define FOO bar
let () =
let p =
let%lwt FOO = Lwt.return () in
Lwt.return ()
in
ignore p;
prerr_endline "foo"
(jbuild_version 1)
(rule
((targets (foo.ml))
(deps (foo.cppo.ml))
(action (run ${bin:cppo} ${<} -o ${@}))))
(executable
((name foo)
(preprocess (pps (lwt.ppx)))
(libraries (lwt)))) Build:
Since it seemed to work, I assumed that I had made some kind of mistake in the past. But, perhaps not. Maybe the ordering of actions depends on some hidden factor, like filename, order of stanzas, or |
It might have been with an older version of jbuilder. Initially it was taking all files ending with |
The problem exists with the dev version of jbuilder. I've tried creating a simple example library with cppo/ppx but it works OK. Something subtle seems to be going on with lwt.unix. |
I've found the problem - I'll prepare a pull request later. |
Without looking deeply, this sounds like a Bisect problem. If so, I want to note that we are trying to move away from reading concrete syntax or dealing with |
That would also fix it. This is what's needed in the mean time:
|
That doesn't look bad. We'll probably have to (EDIT: temporarily) use it, because addressing it in Bisect_ppx could take a release or two. |
Provided by Andrew Ray (@andrewray) in #411 (comment) Note that this makes the build pass: the PPX runs and finds the source file. However, the reporter then fails, presumably due to another issue with filenames (present only with Jbuilder). So, in practice, this allows generating coverage reports for every module in the Unix binding except Lwt_unix itself. That will be addressed separately.
Provided by Andrew Ray (@andrewray) in #411 (comment)
Provided by Andrew Ray (@andrewray) in #411 (comment)
Provided by Andrew Ray (@andrewray) in #411 (comment)
Closing this, as we'll probably learn from the Jbuilder changelog when this is possible. |
We currently have two files named
src/unix/lwt_unix.cppo.ml
andsrc/unix/lwt_unix.cppo.mli
, because adding the.cppo
extension was the traditional way to identify files that need preprocessing to the cppo OCamlbuild plugin. However, this bit in the jbuilder docs suggests that it is not necessary anymore.I think it would be nice to get rid of the extension. It would have kept the history tidier if we hadn't had to introduce it in the first place. So, this is just a low-priority issue is just about tidiness in filenames and git history.
cc @andrewray for any info :)
The text was updated successfully, but these errors were encountered: