amperity / lein-monolith

Leiningen plugin for working with monorepos.
Other
214 stars 18 forks source link

Implement higher-order task `with-dependency-set` #97

Closed scgerkin closed 3 months ago

scgerkin commented 3 months ago

This PR adds a new higher-order task with-dependency-set. This works by sitting between the project evaluation and task execution, overriding values in the project.clj, and then re-running project evaluation before passing along the task. Specifically, it will override the :managed-dependencies for a root project or simply add/modify the :monolith/dependency-set for a subproject.

This allows, for instance, using dependency scanners such as antq or lein-ancient to check for outdated dependencies in a dependency set.

It can also be used to perform tests, builds, etc. by overriding the dependency set used.

Unit tests are added to verify the project structure matches the provided project other than the changes required for dependency resolution. I also performed some local testing using pprint and antq to verify the behavior is as expected.

This also includes a change to how dependency sets are evaluated when declared in a subproject. The :managed-dependencies will now be replaced with the dependency set rather than merged