Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group targets by name #205

Open
natefinch opened this issue Dec 11, 2018 · 0 comments
Open

Group targets by name #205

natefinch opened this issue Dec 11, 2018 · 0 comments

Comments

@natefinch
Copy link
Member

I'm using mage in a monorepo project with a small set of core targets (e.g., test, build, package, deploy, etc.) that are consistent across all "sub-projects" in the monorepo. Each sub-project has its own magefile.go and there is a root-level magefile.go that "aggregates" the targets of the sub-projects' magefile.go files with some namespacing. (I say "aggregates" because currently the aggregation is hand-curated.)

My project layout looks like...

my-project/
  sub-project-A/
    magefile.go
  sub-project-B/
    magefile.go
  sub-project-C/
    magefile.go
  magefile.go

Each sub-project's targets are essentially...

$ mage -l
Targets:
  test           Runs unit tests.
  build         Compiles the project.
  package    Packages the project.
  deploy      Deploys the project.

And the (hand-curated) root-level targets are of the form...

$ mage -l
Targets:
  test:all    Runs all projects' unit tests.
  test:a      Runs project A unit tests.
  test:b      Runs project B unit tests.
  test:c      Runs project C unit tests.
  build:all  Compiles all projects.
  build:a    Compiles the A project.
  build:b    Compiles the B project.
  build:c    Compiles the C project.

It would be super helpful if mage's target import mechanism could do this all on a user's behalf by aggregating imported targets of the same name under a namespace (for example).

Originally posted by @jonasrmichel in #108 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant