{"action":"created","issue":{"url":"https://api.github.com/repos/gasche/manual-ocamlbuild/issues/19","labels_url":"https://api.github.com/repos/gasche/manual-ocamlbuild/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/gasche/manual-ocamlbuild/issues/19/comments","events_url":"https://api.github.com/repos/gasche/manual-ocamlbuild/issues/19/events","html_url":"https://github.com/gasche/manual-ocamlbuild/issues/19","id":120875078,"number":19,"title":"how to mimic _tags file within myocamlbuild.ml","user":{"login":"agarwal","id":112173,"avatar_url":"https://avatars.githubusercontent.com/u/112173?v=3","gravatar_id":"","url":"https://api.github.com/users/agarwal","html_url":"https://github.com/agarwal","followers_url":"https://api.github.com/users/agarwal/followers","following_url":"https://api.github.com/users/agarwal/following{/other_user}","gists_url":"https://api.github.com/users/agarwal/gists{/gist_id}","starred_url":"https://api.github.com/users/agarwal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agarwal/subscriptions","organizations_url":"https://api.github.com/users/agarwal/orgs","repos_url":"https://api.github.com/users/agarwal/repos","events_url":"https://api.github.com/users/agarwal/events{/privacy}","received_events_url":"https://api.github.com/users/agarwal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-12-07T21:45:14Z","updated_at":"2015-12-09T15:48:57Z","closed_at":null,"body":"Within `myocamlbuild.ml`, how can I apply some tags to files matching a filter.\r\n\r\nI know the recommended way of doing this is to define an `_tags` file, but I don't want to because:\r\n- It's just one more file cluttering my source directory.\r\n- I want to use the information that would go into it in other places also. For instance, I'd like to define a rule to generate a `.merlin` file. Thus, I need the list of packages my project uses within `myocamlbuild.ml`.\r\n- I'd rather just use OCaml as my configuration language.\r\n\r\nI tried mutating `Options.tags`, but I'm not sure that's the right variable to change and I don't know how to do this selectively on files matching a pattern."},"comment":{"url":"https://api.github.com/repos/gasche/manual-ocamlbuild/issues/comments/163299007","html_url":"https://github.com/gasche/manual-ocamlbuild/issues/19#issuecomment-163299007","issue_url":"https://api.github.com/repos/gasche/manual-ocamlbuild/issues/19","id":163299007,"user":{"login":"gasche","id":426238,"avatar_url":"https://avatars.githubusercontent.com/u/426238?v=3","gravatar_id":"","url":"https://api.github.com/users/gasche","html_url":"https://github.com/gasche","followers_url":"https://api.github.com/users/gasche/followers","following_url":"https://api.github.com/users/gasche/following{/other_user}","gists_url":"https://api.github.com/users/gasche/gists{/gist_id}","starred_url":"https://api.github.com/users/gasche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gasche/subscriptions","organizations_url":"https://api.github.com/users/gasche/orgs","repos_url":"https://api.github.com/users/gasche/repos","events_url":"https://api.github.com/users/gasche/events{/privacy}","received_events_url":"https://api.github.com/users/gasche/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T15:48:56Z","updated_at":"2015-12-09T15:48:56Z","body":"> IIUC, this would only let you specify the content of these files in a different place, which perhaps you find more convenient.\r\n\r\nYes (but if you have suggestion for \"more expressive\" things, why not). Basically, instead of creating `foo/bar.mllib` with content `Bla\\nBli`, you could add\r\n\r\n```\r\nfoo:\r\n    bar.mllib:\r\n        Bla\r\n        Bli\r\n```\r\nto `_ocamlbuild_files`, or call\r\n\r\n```\r\nOverlay.add_file [\"foo\"; \"bar.mllib\"] {|\r\n  Bla\r\n  Bli\r\n|}\r\n```\r\nfrom myocamlbuild.ml.\r\n\r\nThe interest in having this avaibility is that some users dislike having to create many files in their project to satisfy the build system. For example, people ask for the ability to use `_tags` to specify global options that affect ocamlbuild's semantics (such as `-use-ocamlfind`), while that does not fit the `_tags` model (which is justd supposed to add tags to targets). If I proposed to add a `_conf` file specifically for this purpose, many user would find this inconvenient. If I propose a single file in which to put the ocamlbuild-specific information, they may be happier.\r\n\r\n> Is it clear why they prefer _tags? I wonder if that's because writing a myocamlbuild.ml file has been so scary. A nicer user API might remove that issue.\r\n\r\nI tend to agree with you -- the very first step is to have a *documented* API and this what this manual is about. But I suspect that some users would still be ready to jump through hoops to not write OCaml code -- it would be nice to find a way to please both crowds. (I resist adding to much to _tags if it means diverging from its current simple declarative semantics, which is also why other files could be considered.)\r\n\r\n> Would users of the OCaml API benefit at all from the overlay proposal?\r\n\r\nWell the API would let you add and change things in the project tree overlay. But it may also give you more fine-grained, better typed, better ways to do things. This is similar to what you are doing right now: feeding strings to a parsing function is not really ideal but it is expressive, I'm sure you would appreciate a typeful API to build tag descriptions. (It would be rather easy to add one with one pull request exposing the type `lexer.mli:conf` to end-users.)"}}