1*6777b538SAndroid Build Coastguard Worker# How to Contribute to Abseil 2*6777b538SAndroid Build Coastguard Worker 3*6777b538SAndroid Build Coastguard WorkerWe'd love to accept your patches and contributions to this project. There are 4*6777b538SAndroid Build Coastguard Workerjust a few small guidelines you need to follow. 5*6777b538SAndroid Build Coastguard Worker 6*6777b538SAndroid Build Coastguard WorkerNOTE: If you are new to GitHub, please start by reading [Pull Request 7*6777b538SAndroid Build Coastguard Workerhowto](https://help.github.com/articles/about-pull-requests/) 8*6777b538SAndroid Build Coastguard Worker 9*6777b538SAndroid Build Coastguard Worker## Contributor License Agreement 10*6777b538SAndroid Build Coastguard Worker 11*6777b538SAndroid Build Coastguard WorkerContributions to this project must be accompanied by a Contributor License 12*6777b538SAndroid Build Coastguard WorkerAgreement. You (or your employer) retain the copyright to your contribution, 13*6777b538SAndroid Build Coastguard Workerthis simply gives us permission to use and redistribute your contributions as 14*6777b538SAndroid Build Coastguard Workerpart of the project. Head over to <https://cla.developers.google.com/> to see 15*6777b538SAndroid Build Coastguard Workeryour current agreements on file or to sign a new one. 16*6777b538SAndroid Build Coastguard Worker 17*6777b538SAndroid Build Coastguard WorkerYou generally only need to submit a CLA once, so if you've already submitted one 18*6777b538SAndroid Build Coastguard Worker(even if it was for a different project), you probably don't need to do it 19*6777b538SAndroid Build Coastguard Workeragain. 20*6777b538SAndroid Build Coastguard Worker 21*6777b538SAndroid Build Coastguard Worker## Contribution Guidelines 22*6777b538SAndroid Build Coastguard Worker 23*6777b538SAndroid Build Coastguard WorkerPotential contributors sometimes ask us if the Abseil project is the appropriate 24*6777b538SAndroid Build Coastguard Workerhome for their utility library code or for specific functions implementing 25*6777b538SAndroid Build Coastguard Workermissing portions of the standard. Often, the answer to this question is "no". 26*6777b538SAndroid Build Coastguard WorkerWe’d like to articulate our thinking on this issue so that our choices can be 27*6777b538SAndroid Build Coastguard Workerunderstood by everyone and so that contributors can have a better intuition 28*6777b538SAndroid Build Coastguard Workerabout whether Abseil might be interested in adopting a new library. 29*6777b538SAndroid Build Coastguard Worker 30*6777b538SAndroid Build Coastguard Worker### Priorities 31*6777b538SAndroid Build Coastguard Worker 32*6777b538SAndroid Build Coastguard WorkerAlthough our mission is to augment the C++ standard library, our goal is not to 33*6777b538SAndroid Build Coastguard Workerprovide a full forward-compatible implementation of the latest standard. For us 34*6777b538SAndroid Build Coastguard Workerto consider a library for inclusion in Abseil, it is not enough that a library 35*6777b538SAndroid Build Coastguard Workeris useful. We generally choose to release a library when it meets at least one 36*6777b538SAndroid Build Coastguard Workerof the following criteria: 37*6777b538SAndroid Build Coastguard Worker 38*6777b538SAndroid Build Coastguard Worker* **Widespread usage** - Using our internal codebase to help gauge usage, most 39*6777b538SAndroid Build Coastguard Worker of the libraries we've released have tens of thousands of users. 40*6777b538SAndroid Build Coastguard Worker* **Anticipated widespread usage** - Pre-adoption of some standard-compliant 41*6777b538SAndroid Build Coastguard Worker APIs may not have broad adoption initially but can be expected to pick up 42*6777b538SAndroid Build Coastguard Worker usage when it replaces legacy APIs. `absl::from_chars`, for example, 43*6777b538SAndroid Build Coastguard Worker replaces existing code that converts strings to numbers and will therefore 44*6777b538SAndroid Build Coastguard Worker likely see usage growth. 45*6777b538SAndroid Build Coastguard Worker* **High impact** - APIs that provide a key solution to a specific problem, 46*6777b538SAndroid Build Coastguard Worker such as `absl::FixedArray`, have higher impact than usage numbers may signal 47*6777b538SAndroid Build Coastguard Worker and are released because of their importance. 48*6777b538SAndroid Build Coastguard Worker* **Direct support for a library that falls under one of the above** - When we 49*6777b538SAndroid Build Coastguard Worker want access to a smaller library as an implementation detail for a 50*6777b538SAndroid Build Coastguard Worker higher-priority library we plan to release, we may release it, as we did 51*6777b538SAndroid Build Coastguard Worker with portions of `absl/meta/type_traits.h`. One consequence of this is that 52*6777b538SAndroid Build Coastguard Worker the presence of a library in Abseil does not necessarily mean that other 53*6777b538SAndroid Build Coastguard Worker similar libraries would be a high priority. 54*6777b538SAndroid Build Coastguard Worker 55*6777b538SAndroid Build Coastguard Worker### API Freeze Consequences 56*6777b538SAndroid Build Coastguard Worker 57*6777b538SAndroid Build Coastguard WorkerVia the 58*6777b538SAndroid Build Coastguard Worker[Abseil Compatibility Guidelines](https://abseil.io/about/compatibility), we 59*6777b538SAndroid Build Coastguard Workerhave promised a large degree of API stability. In particular, we will not make 60*6777b538SAndroid Build Coastguard Workerbackward-incompatible changes to released APIs without also shipping a tool or 61*6777b538SAndroid Build Coastguard Workerprocess that can upgrade our users' code. We are not yet at the point of easily 62*6777b538SAndroid Build Coastguard Workerreleasing such tools. Therefore, at this time, shipping a library establishes an 63*6777b538SAndroid Build Coastguard WorkerAPI contract which is borderline unchangeable. (We can add new functionality, 64*6777b538SAndroid Build Coastguard Workerbut we cannot easily change existing behavior.) This constraint forces us to 65*6777b538SAndroid Build Coastguard Workervery carefully review all APIs that we ship. 66*6777b538SAndroid Build Coastguard Worker 67*6777b538SAndroid Build Coastguard Worker 68*6777b538SAndroid Build Coastguard Worker## Coding Style 69*6777b538SAndroid Build Coastguard Worker 70*6777b538SAndroid Build Coastguard WorkerTo keep the source consistent, readable, diffable and easy to merge, we use a 71*6777b538SAndroid Build Coastguard Workerfairly rigid coding style, as defined by the 72*6777b538SAndroid Build Coastguard Worker[google-styleguide](https://github.com/google/styleguide) project. All patches 73*6777b538SAndroid Build Coastguard Workerwill be expected to conform to the style outlined 74*6777b538SAndroid Build Coastguard Worker[here](https://google.github.io/styleguide/cppguide.html). 75*6777b538SAndroid Build Coastguard Worker 76*6777b538SAndroid Build Coastguard Worker## Guidelines for Pull Requests 77*6777b538SAndroid Build Coastguard Worker 78*6777b538SAndroid Build Coastguard Worker* If you are a Googler, it is required that you send us a Piper CL instead of 79*6777b538SAndroid Build Coastguard Worker using the GitHub pull-request process. The code propagation process will 80*6777b538SAndroid Build Coastguard Worker deliver the change to GitHub. 81*6777b538SAndroid Build Coastguard Worker 82*6777b538SAndroid Build Coastguard Worker* Create **small PRs** that are narrowly focused on **addressing a single 83*6777b538SAndroid Build Coastguard Worker concern**. We often receive PRs that are trying to fix several things at a 84*6777b538SAndroid Build Coastguard Worker time, but if only one fix is considered acceptable, nothing gets merged and 85*6777b538SAndroid Build Coastguard Worker both author's & review's time is wasted. Create more PRs to address 86*6777b538SAndroid Build Coastguard Worker different concerns and everyone will be happy. 87*6777b538SAndroid Build Coastguard Worker 88*6777b538SAndroid Build Coastguard Worker* For speculative changes, consider opening an [Abseil 89*6777b538SAndroid Build Coastguard Worker issue](https://github.com/abseil/abseil-cpp/issues) and discussing it first. 90*6777b538SAndroid Build Coastguard Worker If you are suggesting a behavioral or API change, consider starting with an 91*6777b538SAndroid Build Coastguard Worker [Abseil proposal template](ABSEIL_ISSUE_TEMPLATE.md). 92*6777b538SAndroid Build Coastguard Worker 93*6777b538SAndroid Build Coastguard Worker* Provide a good **PR description** as a record of **what** change is being 94*6777b538SAndroid Build Coastguard Worker made and **why** it was made. Link to a GitHub issue if it exists. 95*6777b538SAndroid Build Coastguard Worker 96*6777b538SAndroid Build Coastguard Worker* Don't fix code style and formatting unless you are already changing that 97*6777b538SAndroid Build Coastguard Worker line to address an issue. Formatting of modified lines may be done using 98*6777b538SAndroid Build Coastguard Worker `git clang-format`. PRs with irrelevant changes won't be merged. If 99*6777b538SAndroid Build Coastguard Worker you do want to fix formatting or style, do that in a separate PR. 100*6777b538SAndroid Build Coastguard Worker 101*6777b538SAndroid Build Coastguard Worker* Unless your PR is trivial, you should expect there will be reviewer comments 102*6777b538SAndroid Build Coastguard Worker that you'll need to address before merging. We expect you to be reasonably 103*6777b538SAndroid Build Coastguard Worker responsive to those comments, otherwise the PR will be closed after 2-3 104*6777b538SAndroid Build Coastguard Worker weeks of inactivity. 105*6777b538SAndroid Build Coastguard Worker 106*6777b538SAndroid Build Coastguard Worker* Maintain **clean commit history** and use **meaningful commit messages**. 107*6777b538SAndroid Build Coastguard Worker PRs with messy commit history are difficult to review and won't be merged. 108*6777b538SAndroid Build Coastguard Worker Use `rebase -i upstream/master` to curate your commit history and/or to 109*6777b538SAndroid Build Coastguard Worker bring in latest changes from master (but avoid rebasing in the middle of a 110*6777b538SAndroid Build Coastguard Worker code review). 111*6777b538SAndroid Build Coastguard Worker 112*6777b538SAndroid Build Coastguard Worker* Keep your PR up to date with upstream/master (if there are merge conflicts, 113*6777b538SAndroid Build Coastguard Worker we can't really merge your change). 114*6777b538SAndroid Build Coastguard Worker 115*6777b538SAndroid Build Coastguard Worker* **All tests need to be passing** before your change can be merged. We 116*6777b538SAndroid Build Coastguard Worker recommend you **run tests locally** (see below) 117*6777b538SAndroid Build Coastguard Worker 118*6777b538SAndroid Build Coastguard Worker* Exceptions to the rules can be made if there's a compelling reason for doing 119*6777b538SAndroid Build Coastguard Worker so. That is - the rules are here to serve us, not the other way around, and 120*6777b538SAndroid Build Coastguard Worker the rules need to be serving their intended purpose to be valuable. 121*6777b538SAndroid Build Coastguard Worker 122*6777b538SAndroid Build Coastguard Worker* All submissions, including submissions by project members, require review. 123*6777b538SAndroid Build Coastguard Worker 124*6777b538SAndroid Build Coastguard Worker## Running Tests 125*6777b538SAndroid Build Coastguard Worker 126*6777b538SAndroid Build Coastguard WorkerIf you have [Bazel](https://bazel.build/) installed, use `bazel test 127*6777b538SAndroid Build Coastguard Worker--test_tag_filters="-benchmark" ...` to run the unit tests. 128*6777b538SAndroid Build Coastguard Worker 129*6777b538SAndroid Build Coastguard WorkerIf you are running the Linux operating system and have 130*6777b538SAndroid Build Coastguard Worker[Docker](https://www.docker.com/) installed, you can also run the `linux_*.sh` 131*6777b538SAndroid Build Coastguard Workerscripts under the `ci/`(https://github.com/abseil/abseil-cpp/tree/master/ci) 132*6777b538SAndroid Build Coastguard Workerdirectory to test Abseil under a variety of conditions. 133*6777b538SAndroid Build Coastguard Worker 134*6777b538SAndroid Build Coastguard Worker## Abseil Committers 135*6777b538SAndroid Build Coastguard Worker 136*6777b538SAndroid Build Coastguard WorkerThe current members of the Abseil engineering team are the only committers at 137*6777b538SAndroid Build Coastguard Workerpresent. 138*6777b538SAndroid Build Coastguard Worker 139*6777b538SAndroid Build Coastguard Worker## Release Process 140*6777b538SAndroid Build Coastguard Worker 141*6777b538SAndroid Build Coastguard WorkerAbseil lives at head, where latest-and-greatest code can be found. 142