Dependencies:
Set Android enviroment variables:
export ANDROID_HOME=/path-to-sdk-root export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Fork and clone the repo:
git clone git@github.com:username/robolectric.git
Create a feature branch to make your changes:
git checkout -b my-feature-name
Copy all required Android dependencies into your local Maven repository:
./scripts/install-dependencies.rb
Perform a full build of all shadows:
./gradlew clean assemble install compileTestJava
Robolectric's tests run against the jars that are installed in your local Maven repo. This means that for the tests to pick up your code changes, you must run mvn install
before running mvn test
. Running mvn install
will only build and install shadows for API 21. If your tests run against older versions of Android, you will need to activate a different profile (i.e. mvn test -P android-19
).
To include the source jar in the build:
export INCLUDE_SOURCE=1
Similarly with Javadocs:
export INCLUDE_JAVADOC=1
Robolectric is a unit testing framework and it is important that Robolectric itself be very well tested. All classes should have unit test classes. All public methods should have unit tests. Those classes and methods should have their possible states well tested. Pull requests without tests will be sent back to the submitter.
Essentially the IntelliJ default Java style, but with two-space indents.