From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 429CD7F6CD for ; Wed, 4 Feb 2015 14:18:50 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of dario.teixeira@nleyten.com) identity=pra; client-ip=217.70.183.196; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dario.teixeira@nleyten.com"; x-sender="dario.teixeira@nleyten.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of dario.teixeira@nleyten.com) identity=mailfrom; client-ip=217.70.183.196; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dario.teixeira@nleyten.com"; x-sender="dario.teixeira@nleyten.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@relay4-d.mail.gandi.net) identity=helo; client-ip=217.70.183.196; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dario.teixeira@nleyten.com"; x-sender="postmaster@relay4-d.mail.gandi.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A+AQDaG9JUnMS3Rtlag1hZBIJ9vzCFeQKBFEMBAQEBAREBAQEBAQYNCQkULoQNAQQBIxVGCwQHGgImAgJXIYgdDL9JllwMIIEhjl4WglKBQQWZSY4LgzsChBBvgUR+AQEB X-IPAS-Result: A0A+AQDaG9JUnMS3Rtlag1hZBIJ9vzCFeQKBFEMBAQEBAREBAQEBAQYNCQkULoQNAQQBIxVGCwQHGgImAgJXIYgdDL9JllwMIIEhjl4WglKBQQWZSY4LgzsChBBvgUR+AQEB X-IronPort-AV: E=Sophos;i="5.09,518,1418079600"; d="scan'208";a="120222729" Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 04 Feb 2015 14:18:47 +0100 Received: from mfilter20-d.gandi.net (mfilter20-d.gandi.net [217.70.178.148]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id 8A9D1172071 for ; Wed, 4 Feb 2015 14:18:46 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter20-d.gandi.net Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by mfilter20-d.gandi.net (mfilter20-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id zJipKSf6F4bO for ; Wed, 4 Feb 2015 14:18:45 +0100 (CET) X-Originating-IP: 10.58.1.142 Received: from webmail.gandi.net (unknown [10.58.1.142]) (Authenticated sender: dario.teixeira@nleyten.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPA id 3658B17209F for ; Wed, 4 Feb 2015 14:18:45 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 04 Feb 2015 13:18:45 +0000 From: Dario Teixeira To: caml-list@inria.fr In-Reply-To: References: <7bca26c097b73f653bd8bbfa1a07eaa8@nleyten.com> <20150123164111.GA16664@yquem.inria.fr> <0fd907ee06bedeff816160b9e7b9c027@nleyten.com> <6829d3482c94fbe2e22dd1574618e86e@nleyten.com> <5c76729753733a2ccbf1cad96879c312@nleyten.com> Message-ID: X-Sender: dario.teixeira@nleyten.com User-Agent: Roundcube Webmail/0.9.5 Subject: Re: [Caml-list] Forcing OCamlbuild to compile a file before another 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