I found a workaround in lwt, which is to add some code in myocamlbuild.ml, outside the generated part, to define appropriate tags that can then be used in _tags (more generally, lwt has several interesting tricks about oasis). For the record, here is how you can use a syntax extension internally, inside a package:

open Ocamlbuild_plugin

let () =
  dispatch
    (fun hook ->
       dispatch_default hook;
       match hook with
         | Before_options ->
             Options.make_links := false

         | After_rules ->
             (* Internal syntax extension *)
             List.iter
               (fun base ->
                  let tag = "pa_" ^ base and file = "src/syntax/pa_" ^ base ^ ".cmo" in
                  flag ["ocaml"; "compile"; tag] & S[A"-ppopt"; A file];
                  flag ["ocaml"; "ocamldep"; tag] & S[A"-ppopt"; A file];
                  flag ["ocaml"; "doc"; tag] & S[A"-ppopt"; A file];
                  dep ["ocaml"; "ocamldep"; tag] [file])
               ["syntax_ext1";"syntax_ext2"]; (* add your syntax extensions here *)
         | _ ->
             ())



2011/10/31 Philippe Veber <philippe.veber@gmail.com>
Sébastien's suggestion is indeed a good start but alas for me not enough. The build still fails at ocamldep time, because the library B (with the syntax extension) seems not to be taken into account. If I replace my syntax extension with some findlib package (say tyxml), the compilation works fine. So the question remains, how can I specify that a library/executable in a package depends on a syntax extension that is defined as a library of the same package?

Thanks to oasisdb, I've browsed a couple of packages that could be in the same situation, like a test executable for a syntax extension, but found none. Maybe I'm not dealing correctly with the situation ?

ph.


2011/10/31 Sebastien Mondet <sebastien.mondet@gmail.com>

Hi


I ran into the same problem last week.
I added a line to the _tags file after the OASIS-generated stuff:

   ...
   # OASIS_STOP

   <src/*/*.ml>: syntax_camlp4o


(found in the slide 18:


Sebastien






On Mon, Oct 31, 2011 at 12:23, Philippe Veber <philippe.veber@gmail.com> wrote:
Hi,
I have an oasis project defining three inter-dependent libraries A, B and C. B is a syntax extension, and depends on A. C depends on both A and B. I have written an _oasis file for this, which works fine if I don't use the extension in C, but fails if I do, during ocamldep (ocamldep lacks the appropriate options to understand the new syntax). Has anybody run into this problem ?

ph.