wilkinsona / project-generator

3 stars 4 forks source link

Allow the build to resolve elements backed by the metadata by id #55

Closed snicoll closed 5 years ago

snicoll commented 5 years ago

Let's improve Build to be able to easily add item that are known by the metadata, that is: dependencies, boms and repositories.

Each of those could use a dedicated object rather than returning a raw list. This dedicated object could have additional methods to filter and manipulate the elements.

In order to make that link, we need an BuildResolver interface of some sort where given an id an element is returned or an exception is thrown which will allow use to have something like addDependency(String id).

In the integration layer, the metadata can implement this interface so that a "smart' Build instance can be created as easily as new GradleBuild(metadata).

snicoll commented 5 years ago

@wilkinsona I've started to hack on this one, see 1a14914. I was wondering if you could have a look to the general direction. The idea is to extend this notion of container to BOMs and repositories. On the initializr side, we'd need to create the Build instance with another BuildItemResolver implementation (typically the metadata or something that's wrapping it) could implement that interface).

wilkinsona commented 5 years ago

👍 Looks good to me.