amperity / lein-monolith

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

Inheritance/Performance Revamp #5

Closed greglook closed 8 years ago

greglook commented 8 years ago

This PR changes quite a bit about how lein-monolith is used at the top level. For starters, instead of a separate monolith.clj file the plugin now requires a metaproject defined. Instead of :monolith true automatically loading the merged profile, the config lives under the :monolith key in the metaproject. This simplifies configuration slightly and lends to more natural 'inherited property' config, which this PR also adds.

In addition, I tracked down a couple performance issues that were resulting in monolith tasks running very slowly. The root cause for most of them was repeatedly doing a 'full load' of the subproject definition in Leiningen. This requires fully resolving dependencies, merging profiles, running plugin hooks, the whole shebang. Instead, we're doing raw reads now, which just do the basic syntactic parsing and returns the project definition map. This is sufficient for the dependency-graph calculations we need, and is at least an order of magnitude faster:

#0.1.1
% time lein monolith info
...
Elapsed: 10.402 User: 9.49s Kernel: 0.814

#0.2.0-SNAPSHOT
% time lein monolith info
...
Elapsed: 2.003 User: 2.71s Kernel: 0.203

The main regression in this set of changes so far is that the logic for dependency conflict detection is no longer activated. I'll make a follow up PR to add a lint subtask to run it so we can keep getting warnings in CI builds.