Tag-based targets in task deps not properly added to project dependencies
#1956
Unanswered
arthur-leclerc
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
I think this may just be an oversight, so have been digging into it, and this is basically the problem: The implicit inheriting of a project dependency occurs when building the project here: https://github.com/moonrepo/moon/blob/master/crates/project-builder/src/project_builder.rs#L313 But at this point, the target is still That expansion doesn't happen until way later on when we're creating graph relationships: https://github.com/moonrepo/moon/blob/master/crates/workspace/src/workspace_builder.rs#L502 I'll have to think about this a bit. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, I have some trouble with tag-based targets in task dependencies.
When using tag-based targets in a task deps of a project, the targeted project of the dependency is not being automatically added to the project where the task is defined, despite the task having the dependency in its deps.
Let me illustrate this with a concrete example.
With the following global task in
.moon/tasks/tag-terraform.yml:And x project, for example
terraform/project-x/moon.ymlusing it:When configuring a task dependency using a tag-based target on another project, let say
apps/docs/moon.yml:The project dependency is not automatically added when using a tag-based target, but are when using a direct project reference.
What I don't understand is that when I list the
docs:buildtask, I can see all the dependencies, including those using tag:$ ❯ moon task docs:build About ──── Build the documentation. Target: docs:build Project: docs Task: build Toolchain: python Type: build Process ──── [...] Depends on: - terraform/project-1:terraform/docs - terraform/project-2:terraform/docs - terraform/project-3:terraform/docs - terraform/project-4:terraform/docs - terraform/project-5:terraform/docsBut at the project level, I only see the one with the directly referenced project.
When calling the
docs:buildtask, I'm seeing the right behavior, Moon build each Terraform project docs before building the documentation.However, when trying to detect if the project have been touched, I'm not getting the right result:
Will return nothing if I modify a file in any Terraform project as these projects are not added as dependencies to the
docsproject.Similarly, when using
moon project-graph docs, I don't see my Terraform projects as dependencies when using tag-based targets.Do I really need to list all the projects here? What's the point of using tag-based targets then?
Thank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions