47
edits
(Add note about testing as part of Getting started) |
(Update section on setting up the development environment. Add more explicit instructions on submitting a patch.) |
||
Line 16: | Line 16: | ||
== Setting Up Developer Environment == | == Setting Up Developer Environment == | ||
* Now, you need to set up your development environment by [https:// | * Now, you need to set up your development environment by [https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html#clone-the-sources cloning the source] with mercurial or [https://github.com/glandium/git-cinnabar/wiki/Mozilla:-A-git-workflow-for-Gecko-development with Git]. | ||
* Then you need to install dependencies with <code>mach bootstrap</code> for building Firefox. There are two ways to do this: | |||
** [recommended] Build Firefox using [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds Firefox Artifact builds]. If the issue only requires changes to privileged JavaScript code, we recommend you use this method. Artifact builds saves time because it downloads a pre-built version of Firefox sources and applies your local changes on it, instead of rebuilding all of the C++ and Rust pieces from scratch. | ** [recommended] Build Firefox using [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds Firefox Artifact builds]. If the issue only requires changes to privileged JavaScript code, we recommend you use this method. Artifact builds saves time because it downloads a pre-built version of Firefox sources and applies your local changes on it, instead of rebuilding all of the C++ and Rust pieces from scratch. | ||
*** | *** To build Firefox for Android, see the [https://firefox-source-docs.mozilla.org/mobile/android/geckoview/contributor/geckoview-quick-start.html GeckoView Contributor guide]. For a faster local development experience, we recommend to use the Artifact builds and the Android x86 target (which is especially useful to run the tests locally). | ||
** [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/ | ** [default] Build Firefox from scratch, by running <code>mach build</code> without [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Configuring_Build_Options .mozconfig]. Note: doing this can take some time. | ||
* Next, use [https://searchfox.org Searchfox] to find the code associated with your bug. | * Next, use [https://searchfox.org Searchfox] to find the code associated with your bug. | ||
* Before making any changes, use <code>mach test [path to extension test]</code> to verify that you are able to run unit tests. Being able to run existing tests (and modified or new tests) is necessary, to see that your change works as expected. | |||
==== WebExtensions APIs ==== | ==== WebExtensions APIs ==== | ||
Line 81: | Line 83: | ||
For an overview of how to submit a patch, please see [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch this page on MDN]. | For an overview of how to submit a patch, please see [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch this page on MDN]. | ||
* Create a commit with a meaningful commit message, for example <code>Bug [bug ID here] - [short description of patch here] r=[reviewer name here]</code>. | |||
** Use <code>hg com --amend</code> or <code>git commit --amend</code> to modify the last commit if you want to change the commit title or content. | |||
** If you want to combine multiple commits into one: | |||
*** With mercurial, use <code>hg histedit</code> or <code>hg rebase</code>. For more info, see [https://book.mercurial-scm.org/read/changing-history.html Mercurial - Changing history] | |||
*** With git, use <code>git rebase -i</code>. For more info, see [https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History Git - Rewriting History]. | |||
* When you are ready to have your patch reviewed, submit your patch to [https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html Phabricator]: | * When you are ready to have your patch reviewed, submit your patch to [https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html Phabricator]: | ||
** First, [https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html#creating-an-account create an account] and install the [https:// | ** First, [https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html#creating-an-account create an account] and install the [https://github.com/mozilla-conduit/review/blob/master/README.md#installation moz-phab tool]. | ||
** | ** Then [https://github.com/mozilla-conduit/review/blob/master/README.md#execution run moz-phab] to upload your commit. Each commit will become a separe patch, so combine them into one if needed. | ||
** Note that you may go through a few iterations of changes and review before your code is ready to go. | |||
** Note that you may go through a few iterations before your code is ready to go. | * If you need to make a change to a patch that has already been submitted to Phabricator, make sure you update the existing revision so the reviewers can check the interdiff and history of changes. <code>moz-phab</code> will automatically modify your commit [https://github.com/mozilla-conduit/review/blob/master/README.md#associating-a-commit-to-an-existing-phabricator-revision to add the relevant link]. | ||
* If you need to make a change to a patch that has already been submitted to Phabricator, make sure you update the existing revision so the reviewers can check the interdiff and history of changes. | * When working on unrelated changes at the same time, it is useful to work on them into separate hg bookmarks (or entire separate mozilla-central clones if you are not yet feeling confident enough with how the hg bookmarks works) or git branches. | ||
* When working on unrelated changes at the same time, it is useful to work on them into separate hg bookmarks (or entire separate mozilla-central clones if you are not yet feeling confident enough with how the hg bookmarks works) | |||
* When the patch is approved, edit your Phabricator revision and add the “Check-in needed” tag. | * When the patch is approved, edit your Phabricator revision and add the “Check-in needed” tag. | ||
* Once your patch is accepted, you can expect to see your code in an upcoming version of Firefox! | * Once your patch is accepted, you can expect to see your code in an upcoming version of Firefox! | ||
edits