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 E40C87F6CC for ; Tue, 3 Feb 2015 21:59:46 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.223.169; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.223.169 as permitted sender) identity=mailfrom; client-ip=209.85.223.169; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ie0-f169.google.com) identity=helo; client-ip=209.85.223.169; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-ie0-f169.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CGAQBfNdFUlKnfVdFag1hZBIJ9sj+PSoVxAoEZB0MBAQEBAREBAQEBBwsLCRIwhA0BAQQSER0BGxILAQMMBgULDQICCR0CAiIBEQEFAQoSBhMSEId2AQMRDbQWPjGLLoFrgneLIQoZJwMKVIUXAQEBAQEFAQEBAQEXAQUOgROOVweCaIFBBYQVNQqOBoNfgXmBFzaNVYFzEiOBDAmEET0xgkIBAQE X-IPAS-Result: A0CGAQBfNdFUlKnfVdFag1hZBIJ9sj+PSoVxAoEZB0MBAQEBAREBAQEBBwsLCRIwhA0BAQQSER0BGxILAQMMBgULDQICCR0CAiIBEQEFAQoSBhMSEId2AQMRDbQWPjGLLoFrgneLIQoZJwMKVIUXAQEBAQEFAQEBAQEXAQUOgROOVweCaIFBBYQVNQqOBoNfgXmBFzaNVYFzEiOBDAmEET0xgkIBAQE X-IronPort-AV: E=Sophos;i="5.09,515,1418079600"; d="scan'208";a="98741281" Received: from mail-ie0-f169.google.com ([209.85.223.169]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 03 Feb 2015 21:59:45 +0100 Received: by mail-ie0-f169.google.com with SMTP id rl12so28370161iec.0 for ; Tue, 03 Feb 2015 12:59:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=2gKRgvs4133ZpdLavQqlkNo507HMSdMD1nCLG+mYFug=; b=Ijfk2e6+KMDXLpXAPLSItfSlNEmZnxL7Lmyo5a1ixtPqI0zoH8f3XrshJKD6IAwrUL JsLGI+LeWw5MeFouD31rPq8k+FIahYdDaZ8XRAX8x0qouFXB4LhSD4o7/GLnr6uNhk9q uVjnBZ8JTg/0Mrr+sRBCR1Q4aMRQv2waBufxmeivly2YnWX3O7W+Wy3BIIN4xN7aRZ4s P2m+HIaUQVtQkD3qvdMBEN5VAA8WiLDJEv+yUUnmDCuproCz6SjqRDDIuPNTn2R+eh3U Dx4MiDRliyFmdR9wO+OEprEQVet2w2cvwqlc8BYAPAB19e8yalHCmaK1ywxAKsQd6tqa 8sDQ== X-Received: by 10.50.43.201 with SMTP id y9mr13548080igl.6.1422997184820; Tue, 03 Feb 2015 12:59:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.13.195 with HTTP; Tue, 3 Feb 2015 12:59:04 -0800 (PST) In-Reply-To: <281f21387ba38386a63301a18f46392e@nleyten.com> References: <281f21387ba38386a63301a18f46392e@nleyten.com> From: Gabriel Scherer Date: Tue, 3 Feb 2015 21:59:04 +0100 Message-ID: To: Dario Teixeira Cc: caml-list Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Obtaining module dependencies from within OCamlbuild plugin In OCamlbuild, most of the dependencies are detected dynamically while the compilation runs (typically the process of producing a target (eg. foo.cma) will run code that will decide to recursively produce lots of targets (eg. modules listed in foo.mllib), and those are the dynamic dependencies). Command_deps_of_tags returns the static dependencies that have been specified by tags, by using Command.dep and Command.pdep to associate dependencies to specific tags. You cannot obtain the set of dependencies of a target without actually trying to build it. (If you were interested in this for performance reason, a reasonable idea would be to cache the dependencies of the last build and replay them optimistically, but I assume that's not your point here.) On Tue, Feb 3, 2015 at 9:01 PM, Dario Teixeira wrote: > Hi, > > I'm trying to manipulate a project's dependencies from within an OCamlbuild > plugin, and one prerequisite is obtaining the current set of dependencies > for a given module. For instance, to obtain the set of dependencies for > module "src/foo_c.ml", one could expect to invoke the following from within > the After_rules hook of myocamlbuild.ml: > > Command.deps_of_tags (tags_of_pathname "src/foo_c.ml") > > This always returns an empty list, however. The same holds if one tries > to narrow the list of tags to just the filename: > > Command.deps_of_tags (Tags.of_list ["file:src/foo_c.ml"]) > > One possible explanation for this behaviour is that the set of dependencies > has not been computed yet when the After_rules hook is invoked. Is that the > case, or am I missing something altogether different? Either way, how do I > obtain the set of dependencies? > > Thanks in advance for your attention! > Kind regards, > Dario Teixeira > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs