xref: /aosp_15_r20/external/grpc-grpc-java/CONTRIBUTING.md (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1# How to contribute
2
3We definitely welcome your patches and contributions to gRPC! Please read the gRPC
4organization's [governance rules](https://github.com/grpc/grpc-community/blob/master/governance.md)
5and [contribution guidelines](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md) before proceeding.
6
7
8If you are new to github, please start by reading [Pull Request howto](https://help.github.com/articles/about-pull-requests/)
9
10## Legal requirements
11
12In order to protect both you and ourselves, you will need to sign the
13[Contributor License Agreement](https://easycla.lfx.linuxfoundation.org/). When
14you make a PR, a CLA bot will provide a link for the process.
15
16## Compiling
17
18See [COMPILING.md](COMPILING.md). Specifically, you'll generally want to set
19`skipCodegen=true` so you don't need to deal with the C++ compilation.
20
21## Code style
22
23We follow the [Google Java Style
24Guide](https://google.github.io/styleguide/javaguide.html). Our
25build automatically will provide warnings for style issues.
26[Eclipse](https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml)
27and
28[IntelliJ](https://raw.githubusercontent.com/google/styleguide/gh-pages/intellij-java-google-style.xml)
29style configurations are commonly useful. For IntelliJ 14, copy the style to
30`~/.IdeaIC14/config/codestyles/`, start IntelliJ, go to File > Settings > Code
31Style, and set the Scheme to `GoogleStyle`.
32
33## Maintaining clean commit history
34
35We have few conventions for keeping history clean and making code reviews easier
36for reviewers:
37
38* First line of commit messages should be in format of
39
40  `package-name: summary of change`
41
42  where the summary finishes the sentence: `This commit improves gRPC to ____________.`
43
44  for example:
45
46  `core,netty,interop-testing: add capacitive duractance to turbo encabulators`
47
48* Every time you receive a feedback on your pull request, push changes that
49  address it as a separate one or multiple commits with a descriptive commit
50  message (try avoid using vauge `addressed pr feedback` type of messages).
51
52  Project maintainers are obligated to squash those commits into one when
53  merging.
54
55## Running tests
56
57### Jetty ALPN setup for IntelliJ
58
59The tests in interop-testing project require jetty-alpn agent running in the background
60otherwise they'll fail. Here are instructions on how to setup IntellJ IDEA to enable running
61those tests in IDE:
62
63* Settings -> Build Tools -> Gradle -> Runner -> select Gradle Test Runner
64* View -> Tool Windows -> Gradle -> Edit Run Configuration -> Defaults -> JUnit -> Before lauch -> + -> Run Gradle task, enter the task in the build.gradle that sets the javaagent.
65
66Step 1 must be taken, otherwise by the default JUnit Test Runner running a single test in IDE will trigger all the tests.
67
68## Guidelines for Pull Requests
69How to get your contributions merged smoothly and quickly.
70
71- Create **small PRs** that are narrowly focused on **addressing a single concern**. We often times receive PRs that are trying to fix several things at a time, but only one fix is considered acceptable, nothing gets merged and both author's & review's time is wasted. Create more PRs to address different concerns and everyone will be happy.
72
73- For speculative changes, consider opening an issue and discussing it first. If you are suggesting a behavioral or API change, consider starting with a [gRFC proposal](https://github.com/grpc/proposal).
74
75- Provide a good **PR description** as a record of **what** change is being made and **why** it was made. Link to a github issue if it exists.
76
77- Don't fix code style and formatting unless you are already changing that line to address an issue. PRs with irrelevant changes won't be merged. If you do want to fix formatting or style, do that in a separate PR.
78
79- Unless your PR is trivial, you should expect there will be reviewer comments that you'll need to address before merging. We expect you to be reasonably responsive to those comments, otherwise the PR will be closed after 2-3 weeks of inactivity.
80
81- Maintain **clean commit history** and use **meaningful commit messages**. See [maintaining clean commit history](#maintaining-clean-commit-history) for details.
82
83- Keep your PR up to date with upstream/master (if there are merge conflicts, we can't really merge your change).
84
85- **All tests need to be passing** before your change can be merged. We recommend you **run tests locally** before creating your PR to catch breakages early on. Also, `./gradlew build` (`gradlew build` on Windows) **must not introduce any new warnings**.
86
87- Exceptions to the rules can be made if there's a compelling reason for doing so.
88