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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 5974A7F6CC for ; Wed, 4 Feb 2015 17:15:20 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dario.teixeira@nleyten.com) identity=pra; client-ip=217.70.183.198; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dario.teixeira@nleyten.com"; x-sender="dario.teixeira@nleyten.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of dario.teixeira@nleyten.com) identity=mailfrom; client-ip=217.70.183.198; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dario.teixeira@nleyten.com"; x-sender="dario.teixeira@nleyten.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@relay6-d.mail.gandi.net) identity=helo; client-ip=217.70.183.198; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="dario.teixeira@nleyten.com"; x-sender="postmaster@relay6-d.mail.gandi.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AEAQBrRdJUnMa3Rtlag1hZBIJ9vzSFeQKBGUMBAQEBAREBAQEBAQYNCQkULoQNAQQBIwQRRgsEBxoCJgICVyETiAoMwDmWZCCBIY4kOhaCUoFBBZJgmDoChBBvgUR+AQEB X-IPAS-Result: A0AEAQBrRdJUnMa3Rtlag1hZBIJ9vzSFeQKBGUMBAQEBAREBAQEBAQYNCQkULoQNAQQBIwQRRgsEBxoCJgICVyETiAoMwDmWZCCBIY4kOhaCUoFBBZJgmDoChBBvgUR+AQEB X-IronPort-AV: E=Sophos;i="5.09,518,1418079600"; d="scan'208";a="98857021" Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 04 Feb 2015 17:15:19 +0100 Received: from mfilter22-d.gandi.net (mfilter22-d.gandi.net [217.70.178.150]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id 8EA11FB87D for ; Wed, 4 Feb 2015 17:15:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter22-d.gandi.net Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by mfilter22-d.gandi.net (mfilter22-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id GwWqz-p+LNyU for ; Wed, 4 Feb 2015 17:15:18 +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 relay6-d.mail.gandi.net (Postfix) with ESMTPA id 06917FB8C7 for ; Wed, 4 Feb 2015 17:15:17 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Date: Wed, 04 Feb 2015 16:15:17 +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: <1ee7eec964558b9bcb4f0d5650449440@nleyten.com> X-Sender: dario.teixeira@nleyten.com User-Agent: Roundcube Webmail/0.9.5 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Forcing OCamlbuild to compile a file before another Hi, > I thought a bit more about this and here is a plan that seems > reasonable (I fact-checked it with Pierre Chambart and Beno=C3=AEt Vaugon) > and does not require changing ocamldep. >=20 > 1) add a notion of foo.mlalias files with content of the form >=20 > M :=3D Foo_M > Z :=3D Bar_Z > ... >=20 > with a rule .mlalias -> .cmi that generates the .ml and compiles it > with -no-alias-deps (note that by design it never has any dependency) This seems reasonable. In a sense, modules like foo.ml whose contents are just a list of aliases are already "special" in a way, and this convention emphasises that. Moreover, it has an added documentation advantage: simply by listing mlalias files a newcomer may familiarise themselves with the module aliases used in a project. > 2) add the following rules in the code that computes dependencies from > the output of ocamldep: > if the module depends on Foo (which is the name of an alias > file) and M, and (M :=3D Bar) is in foo.mlalias, then also add Bar as a > dependency And, I presume, also remove M from the module's dependency list, right? > - I considered, instead of a .mlalias file with a specific syntax, > allowing to tag any .ml file as an alias-giving files; that makes the > system more complex, because the alias-giving files may contain other > OCaml statements than alias definitions, and thus have some > dependencies (and we don't want to get in the business of trying to > guess which modules are just aliases or real dependencies, or having > to inspect .cmi files after-the-fact to rebuild the aliasing map). The > downside is that people with an existing -no-alias-deps scheme > suddenly willing to use ocamlbuild would have to rewrite some stuff > first. (The other direction can be made automatic by a .mlalias -> > .ml.inferred rule) Yeah, I see no need to overcomplicate this. > (...) > - It might be possible to implement this at the plugin level. The > .mlalias rule could be proposed as a plugin. I'm less confident about > the dependency-mangling logic, but the idea would be to overload the > existing ".ml -> .ml.depends" rule to change the .ml.depends result > (instead of its interpretation by ocamlbuild as I had in mind above). It would be of course nice if all this logic made its way into 4.03 or 4.02.2 as part of OCamlbuild's builtins. Regardless, from my perspective of someone who's not familiar with OCamlbuild's code base and inner workings, I think the most straightforward interim solution will be along the lines of what I described in my previous message: write a plugin that postprocesses OCamldep's output. Which leads me to the question: is it feasible to do the postprocessing in OCamlbuild, or will I have to write an external script that does the postprocessing and gets invoked by setting Options.ocamldep? Kind regards, Dario Teixeira