samoht / assemblage

A collection of tools to manage the configuration of OCaml projects
54 stars 4 forks source link

Unit generation should be explicit (?) #51

Closed dbuenzli closed 10 years ago

dbuenzli commented 10 years ago

Currently unit generation is rather implicit by looking in the ~deps argument if there's an Other component. I'm not sure it's a very good idea. We should indicate in a clear manner whether we look in the source tree of if we look into the artifacts of an Other. So I think that rather than the current:

val unit : ?available:Features.t ->
       ?flags:Flags.t ->
       ?deps:component list ->
       ?dir:string -> string -> [> `Unit of comp_unit ]

we should have:

val unit : ?available:Features.t ->
       ?flags:Flags.t ->
       ?deps:component list ->
       string -> [`Dir of string | `Other of other ] -> [> `Unit of comp_unit ]

it's more verbose but I prefer verbose than too implicit (a good rule of thumb is if you fail to explain easily the docs, then it's likely you have it wrong). And remember we have let in our description language. One thing I dislike about the above proposal is the possible confusion with the [Dir of dir ] component. Src_dir, bof.

samoht commented 10 years ago

I find the Dir component name a bit confusing anyway, I think we should rename it Files.

dbuenzli commented 10 years ago

Why not but it's a little bit strange to specify a dir name for Files (especially if we wanted to allow Dirs in a Dir).

dbuenzli commented 10 years ago

Actually I think the documentation of Dir reads pretty well. But we could say that the Files component installs the build artefacts of contents in a given directory, but the actual definition of what is installed in a given directory would be non-immediate, you'd have to union all the Files that install to the same directory to understand what will be installed in that directory. I think I still prefer Dir.

samoht commented 10 years ago

Right, feel free to revert my commit. I just thing the fact that `Dir could either means source dir or target dir could be a source of confusion.

dbuenzli commented 10 years ago

Yes, we should distinguish somehow, I'm still pretty convinced Dir is quite an understandable component (tried to imagine others Pack, Build_dir, but I think it's what makes the most sence). Maybe we could use Loc of string for Assemblage.unit.