From: Dario Teixeira <dario.teixeira@nleyten.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Forcing OCamlbuild to compile a file before another
Date: Wed, 04 Feb 2015 13:18:45 +0000 [thread overview]
Message-ID: <cc9b917fa88638f555e64dd1babb801c@nleyten.com> (raw)
In-Reply-To: <CAPFanBEMeXE3Qem3cLCa1HtaR+j4FBEvgWZsV944hhp-_nRGMA@mail.gmail.com>
Hello again Gabriel,
> I haven't given much thought to it yet, but here would a sketchy idea
> of how to better support -no-alias-deps in OCamlbuild:
>
> ocamldep) extend ocamldep with a new -paths (as an extension over
> -modules) that returns not just the modules M appearing at the
> beginning of paths in source files, but the full module-longident (eg.
> M.Foo.Bar if you access the value M.Foo.Bar.baz or constructor
> M.Foo.Bar.Foobar)
>
> ocamlbuild) use ocamldep -modules (this happens in
> ocaml_utils.ml:read_path_dependencies), and for a non-singleton path
> of the form Foo.Bar, first type-check the compilation unit Foo, then
> inspect the .cmi to know whether Bar is defined as a module alias of
> Foo, and in that case depend on the aliased compilation unit
>
> (This should be done as a modification to the tool itself rather than
> a plugin, I think.)
Yes, I agree that all these tweaks to support -no-alias-deps should
ideally be part of OCamlbuild+OCamldep and work out-of-the-box.
Moreover, the modifications you suggest are in line with what I'm
planning to implement as a myocamlbuild plugin (I'll have to do it
as a plugin because I don't want to wait for a future OCaml release).
The table below lists the dependencies of my dummy project, as computed
by the alias-oblivious OCamldep and what they actually are:
OCamldep: Actual:
Foo.ml: Foo_a, Foo_b, Foo_c (none)
Foo_a.ml: Foo Foo
Foo_b.ml: Foo, A Foo, Foo_a
Foo_c.ml: Foo, A, B Foo, Foo_a, Foo_b
So basically I'll postprocess the output of OCamldep: whenever it finds
that a module depends both on Foo and on an alias declared in Foo, then
I'll replace the alias with the actual module. In addition, all of
Foo's
dependencies must be cleared as well (it's more practical to just invoke
non_dependency for this purpose).
My initial idea was to manipulate the dependency graph instead of
resorting
to postprocessing OCamldep's output. Alas, as you made clear on your
other
message, OCamlbuild does not actually construct a dependency graph
before
the "real" compilation starts.
Thanks again for your time!
Kind regards,
Dario Teixeira
next prev parent reply other threads:[~2015-02-04 13:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-23 15:08 Dario Teixeira
2015-01-23 16:41 ` Francois Pottier
2015-01-23 19:09 ` Dario Teixeira
2015-01-24 12:56 ` Gabriel Scherer
2015-01-25 18:16 ` Dario Teixeira
2015-01-26 12:30 ` Dario Teixeira
2015-02-03 21:13 ` Gabriel Scherer
2015-02-04 13:18 ` Dario Teixeira [this message]
2015-02-04 14:52 ` Gabriel Scherer
2015-02-04 16:15 ` Dario Teixeira
2015-02-04 16:44 ` Gabriel Scherer
2015-02-06 17:01 ` Dario Teixeira
2015-02-06 17:05 ` Gabriel Scherer
2015-02-06 18:58 ` Dario Teixeira
2015-02-15 10:41 ` Gabriel Scherer
2015-02-15 13:55 ` Dario Teixeira
2015-02-15 14:42 ` Gabriel Scherer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc9b917fa88638f555e64dd1babb801c@nleyten.com \
--to=dario.teixeira@nleyten.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox