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