Contributions to this project must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution, this 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.
Prepare a git commit that implements the feature. Don't forget to add tests.
Ensure you've signed a Contributor License Agreement.
Create a new code review on Gerrit.
Have an automatically generated “Change Id” line in your commit message. If you haven't used Gerrit before, it will print a bash command to create the git hook and then you will need to run git commit --amend
to add the line.
See the Gerrit documentation for more information about uploading changes.
Wait for Feed team member to assign you a reviewer.
Complete a code review. Amend your existing commit and re-push to make changes to your patch.
An engineer at Google applies the patch to our internal version control system. The patch is exported as a Git commit, at which point the Gerrit code review is closed.
All pull requests must follow the Google Java style guide.
Use java_library
when possible, and android_library
when the sources depend on an android_library
or Android code.
A key feature of this library is its low impact on method count and dex size. In order to maintain this key feature of the library, we have developed a set of best practices. While maintaining a low impact is important, these best practices balance the need of low impact with the necessity of code health.
Avoid enums. Use @IntDef
and @StringDef
instead.
Limit the use of Protobufs. Protobufs add a lot of methods compared to a simple POJO. In some cases Protobufs are necessary or appropriate, such as when serialization is required and the protobuf message evolves. If using Protobufs, follow these guidelines:
has()
if possible.Trust Proguard to optimize certain things:
For internal code (I.e. not exposed to hosts), don't declare an interface if there is only one concrete implementation.
Feed libraries use Bazel in order to build. Bazel must first be setup to build Android apps. See here for instructions on how to setup Bazel for Android.
After setting up Bazel the following command will build all Feed libraries: bazel build src/main/...
The following can then be used to run all Feed library tests: bazel test src/test/...