1# How to contribute 2 3We definitely welcome your patches and contributions to gRPC! 4 5If you are new to github, please start by reading [Pull Request howto](https://help.github.com/articles/about-pull-requests/) 6 7## Legal requirements 8 9In order to protect both you and ourselves, you will need to sign the 10[Contributor License Agreement](https://identity.linuxfoundation.org/projects/cncf). 11 12## Compiling 13 14See [COMPILING.md](COMPILING.md). Specifically, you'll generally want to set 15`skipCodegen=true` so you don't need to deal with the C++ compilation. 16 17## Code style 18 19We follow the [Google Java Style 20Guide](https://google-styleguide.googlecode.com/svn/trunk/javaguide.html). Our 21build automatically will provide warnings for style issues. 22[Eclipse](https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml) 23and 24[IntelliJ](https://raw.githubusercontent.com/google/styleguide/gh-pages/intellij-java-google-style.xml) 25style configurations are commonly useful. For IntelliJ 14, copy the style to 26`~/.IdeaIC14/config/codestyles/`, start IntelliJ, go to File > Settings > Code 27Style, and set the Scheme to `GoogleStyle`. 28 29## Maintaining clean commit history 30 31We have few conventions for keeping history clean and making code reviews easier 32for reviewers: 33 34* First line of commit messages should be in format of 35 36 `package-name: summary of change` 37 38 where the summary finishes the sentence: `This commit improves gRPC to ____________.` 39 40 for example: 41 42 `core,netty,interop-testing: add capacitive duractance to turbo encabulators` 43 44* Every time you receive a feedback on your pull request, push changes that 45 address it as a separate one or multiple commits with a descriptive commit 46 message (try avoid using vauge `addressed pr feedback` type of messages). 47 48 Project maintainers are obligated to squash those commits into one when 49 merging. 50 51## Running tests 52 53### Jetty ALPN setup for IntelliJ 54 55The tests in interop-testing project require jetty-alpn agent running in the background 56otherwise they'll fail. Here are instructions on how to setup IntellJ IDEA to enable running 57those tests in IDE: 58 59* Settings -> Build Tools -> Gradle -> Runner -> select Gradle Test Runner 60* 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. 61 62Step 1 must be taken, otherwise by the default JUnit Test Runner running a single test in IDE will trigger all the tests. 63 64## Guidelines for Pull Requests 65How to get your contributions merged smoothly and quickly. 66 67- 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. 68 69- 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). 70 71- 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. 72 73- 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. 74 75- 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. 76 77- Maintain **clean commit history** and use **meaningful commit messages**. See [maintaining clean commit history](#maintaining-clean-commit-history) for details. 78 79- Keep your PR up to date with upstream/master (if there are merge conflicts, we can't really merge your change). 80 81- **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**. 82 83- Exceptions to the rules can be made if there's a compelling reason for doing so. 84