xref: /aosp_15_r20/external/webp/CONTRIBUTING.md (revision b2055c353e87c8814eb2b6b1b11112a1562253bd)
1*b2055c35SXin Li# How to Contribute
2*b2055c35SXin Li
3*b2055c35SXin LiWe'd love to accept your patches and contributions to this project. There are
4*b2055c35SXin Lijust a few small guidelines you need to follow.
5*b2055c35SXin Li
6*b2055c35SXin Li## Contributor License Agreement
7*b2055c35SXin Li
8*b2055c35SXin LiContributions to this project must be accompanied by a Contributor License
9*b2055c35SXin LiAgreement. You (or your employer) retain the copyright to your contribution;
10*b2055c35SXin Lithis simply gives us permission to use and redistribute your contributions as
11*b2055c35SXin Lipart of the project. Head over to <https://cla.developers.google.com/> to see
12*b2055c35SXin Liyour current agreements on file or to sign a new one.
13*b2055c35SXin Li
14*b2055c35SXin LiYou generally only need to submit a CLA once, so if you've already submitted one
15*b2055c35SXin Li(even if it was for a different project), you probably don't need to do it
16*b2055c35SXin Liagain.
17*b2055c35SXin Li
18*b2055c35SXin Li## Code reviews
19*b2055c35SXin Li
20*b2055c35SXin LiAll submissions, including submissions by project members, require review. We
21*b2055c35SXin Liuse a [Gerrit](https://www.gerritcodereview.com) instance hosted at
22*b2055c35SXin Lihttps://chromium-review.googlesource.com for this purpose.
23*b2055c35SXin Li
24*b2055c35SXin Li## Sending patches
25*b2055c35SXin Li
26*b2055c35SXin LiThe basic git workflow for modifying libwebp code and sending for review is:
27*b2055c35SXin Li
28*b2055c35SXin Li1.  Get the latest version of the repository locally:
29*b2055c35SXin Li
30*b2055c35SXin Li    ```sh
31*b2055c35SXin Li    git clone https://chromium.googlesource.com/webm/libwebp && cd libwebp
32*b2055c35SXin Li    ```
33*b2055c35SXin Li
34*b2055c35SXin Li2.  Copy the commit-msg script into ./git/hooks (this will add an ID to all of
35*b2055c35SXin Li    your commits):
36*b2055c35SXin Li
37*b2055c35SXin Li    ```sh
38*b2055c35SXin Li    curl -Lo .git/hooks/commit-msg https://chromium-review.googlesource.com/tools/hooks/commit-msg && chmod u+x .git/hooks/commit-msg
39*b2055c35SXin Li    ```
40*b2055c35SXin Li
41*b2055c35SXin Li3.  Modify the local copy of libwebp. Make sure the code
42*b2055c35SXin Li    [builds successfully](https://chromium.googlesource.com/webm/libwebp/+/HEAD/doc/building.md#cmake).
43*b2055c35SXin Li
44*b2055c35SXin Li4.  Choose a short and representative commit message:
45*b2055c35SXin Li
46*b2055c35SXin Li    ```sh
47*b2055c35SXin Li    git commit -a -m "Set commit message here"
48*b2055c35SXin Li    ```
49*b2055c35SXin Li
50*b2055c35SXin Li5.  Send the patch for review:
51*b2055c35SXin Li
52*b2055c35SXin Li    ```sh
53*b2055c35SXin Li    git push https://chromium-review.googlesource.com/webm/libwebp HEAD:refs/for/main
54*b2055c35SXin Li    ```
55*b2055c35SXin Li
56*b2055c35SXin Li    Go to https://chromium-review.googlesource.com to view your patch and
57*b2055c35SXin Li    request a review from the maintainers.
58*b2055c35SXin Li
59*b2055c35SXin LiSee the
60*b2055c35SXin Li[WebM Project page](https://www.webmproject.org/code/contribute/submitting-patches/)
61*b2055c35SXin Lifor additional details.
62*b2055c35SXin Li
63*b2055c35SXin Li## Code Style
64*b2055c35SXin Li
65*b2055c35SXin LiThe C code style is based on the
66*b2055c35SXin Li[Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) and
67*b2055c35SXin Li`clang-format --style=Google`, though this project doesn't use the tool to
68*b2055c35SXin Lienforce the formatting.
69*b2055c35SXin Li
70*b2055c35SXin LiCMake files are formatted with
71*b2055c35SXin Li[cmake-format](https://cmake-format.readthedocs.io/en/latest/). `cmake-format
72*b2055c35SXin Li-i` can be used to format individual files, it will use the settings from
73*b2055c35SXin Li`.cmake-format.py`.
74*b2055c35SXin Li
75*b2055c35SXin Li## Community Guidelines
76*b2055c35SXin Li
77*b2055c35SXin LiThis project follows
78*b2055c35SXin Li[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
79