Skip to content

Factor out rule targets into a separate module#5048

Merged
snowleopard merged 1 commit intoocaml:mainfrom
snowleopard:factor-out-targets
Oct 25, 2021
Merged

Factor out rule targets into a separate module#5048
snowleopard merged 1 commit intoocaml:mainfrom
snowleopard:factor-out-targets

Conversation

@snowleopard
Copy link
Copy Markdown
Collaborator

@snowleopard snowleopard commented Oct 23, 2021

A refactoring in preparation of #5025.

  • Create a new module Targets for representing rule targets. For now, it only represents file targets but the interface is designed to extend the module to support directory targets too. For example, various function arguments are called ~file instead of more usual ~f because directory targets will require a new argument ~dir.
  • Rename Dune_rules.Targets to Dune_rules.Targets_spec to avoid confusion.

The only slight change of behaviour is around pretty printing of targets in an error message in rule.ml: it used to simply turn paths into a string but the new Targets.pp uses Dpath.describe_target as in other places where we pretty print targets.

@snowleopard snowleopard requested review from a user, cwong-ocaml and rgrinberg October 23, 2021 13:54
@snowleopard snowleopard force-pushed the factor-out-targets branch 3 times, most recently from 2cb7946 to 43e887f Compare October 23, 2021 14:33
Signed-off-by: Andrey Mokhov <amokhov@janestreet.com>
@snowleopard snowleopard merged commit d178570 into ocaml:main Oct 25, 2021
@snowleopard snowleopard deleted the factor-out-targets branch October 25, 2021 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants