1# Contributing to Robolectric 2 3## Getting Started 4 5Dependencies: 6 71. Android SDK with Tools, Extras, and 'Google APIs' for APIs 22 and 23 installed 8 9Set Android enviroment variables: 10 11 export ANDROID_HOME=/path-to-sdk-root 12 export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools 13 14Fork and clone the repo: 15 16 git clone git@github.com:username/robolectric.git 17 18Create a feature branch to make your changes: 19 20 git checkout -b my-feature-name 21 22Copy all required Android dependencies into your local Maven repository: 23 24 ./scripts/install-dependencies.rb 25 26Perform a full build of all shadows: 27 28 ./gradlew clean assemble install compileTestJava 29 30## Building and Testing 31 32Robolectric'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`). 33 34To include the source jar in the build: 35 36 export INCLUDE_SOURCE=1 37 38Similarly with Javadocs: 39 40 export INCLUDE_JAVADOC=1 41 42## Writing Tests 43 44Robolectric 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. 45 46## Code Style 47 48Essentially the IntelliJ default Java style, but with two-space indents. 49 501. Spaces, not tabs. 512. Two space indent. 523. Curly braces for everything: if, else, etc. 534. One line of white space between methods. 54