We'd love to accept your patches and contributions to this project. There are just a few small guidelines you need to follow.
Contributions to any Google project must be accompanied by a Contributor License Agreement. This is necessary because you own the copyright to your changes, even after your contribution becomes part of this project. So this agreement simply gives us permission to use and redistribute your contributions as part of the project. Head over to https://cla.developers.google.com/ to see your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult GitHub Help for more information on using pull requests.
Dagger is built with bazel
.
Ensure that Dagger is checked out on a case-sensitive filesystem. On a
case-insensitive file system (e.g. Windows or MacOS by default) some tasks that
attempt to delete the build/
folder will also delete the bazel BUILD
files.
- Install Bazel
- Build the Dagger project with
bazel build <target>
- Learn more about Bazel targets here.
- Building Dagger's Android targets requires additional setup:
- Set the
ANDROID_HOME
environment variable to point to a directory containing the Android SDK. If you do not have the Android SDK installed, you'll have to download and unzip it first. - Install the necessary components. For example, under Linux, run:
$ANDROID_HOME/tools/bin/sdkmanager "platforms;android-32" "build-tools;32.0.0"
- If you skip this step, you will see an error similar to
ERROR: missing input file '@androidsdk//:build-tools/32.0.0/aapt'
. - You may also need to run
bazel sync
.
- If you skip this step, you will see an error similar to
- Set the
- Run tests with
bazel test <target>
, orbazel test //...
to run all tests. - You can install the Dagger libraries in your local maven repository by
running the
./util/install-local-snapshot.sh
script.- It will build the libraries and install them with a
LOCAL-SNAPSHOT
version.
- It will build the libraries and install them with a
- Visit
Preferences > Plugins
in the IDE menu.- Search for
bazel
and install the plugin. - If no result shows up, click on
Search in repositories
, search forbazel
and install the plugin.
- Search for
- Select
Import Bazel Project
. - Input the path to the Dagger project under
workspace
, clickNext
. - Select
Generate from BUILD file
, typeBUILD
in theBuild file
input, clickNext
. - [Android Studio only] In the
Project View
form, uncomment one of theandroid_sdk_platform
lines. Pick one that you have installed, then clickFinish
. - If you get an error on Bazel sync,
Cannot run program "bazel"
, then:- In the command line, run
where bazel
and copy the output (e.g./usr/local/bin/bazel
) - In Android Studio, go to
Preferences > Bazel Settings
and replaceBazel binary location
with what you just copied.
- In the command line, run
- Note that the first sync can take a long time. When build files are changed, you can run partial syncs (which should be faster) from the file menu.
- [Android Studio only] To view the Dagger project structure, open the
Project
view and switch the top selector fromAndroid
toProject
.