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