square/dagger — pull request #116 by pyricau (2012-11-18 13:32:09+00:00)
Title: @EntryPoint WIP

*This pull request should not be merged*, it's work in progress that needs feedback.

The core idea is to create a new `@EntryPoint` annotation. The processor collects all these annotations, and generates an `EntryPointsModule` class, that can be used as input to create the ObjectGraph. It's basically an alternative / complementary approach to the `dagger-androidmanifest-plugin`.

I wasn't sure about the package in which `EntryPointsModule` should live. Ideally, this would be a per project settings, but since we're not reading the `AndroidManifest.xml` (this changes are not Android specific), I couldn't come up with a good rule. So I went for `dagger.generated`, with the ability to change that with a processor parameter. We certainly want to avoid conflicting names...

List of changes:

* New @EntryPoint annotation that generates a unique entry points module for all @EntryPoint annotated classes

* Adding a new processor to handle it: EntryPointProcessor

* The processor has two options: entryPointsModulePackage and entryPointsModule to customize the package and name of the generated class. The default is dagger.generated.EntryPointsModule

* Ignoring .factorypath files (generated by eclipse when manually adding annotation processors)

* Uses a cache file (EntryPointProcessorCache.txt in dagger/generated) to maintain the list of all @EntryPoint annotated classes, needed for incremental compilation

* Adding dagger-compiler as a provided dependency to the example to make sure the processor runs (temporary fix)

* No unit / integration tests yet.

Feedback welcome!