fbecart / zinoma

Žinoma - Make your build flow incremental
MIT License
27 stars 2 forks source link

Each project should be a namespace for target names #27

Closed fbecart closed 4 years ago

fbecart commented 4 years ago

Žinoma already makes it possible to connect different projects with the imports keyword.

However, in order to avoid ambiguous situations, Žinoma also enforces manual target names disambiguation throughout projects. This means it is currently impossible for 2 targets to have the same name, even in different projects. This is a rather annoying situation. For instance, it is usually common to have a build or test target in each project, but impossible as soon as the projects depend on each other.

The proposed solution is to make each project a namespace for target names. When referencing targets from other projects, it should be possible to specify the targets' project.

fbecart commented 4 years ago

Here are some constraints:


Here's my proposal:

Any project being imported needs to define a name in its zinoma.yml. When importing projects, instead of specifying an array of paths, we'd have to specify a map of project_name to project_path. The name specified in the map should match the name specified in the imported project.

In addition to that, the namespace would now have to appear when any imported target is referenced. I suggest the format project_name::target_name.

Example

subproject1/zinoma.yml:

name: subproject1

targets:
  my_target: {}

subproject2/zinoma.yml:

imports:
  subproject1: ../subproject1

targets:
  my_target:
    dependencies: [subproject1::my_target]