robolectric/robolectric — pull request #1398 by erd (2014-11-25 00:05:55+00:00)
Title: Version specific shadows

This branch contains a first pass at KitKat support. The big feature in this PR is version specific shadows. That is, in addition to loading an appropriate version of Android at runtime, we also load a set of shadows that match the requested version of Android. In order to do this, we broke apart Robolectric into multiple modules, so we could load different shadow modules depending on the version of Android. We introduced two new modules:

* `robolectric-res` - Contains all the resource and manifest parsing code.
* `robolectric-shadows` - Contains all the shadows. The pom for this module has profiles for the different API levels we want to support. Currently, it has profiles for 15 through 19, however only API 19 contains customized shadows. The tests for all the shadows still reside in robolectric core (it was easier to keep them all together rather than break them out).

Implementing API specific shadow enhancements is done with Velocity :facepunch: We tried using an annotation processor to separate out code according to a set of annotations, but didn't like the results because it felt too verbose to actually write the shadow. We're open to suggestions!

With these changes, you should be able to test apps that have targetSdkVersion = 19. To build this branch locally, clone it, and run `scripts/install-robolectric-shadows.sh` from the root directory. That should build multiple versions of the shadows and install them in your local maven repo. We're still in the process of refining it, but would like to get some initial feedback.