android / android-studio-poet

Large Android projects generator
Apache License 2.0
702 stars 85 forks source link

Generate modules that depend on each other #4

Closed NikitaKozlov closed 6 years ago

NikitaKozlov commented 6 years ago

As far as I understand, currently generated modules are independent of one another. I think it would be very helpful if dependencies between modules would be generated right away.

It is quite easy to do from the code perspective, but input format is a tricky thing to define. I have two ideas:

  1. Instead of writing how many modules should be generated, a user can pass something like this: "3:4:5", that would mean that 3 module should be independent, 4 modules have 1 dependency, 5 modules should have 3 dependencies. This format is concise, but there is a couple of problem with it: 1. how to express dependencies between kotlin and java modules. 2. How to take into account transitive dependencies.

  2. A user can pass a list of pairs that describe dependencies. Then "{(1 -> 2), (2 -> 3)}" would mean that first module depends on second and second depends on third. Problem with this approach is that if a number of modules are 10-20+ then it is hard to manage this list. Plus the risk of circular dependencies.

borisf commented 6 years ago

I think the second approach is better, as it gives a control over generated module dependencies

NikitaKozlov commented 6 years ago

Done in https://github.com/borisf/java-generator/pull/6