caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] oasis and thrift
@ 2011-03-21 20:17 Joel Reymont
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Reymont @ 2011-03-21 20:17 UTC (permalink / raw)
  To: caml-list

I'm trying to use Apache Thrift with Oasis. 

Suppose I have a project directory structure that looks like this:

protocol\
    message1.thrift
    message2.thrift
    ...
ocaml\
    project1
    project2
    ...

OCaml projects use Oasis and automatically generate *.ml from *.thrift using a custom rule in ocamlbuild, e.g.

    open Ocamlbuild_plugin;;
    open Command;;
    
    let thrift = A"thrift";;
    
    rule "thrift: %.thrift -> %_types.ml"
      ~prods:["%.ml";"%_consts.ml";"%_types.ml";"%_types.mli"]
      ~deps:["%.thrift"]
      begin 
        fun env build ->
          Cmd(S[thrift; A"-gen"; A"ocaml"; P(env "%.thrift")])
      end
    ;;

I'm skipping the issue of parsing dependencies by looking at Thrift "include" directives for now but do want to define path to protocol in the Oasis file for each project. This is so that I can pass -I to thrift above.

How can this be done with Oasis?

	Thanks, Joel 

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Caml-list] oasis and thrift
@ 2011-03-18 13:22 Joel Reymont
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Reymont @ 2011-03-18 13:22 UTC (permalink / raw)
  To: caml-list

I have Thrift files like foo.thrift and need to run 'thrift -gen ocaml -o <output dir> foo.thrift' which will produce foo.ml and some other files in the output directory. 

How do I integrate this into Oasis?

	Thanks, Joel

P.S. Oasis is awesome!

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-21 20:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-21 20:17 [Caml-list] oasis and thrift Joel Reymont
  -- strict thread matches above, loose matches on Subject: below --
2011-03-18 13:22 Joel Reymont

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).