kumarshantanu/lein-sub — pull request #11 by ilya-pi (2013-11-15 15:15:44+00:00)
Title: Transitive dependency support

Hi Kumar,

Neat plugin — thank you!

We are using it in a rather big project with transitive dependencies, and we though it would be nice if lein-sub would've resolved them out-of-the box in a more or less automatic manner.

I've adjusted `subtest` to represent this situation.

So, dependency tree looks the following way:
```
common-child -> []
child -> [common-child]
child2 -> [common-child]
child3 -> [child2]
```

and once you run `lein sub install` in `\subtest` it will give you output like:

```
bash-3.2$ lein sub install
Building project [subtest/common-child v0.3.0-1-g4ddbb83]
Created/lein-sub/subtest/common-child/target/provided/common-child-v0.3.0-1-g4ddbb83.jar
Wrote/lein-sub/subtest/common-child/pom.xml
Building project [subtest/child v0.3.0-1-g4ddbb83]
Created/lein-sub/subtest/child/target/provided/child-v0.3.0-1-g4ddbb83.jar
Wrote/lein-sub/subtest/child/pom.xml
Building project [subtest/child2 v0.3.0-1-g4ddbb83]
Created/lein-sub/subtest/child2/target/provided/child2-v0.3.0-1-g4ddbb83.jar
Wrote/lein-sub/subtest/child2/pom.xml
Building project [subtest/child3 v0.3.0-1-g4ddbb83]
Created/lein-sub/subtest/child3/target/provided/child3-v0.3.0-1-g4ddbb83.jar
Wrote/lein-sub/subtest/child3/pom.xml
```

Might you make dependency tree as:
```
common-child -> []
child -> [common-child]
child2 -> [common-child, child2]
child3 -> [child2]
```

It will go like:
```
bash-3.2$ lein sub install
Building project [subtest/common-child v0.3.0-1-g4ddbb83]
Created/lein-sub/subtest/common-child/target/provided/common-child-v0.3.0-1-g4ddbb83.jar
Wrote/lein-sub/subtest/common-child/pom.xml
Building project [subtest/child v0.3.0-1-g4ddbb83]
Created/lein-sub/subtest/child/target/provided/child-v0.3.0-1-g4ddbb83.jar
Wrote/lein-sub/subtest/child/pom.xml
Cycle dependecy, cannot resolve proper build order for projects: #{[subtest/child3 "v0.3.0-1-g4ddbb83"] [subtest/child2 "v0.3.0-1-g4ddbb83"]}
```

And if you will make the dependency tree as:
```
common-child -> [child3]
child -> [common-child]
child2 -> [common-child, child2]
child3 -> [child2]
```

Output would be:
```
bash-3.2$ lein sub install
Cycle dependecy, cannot resolve proper build order for projects: #{[subtest/child "v0.3.0-1-g4ddbb83"] [subtest/child3 "v0.3.0-1-g4ddbb83"] [subtest/child2 "v0.3.0-1-g4ddbb83"] [subtest/common-child "v0.3.0-1-g4ddbb83"]}
```

***

So, as you see — it builds sub-projects in a recursion, unless finished or a cycle was encountered.

- Ilya