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