1*d9f75844SAndroid Build Coastguard Worker# Contributing to the WebRTC project 2*d9f75844SAndroid Build Coastguard Worker 3*d9f75844SAndroid Build Coastguard Worker## License Agreement 4*d9f75844SAndroid Build Coastguard Worker 5*d9f75844SAndroid Build Coastguard WorkerWebRTC welcomes patches for features and bug fixes! 6*d9f75844SAndroid Build Coastguard Worker 7*d9f75844SAndroid Build Coastguard WorkerFor contributors external to Google, follow the instructions given in the 8*d9f75844SAndroid Build Coastguard Worker[Google Individual Contributor License Agreement][Google individual CLA]. 9*d9f75844SAndroid Build Coastguard WorkerIn all cases, contributors must sign a contributor license agreement before 10*d9f75844SAndroid Build Coastguard Workera contribution can be accepted. Please complete the agreement for an 11*d9f75844SAndroid Build Coastguard Worker[individual][individual] or a [corporation][corporation] as appropriate. 12*d9f75844SAndroid Build Coastguard Worker 13*d9f75844SAndroid Build Coastguard Worker[Google Individual CLA]: https://cla.developers.google.com/about/google-individual. 14*d9f75844SAndroid Build Coastguard Worker[individual]: https://developers.google.com/open-source/cla/individual 15*d9f75844SAndroid Build Coastguard Worker[corporation]: https://developers.google.com/open-source/cla/corporate 16*d9f75844SAndroid Build Coastguard Worker 17*d9f75844SAndroid Build Coastguard Worker 18*d9f75844SAndroid Build Coastguard Worker## Instructions 19*d9f75844SAndroid Build Coastguard Worker 20*d9f75844SAndroid Build Coastguard Worker### Contributing your First Patch 21*d9f75844SAndroid Build Coastguard WorkerYou must do some preparation in order to upload your first CL: 22*d9f75844SAndroid Build Coastguard Worker 23*d9f75844SAndroid Build Coastguard Worker* [Check out and build the code][check out and build the code] 24*d9f75844SAndroid Build Coastguard Worker* Fill in the Contributor agreement (see above) 25*d9f75844SAndroid Build Coastguard Worker* If you’ve never submitted code before, you must add your 26*d9f75844SAndroid Build Coastguard Worker (or your organization’s in the case the contributor agreement is signed by 27*d9f75844SAndroid Build Coastguard Worker your organization) name and contact info to the 28*d9f75844SAndroid Build Coastguard Worker [AUTHORS][AUTHORS] file 29*d9f75844SAndroid Build Coastguard Worker* Go to [https://webrtc.googlesource.com/new-password](new-password) 30*d9f75844SAndroid Build Coastguard Worker and login with your email account. This should be the same account as 31*d9f75844SAndroid Build Coastguard Worker returned by `git config user.email` 32*d9f75844SAndroid Build Coastguard Worker* Then, run: `git cl creds-check`. If you get any errors, ask for help on 33*d9f75844SAndroid Build Coastguard Worker [discuss-webrtc][discuss-webrtc] 34*d9f75844SAndroid Build Coastguard Worker 35*d9f75844SAndroid Build Coastguard WorkerYou will not have to repeat the above. After all that, you’re ready to upload: 36*d9f75844SAndroid Build Coastguard Worker 37*d9f75844SAndroid Build Coastguard Worker[Check out and the build code]: https://webrtc.googlesource.com/src/+/refs/heads/main/docs/native-code/development/index.md 38*d9f75844SAndroid Build Coastguard Worker[AUTHORS]: https://webrtc.googlesource.com/src/+/refs/heads/main/AUTHORS 39*d9f75844SAndroid Build Coastguard Worker[new-password]: https://webrtc.googlesource.com/new-password 40*d9f75844SAndroid Build Coastguard Worker[discuss-webrtc]: https://groups.google.com/forum/#!forum/discuss-webrtc 41*d9f75844SAndroid Build Coastguard Worker 42*d9f75844SAndroid Build Coastguard Worker### Uploading your First Patch 43*d9f75844SAndroid Build Coastguard WorkerNow that you have your account set up, you can do the actual upload: 44*d9f75844SAndroid Build Coastguard Worker 45*d9f75844SAndroid Build Coastguard Worker* Do this: 46*d9f75844SAndroid Build Coastguard Worker * Assuming you're on the main branch: 47*d9f75844SAndroid Build Coastguard Worker * `git checkout -b my-work-branch` 48*d9f75844SAndroid Build Coastguard Worker * Make changes, build locally, run tests locally 49*d9f75844SAndroid Build Coastguard Worker * `git commit -am "Changed x, and it is working"` 50*d9f75844SAndroid Build Coastguard Worker * `git cl upload` 51*d9f75844SAndroid Build Coastguard Worker 52*d9f75844SAndroid Build Coastguard Worker This will open a text editor showing all local commit messages, allowing you 53*d9f75844SAndroid Build Coastguard Worker to modify it before it becomes the CL description. 54*d9f75844SAndroid Build Coastguard Worker 55*d9f75844SAndroid Build Coastguard Worker Fill out the bug entry properly. Please specify the issue tracker prefix and 56*d9f75844SAndroid Build Coastguard Worker the issue number, separated by a colon, e.g. `webrtc:123` or `chromium:12345`. 57*d9f75844SAndroid Build Coastguard Worker If you do not have an issue tracker prefix and an issue number just add `None`. 58*d9f75844SAndroid Build Coastguard Worker 59*d9f75844SAndroid Build Coastguard Worker Save and close the file to proceed with the upload to the WebRTC 60*d9f75844SAndroid Build Coastguard Worker [code review server](https://webrtc-review.googlesource.com/q/status:open). 61*d9f75844SAndroid Build Coastguard Worker 62*d9f75844SAndroid Build Coastguard Worker The command will print a link like 63*d9f75844SAndroid Build Coastguard Worker [https://webrtc-review.googlesource.com/c/src/+/53121][example CL link]. 64*d9f75844SAndroid Build Coastguard Worker if everything goes well. 65*d9f75844SAndroid Build Coastguard Worker 66*d9f75844SAndroid Build Coastguard Worker* Click this CL Link 67*d9f75844SAndroid Build Coastguard Worker* If you’re not signed in, click the Sign In button in the top right and sign 68*d9f75844SAndroid Build Coastguard Worker in with your email 69*d9f75844SAndroid Build Coastguard Worker* Click Start Review and add a reviewer. You can find reviewers in OWNERS files 70*d9f75844SAndroid Build Coastguard Worker around the repository (take the one closest to your changes) 71*d9f75844SAndroid Build Coastguard Worker* Address any reviewer feedback: 72*d9f75844SAndroid Build Coastguard Worker * Make changes, build locally, run tests locally 73*d9f75844SAndroid Build Coastguard Worker * `git commit -am "Fixed X and Y"` 74*d9f75844SAndroid Build Coastguard Worker * `git cl upload` 75*d9f75844SAndroid Build Coastguard Worker* Once the reviewer LGTMs (approves) the patch, ask them to put it into the 76*d9f75844SAndroid Build Coastguard Worker commit queue 77*d9f75844SAndroid Build Coastguard Worker 78*d9f75844SAndroid Build Coastguard WorkerNOTICE: On Windows, you’ll need to run the above in a Git bash shell in order 79*d9f75844SAndroid Build Coastguard Workerfor gclient to find the `.gitcookies` file. 80*d9f75844SAndroid Build Coastguard Worker 81*d9f75844SAndroid Build Coastguard Worker[example CL link]: https://webrtc-review.googlesource.com/c/src/+/53121 82*d9f75844SAndroid Build Coastguard Worker 83*d9f75844SAndroid Build Coastguard Worker### Trybots 84*d9f75844SAndroid Build Coastguard Worker 85*d9f75844SAndroid Build Coastguard WorkerIf you're working a lot in WebRTC, you can apply for *try rights*. This means you 86*d9f75844SAndroid Build Coastguard Workercan run the *trybots*, which run all the tests on all platforms. To do this, 87*d9f75844SAndroid Build Coastguard Workerfile a bug using this [template][template-access] and the WebRTC EngProd team 88*d9f75844SAndroid Build Coastguard Workerwill review your request. 89*d9f75844SAndroid Build Coastguard Worker 90*d9f75844SAndroid Build Coastguard WorkerTo run a tryjob, upload a CL as described above and click either CQ dry run or 91*d9f75844SAndroid Build Coastguard WorkerChoose Trybots in the Gerrit UI. You need to have try rights for this. Otherwise, 92*d9f75844SAndroid Build Coastguard Workerask your reviewer to kick off the bots for you. 93*d9f75844SAndroid Build Coastguard Worker 94*d9f75844SAndroid Build Coastguard WorkerIf you encounter any issues with the bots (flakiness, failing unrelated to your change etc), 95*d9f75844SAndroid Build Coastguard Workerplease file a bug using this [template][template-issue]. 96*d9f75844SAndroid Build Coastguard Worker 97*d9f75844SAndroid Build Coastguard Worker[template-access]: https://bugs.chromium.org/p/webrtc/issues/entry?template=Get+tryjob+access 98*d9f75844SAndroid Build Coastguard Worker[template-issue]: https://bugs.chromium.org/p/webrtc/issues/entry?template=trybot+issue 99*d9f75844SAndroid Build Coastguard Worker 100