1# How to contribute 2 3We'd love to accept your patches and contributions to this project. There are 4just a few small guidelines you need to follow. 5 6## Contributor License Agreement 7 8Contributions to any Google project must be accompanied by a Contributor License 9Agreement. This is necessary because you own the copyright to your changes, even 10after your contribution becomes part of this project. So this agreement simply 11gives us permission to use and redistribute your contributions as part of the 12project. Head over to <https://cla.developers.google.com/> to see your current 13agreements on file or to sign a new one. 14 15You generally only need to submit a CLA once, so if you've already submitted one 16(even if it was for a different project), you probably don't need to do it 17again. 18 19## Code reviews 20 21All submissions, including submissions by project members, require review. We 22use GitHub pull requests for this purpose. Consult [GitHub Help] for more 23information on using pull requests. 24 25[GitHub Help]: https://help.github.com/articles/about-pull-requests/ 26 27## Building Dagger 28 29Dagger is built with [`bazel`](https://bazel.build). 30 31### Building Dagger from the command line 32 33* [Install Bazel](https://docs.bazel.build/versions/master/install.html) 34* Build the Dagger project with `bazel build <target>` 35 * Learn more about Bazel targets [here][bazel targets]. 36 * If you see an error similar to `ERROR: missing input file 37 '@androidsdk//:build-tools/26.0.2/aapt'`, install the missing build 38 tools version with the android `sdkmanager` tool. 39* Run tests with `bazel test <target>`, or `bazel test //...` to run all 40 tests 41* You can install the Dagger libraries in your **local maven repository** by 42 running the `./util/install-local-snapshot.sh` script. 43 * It will build the libraries and install them with a `LOCAL-SNAPSHOT` 44 version. 45 46[bazel targets]: https://docs.bazel.build/versions/master/build-ref.html 47 48### Importing the Dagger project in IntelliJ/Android Studio 49 50* Visit `Preferences > Plugins` in the IDE menu. 51 * Search for `bazel` and install the plugin. 52 * If no result shows up, click on `Search in repositories`, search for 53 `bazel` and install the plugin. 54* Select `Import Bazel Project`. 55* Input the path to the Dagger project under `workspace`, click `Next`. 56* Select `Generate from BUILD file`, type `BUILD` in the `Build file` input, 57 click `Next`. 58* [Android Studio only] In the `Project View` form, uncomment one of the 59 `android_sdk_platform` lines. Pick one that you have installed, then click 60 `Finish`. 61* If you get an error on Bazel sync, `Cannot run program "bazel"`, then: 62 * In the command line, run `where bazel` and copy the output (e.g. 63 `/usr/local/bin/bazel`) 64 * In Android Studio, go to `Preferences > Bazel Settings` and replace 65 `Bazel binary location` with what you just copied. 66* Note that the first sync can take a long time. When build files are changed, 67 you can run partial syncs (which should be faster) from the file menu. 68* [Android Studio only] To view the Dagger project structure, open the 69 `Project` view and switch the top selector from `Android` to `Project`. 70