{"action":"created","issue":{"url":"https://api.github.com/repos/ocaml/ocaml/issues/286","labels_url":"https://api.github.com/repos/ocaml/ocaml/issues/286/labels{/name}","comments_url":"https://api.github.com/repos/ocaml/ocaml/issues/286/comments","events_url":"https://api.github.com/repos/ocaml/ocaml/issues/286/events","html_url":"https://github.com/ocaml/ocaml/pull/286","id":116031442,"number":286,"title":"Ocamldep modalias","user":{"login":"garrigue","id":870242,"avatar_url":"https://avatars.githubusercontent.com/u/870242?v=3","gravatar_id":"","url":"https://api.github.com/users/garrigue","html_url":"https://github.com/garrigue","followers_url":"https://api.github.com/users/garrigue/followers","following_url":"https://api.github.com/users/garrigue/following{/other_user}","gists_url":"https://api.github.com/users/garrigue/gists{/gist_id}","starred_url":"https://api.github.com/users/garrigue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garrigue/subscriptions","organizations_url":"https://api.github.com/users/garrigue/orgs","repos_url":"https://api.github.com/users/garrigue/repos","events_url":"https://api.github.com/users/garrigue/events{/privacy}","received_events_url":"https://api.github.com/users/garrigue/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":72,"created_at":"2015-11-10T05:40:17Z","updated_at":"2015-12-01T10:12:02Z","closed_at":"2015-11-30T16:17:21Z","pull_request":{"url":"https://api.github.com/repos/ocaml/ocaml/pulls/286","html_url":"https://github.com/ocaml/ocaml/pull/286","diff_url":"https://github.com/ocaml/ocaml/pull/286.diff","patch_url":"https://github.com/ocaml/ocaml/pull/286.patch"},"body":"(This description was edited. Some comments may refer to parts that have disappeared, such as support for prefixing through -oprefix / -no-prefix)\r\n\r\nThis pull request adds module alias support to ocamldep.\r\nThe idea is not necessarily to support everything, but to allow users to build their libraries using -no-alias-deps without too much hassle.\r\n\r\nThere are 2 new options added to ocamldep:\r\n\r\n* `-map name.{ml,mli}` <br>\r\nParse `name.ml` or `name.mli` and build a dependency map used by other files, if they open the module Name.\r\n\r\n* `-no-alias-deps` <br>\r\nMatch the behavior of ocamlc's -no-alias-deps, i.e. do not add dependencies for module aliases when they are not accessed. The behavior should be conservative for interface files (all dependencies are detected), but may miss dependencies for implementation files if the interface coerces some of the exported module aliases.This is only useful if the file contains module aliases.  In practice, using it only if you want to compute the dependencies of a map file seems sufficient.\r\n\r\nThere is no support for prefixing: one is supposed to have the source files name match the compiled version, using copying or symbolic links.\r\n\r\nThere is a small example in `testsuite/tests/no-alias-deps2`.\r\nIn particular, you can see there that a standard way to use it would be\r\n```\r\nocamldep -map lib.ml -open Lib LibA.ml LibB.ml LibC.ml\r\n```\r\nThis means that the bindings in the file `lib.ml` are to be used as a map, and this map is enabled in all files by `-open Lib` (otherwise one would have to add `open Lib` manually to each file where it is needed).\r\nNote that the map file is not a special file. For instance in the above example, the contents are:\r\n```\r\nmodule Packed = struct\r\n  module A = LibA\r\n  module B = LibB\r\n  module C = LibC\r\nend\r\ninclude Packed\r\n```\r\nWhich demonstrates than `include` works properly.\r\n\r\nOf course, one can alternatively write a `lib.mli`, where the contents would be:\r\n```\r\nmodule Packed : sig\r\n  ...\r\nend\r\ninclude (module type of Packed)\r\n```\r\n\r\nIf you have both a `lib.ml` and a `lib.mli`, you may want to generate dependencies for them. In that case, you should write:\r\n```\r\nocamldep -no-alias-deps lib.ml lib.mli\r\n```\r\nwhich avoids creating a circular dependency for the cmx's."},"comment":{"url":"https://api.github.com/repos/ocaml/ocaml/issues/comments/160924248","html_url":"https://github.com/ocaml/ocaml/pull/286#issuecomment-160924248","issue_url":"https://api.github.com/repos/ocaml/ocaml/issues/286","id":160924248,"user":{"login":"garrigue","id":870242,"avatar_url":"https://avatars.githubusercontent.com/u/870242?v=3","gravatar_id":"","url":"https://api.github.com/users/garrigue","html_url":"https://github.com/garrigue","followers_url":"https://api.github.com/users/garrigue/followers","following_url":"https://api.github.com/users/garrigue/following{/other_user}","gists_url":"https://api.github.com/users/garrigue/gists{/gist_id}","starred_url":"https://api.github.com/users/garrigue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garrigue/subscriptions","organizations_url":"https://api.github.com/users/garrigue/orgs","repos_url":"https://api.github.com/users/garrigue/repos","events_url":"https://api.github.com/users/garrigue/events{/privacy}","received_events_url":"https://api.github.com/users/garrigue/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T10:12:01Z","updated_at":"2015-12-01T10:12:01Z","body":"It does. And I just checked now that doing `make depend` in the main ocaml directory works (it calls the new tools/ocamldep). So this is rather strange."}}