diff --git a/docs/contributing.md b/docs/contributing.md index 2ef7f58..139c405 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -38,16 +38,11 @@ Read on to learn how to contribute a patch to DevTools source. ## Contributing to DevTools source code -The Chrome DevTools are actually a web app written in JavaScript and CSS. If -you're familiar with these technologies, you know enough to write a patch. A few -folks have already done this, giving us a colorpicker, a file picker -and other features, all contributed by developers just like you. +The Chrome DevTools are actually a web app written in JavaScript and CSS. If you're familiar with these technologies, you know enough to write a patch. A few folks have already done this, giving us a colorpicker, a file picker and other features, all contributed by developers just like you. IRC channel on [Freenode](http://webchat.freenode.net/?channels=blink): #chrome-devtools and #blink -In this guide, we'll cover how to get set up and running locally so you can -start developing and contributing to the DevTools. You may also find it helpful -to read the [Chromium guide for contributing code](http://dev.chromium.org/developers/contributing-code). +In this guide, we'll cover how to get set up and running locally so you can start developing and contributing to the DevTools. You may also find it helpful to read the [Chromium guide for contributing code](http://dev.chromium.org/developers/contributing-code).

Note: You will need to sign and submit a completed CLA (Contributor License Agreement) before we are able to consider any contributions you may wish to make.

@@ -57,20 +52,21 @@ to read the [Chromium guide for contributing code](http://dev.chromium.org/devel There are a few things you need in order to contribute to DevTools. **Get the code**
-Download the [Blink](http://www.chromium.org/blink) source code by [cloning the git repository](https://chromium.googlesource.com/chromium/blink). This process -can take anywhere between 30-60 minutes (depending on your connection).
+ +Download the [Blink](http://www.chromium.org/blink) source code by [cloning the git repository](https://chromium.googlesource.com/chromium/blink). This process can take anywhere between 30-60 minutes (depending on your connection).

+ `git clone https://chromium.googlesource.com/chromium/blink`

**Install Canary**
+ While Blink downloads, install Chrome Canary on [Mac OS / Windows](https://tools.google.com/dlpage/chromesxs) or download [the latest Chromium build](https://download-chromium.appspot.com/).
-

Note: To save you time, we created a helpful bash -script that can take care of some of the -grunt work for you. +

Note: To save you time, we created a helpful bash script that can take care of some of the grunt work for you.


**Serve devtools frontend**
+ Run a local web server. The local web server will serve files from the directory `blink/Source/devtools` on some port (e.g. `8000`). @@ -82,65 +78,43 @@ From there you can run a local server on port 8000 with the following command: python -m SimpleHTTPServer -Then, open `http://localhost:8000/front_end/inspector.html` in your favorite -browser and start debugging! +Then, open `http://localhost:8000/front_end/inspector.html` in your favorite browser and start debugging! **Why does the server need to run from the devtools directory?**
+ When remotely debugging and developing the front-end of Blink, the content of the `InspectorBackendCommands.js` file is generated based on the content of `protocol.json` instead as a fallback of the Chromium build system. The `protocol.json` file is in the parent folder of the `front_end` folder which is -`/devtools`. This is why you need to run the web server from within the `devtools` -directory. +`/devtools`. This is why you need to run the web server from within the `devtools` directory. -

Note: If you have checked out the entire Chromium source you will need to -run the web server from /src/third_party/WebKit/Source/devtools instead. +

Note: If you have checked out the entire Chromium source you will need to run the web server from /src/third_party/WebKit/Source/devtools instead.

-If your feature requires changes to the back-end code then you definitely need -to checkout and build Chromium. Otherwise, you only need to setup a web server -for the front-end files and run Chrome with remote-debugging options. +If your feature requires changes to the back-end code then you definitely need to checkout and build Chromium. Otherwise, you only need to setup a web server for the front-end files and run Chrome with remote-debugging options. -

Note: `protocol.json` describes the API between front-end and back-end. It is -used for generating API stubs for the front-end and back-end at the build stage. -When remote debugging the front-end part of the API, InspectorBackendCommands.js -is generated on the fly by front-end code. For more information, read the Chromium How-tos. +

Note: `protocol.json` describes the API between front-end and back-end. It is used for generating API stubs for the front-end and back-end at the build stage. When remote debugging the front-end part of the API, InspectorBackendCommands.js is generated on the fly by front-end code. For more information, read the Chromium How-tos.

-**Install depot_tools**
-You will need to [install the depot_tools](http://dev.chromium.org/developers/how-tos/install-depot-tools) in -order to upload your patch once your changes are completed. The -**[depot_tools](http://dev.chromium.org/developers/how-tos/depottools)** are a -package of scripts used to manage checkouts and code reviews, and it includes -commands `gclient`, `gcl`, and `git-cl` and will be useful later on. You will -still want to sync your Chromium checkout with all its dependencies however. +**Install depot_tools**
You will need to [install the depot_tools](http://dev.chromium.org/developers/how-tos/install-depot-tools) in order to upload your patch once your changes are completed. The **[depot_tools](http://dev.chromium.org/developers/how-tos/depottools)** are a package of scripts used to manage checkouts and code reviews, and it includes commands `gclient`, `gcl`, and `git-cl` and will be useful later on. You will still want to sync your Chromium checkout with all its dependencies however. Download `depot_tools` by cloning the repository: git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git Then you will need to add it to your -[PATH](http://www.google.com/url?q=http%3A%2F%2Fwww.lmgtfy.com%2F%3Fq%3DPATH%2Benvironment&sa=D&sntz=1&usg=AFQjCNEpeE0-9UdbY3wOOLl2YafKhXvyvA). -Do this by adding the following to your `.bashrc` or `.bashprofile` file or your -shell's equivalent at the end of the file. This way you won't need to reset your -`$PATH` manually each time you open a new shell. +[PATH](http://www.google.com/url?q=http%3A%2F%2Fwww.lmgtfy.com%2F%3Fq%3DPATH%2Benvironment&sa=D&sntz=1&usg=AFQjCNEpeE0-9UdbY3wOOLl2YafKhXvyvA). Do this by adding the following to your `.bashrc` or `.bashprofile` file or your shell's equivalent at the end of the file. This way you won't need to reset your `$PATH` manually each time you open a new shell. export PATH="$PATH":`pwd`/depot_tools -**Windows** -This guide is currently not tested on Windows due to not being able to -successfully add `depot_tools` to the PATH while using the default CMD line of -Windows. However, you can try Cygwin as an alternative solution. Here you can find [steps for installing depot_tools on Windows with Cygwin](http://dev.chromium.org/developers/how-tos/install-depot-tools#TOC-Windows-Cygwin-and-non-Cygwin-). -

Note: This guide includes steps for Windows throughout it, but has not been -confirmed to work due to the inability to `add depot_tools` to the PATH, while -using the Windows CMD line. + +

Note: This guide includes steps for Windows throughout it, but has not been confirmed to work due to the inability to add `depot_tools` to the PATH of Windows command line. However, you can try Cygwin as an alternative solution. Here you can find steps for installing depot_tools on Windows with Cygwin.

### Step 2: Running an edge-build of Chromium -To begin, get an [edge-build](http://www.chromium.org/getting-involved/download-chromium) of -Chromium. These are available for all platforms. +To begin, get an [edge-build](http://www.chromium.org/getting-involved/download-chromium) of Chromium. These are available for all platforms. There are a couple of [command line flags](http://www.chromium.org/developers/how-tos/run-chromium-with-flags) (or switches) that are needed when running Chromium for developing DevTools.
**
@@ -158,29 +132,25 @@ For example: Command-line flags -

Note:It's a good idea if you copy the path in Target to a text editor so -you can see the full value while adding the flags with a space between each one -to the end of the path. Then paste the entire line into the field.

+

Note:It's a good idea if you copy the path in Target to a text editor so you can see the full value while adding the flags with a space between each one to the end of the path. Then paste the entire line into the field.

**On OS X
-**Run Canary in the terminal with the flags added at the end of the path to the -program.
+**Run Canary in the terminal with the flags added at the end of the path to the program.

`/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary \ ---remote-debugging-port=9222 --no-first-run \ ---user-data-dir=blink/chromeServerProfile \ +--remote-debugging-port=9222 --no-first-run +--user-data-dir=blink/chromeServerProfile http://localhost:9222#http://localhost:8000/front_end/inspector.html`

-

Note: You will need to escape any spaces in the path with a slash "\ " as -shown in above.

+

Note: You will need to escape any spaces in the path with a slash "\ " as shown in above.


**On Linux:
**Run the chromium-browser command with the flags added after it:
-`chromium-browser --remote-debugging-port=9222 --no-first-run \ ---user-data-dir=blink/chromeServerProfile \ +`chromium-browser --remote-debugging-port=9222 --no-first-run +--user-data-dir=blink/chromeServerProfile http://localhost:9222#http://localhost:8000/front_end/inspector.html`
@@ -220,20 +190,14 @@ Here you will see a grid menu of every open page that can be inspected. Refresh Inspectable pages -This grid menu is served by a small web server running inside the first instance -of Canary which the `--remote-debugging-port=9222` parameter was passed into. -Since the web server is running from your local git repo in the -`/blink/Source/devtools` directory, so the files within the devtools folder will -be used for the inspector you see when clicking any of one these pages. +This grid menu is served by a small web server running inside the first instance of Canary which the `--remote-debugging-port=9222` parameter was passed into. Since the web server is running from your local git repo in the +`/blink/Source/devtools` directory, so the files within the devtools folder will be used for the inspector you see when clicking any of one these pages. Clicking on the thumbnail of the tab you opened. You'll then have a full tab of DevTools that's inspecting your other tab. Nice job, so far! -Notice that the URL address of this DevTools instance points to [http://localhost:8000/front_end/inspector.html](http://localhost:8000/front_end/inspector.html). -This is because of the inspector URL `http://localhost:9222#http://localhost:8000/front_end/inspector.html` -that was passed as a hash to the "Inspectable Pages" URL. It connects to -your local repo through a websocket, which you may notice, is part of the URL +Notice that the URL address of this DevTools instance points to [http://localhost:8000/front_end/inspector.html](http://localhost:8000/front_end/inspector.html). This is because of the inspector URL `http://localhost:9222#http://localhost:8000/front_end/inspector.html` that was passed as a hash to the "Inspectable Pages" URL. It connects to your local repo through a websocket, which you may notice, is part of the URL `?ws=localhost:9222/devtools/`. (You can also use DevTools to look at this WebSocket frame data). Back to hacking… @@ -242,37 +206,28 @@ Now, use your keyboard shortcut to open DevTools within this window. You now hav inspector inception -Well done. Now you can [start contributing](http://dev.chromium.org/developers/contributing-code) and -developing the DevTools front-end code located in the directory +Well done. Now you can [start contributing](http://dev.chromium.org/developers/contributing-code) and developing the DevTools front-end code located in the directory `/blink/Source/devtools/front_end`.

### Step 4: Pick a ticket -Now that you are ready to dig into the code and start developing the DevTools -source, head over to [http://crbug.com](http://crbug.com) and find the ticket -for your change and leave a comment saying you will be writing a patch for it. If you haven't decided on what you to change look through the open issues and -choose one you would like to do and leave a comment on it asking for it to be -assigned to you. +Now that you are ready to dig into the code and start developing the DevTools source, head over to [http://crbug.com](http://crbug.com) and find the ticket for your change and leave a comment saying you will be writing a patch for it. If you haven't decided on what you to change look through the open issues and choose one you would like to do and leave a comment on it asking for it to be assigned to you. -

Note: We occasionally label bugs that require a small patch but make for -good first-time contributions with GoodFirstBug. You can [filter](https://code.google.com/p/chromium/issues/list?q=label:GoodFirstBug) down the issues list to only display these. +

Note: We occasionally label bugs that require a small patch but make for good first-time contributions with GoodFirstBug. You can [filter](https://code.google.com/p/chromium/issues/list?q=label:GoodFirstBug) down the issues list to only display these.

Alternatively, if there is no existing ticket for the change, then [create a new issue](http://chromiumbugs.appspot.com/?token=3LKZrfbEU7e_Zxic4HVH3gTdvS4%3A1371938055157&role=&continue=https%3A//code.google.com/p/chromium/issues/entry.do). Be sure to describe what the change is and justify why it was needed, adding "patch to follow" to the end. **Communicate**
+ Before you start -[contributing](http://dev.chromium.org/developers/contributing-code) on a -ticket, it's a good idea to open a new thread on the [DevTools Google Group](https://groups.google.com/forum/?fromgroups#!forum/google-chrome-developer-tools) -so you can discuss anything you are unsure of or may not know about regarding -the particular ticket you will be working on. You can never over communicate. +[contributing](http://dev.chromium.org/developers/contributing-code) on a ticket, it's a good idea to open a new thread on the [DevTools Google Group](https://groups.google.com/forum/?fromgroups#!forum/google-chrome-developer-tools) so you can discuss anything you are unsure of or may not know about regarding the particular ticket you will be working on. You can never over communicate. ### Step 5: Pull, Develop, Branch, Commit -Pull the latest files from the repository and sync to be sure you are working -with the latest code.
+Pull the latest files from the repository and sync to be sure you are working with the latest code.
git pull --rebase @@ -280,13 +235,9 @@ Then create a new branch which you can make your changes on.
git checkout -b yourBugOrFeatureName -Open the DevTools on your DevTools, open your favorite code editor and start -digging through the files in your local repository directory -`/blink/Source/devtools/front_end`. +Open the DevTools on your DevTools, open your favorite code editor and start digging through the files in your local repository directory `/blink/Source/devtools/front_end`. -

Note: During development use the Refresh icon or Alt + R instead -of F5, Ctrl + R or Cmd + R as they are bound to refresh the host page which you -are using to develop the DevTools instance.

+

Note: During development use the Refresh icon or Alt + R instead of F5, Ctrl + R or Cmd + R as they are bound to refresh the host page which you are using to develop the DevTools instance.

Run your change against the Closure Compiler with: @@ -302,20 +253,16 @@ You should see "0 error(s), 0 warning(s)". 3. Should pass the closure compiler tests 4. Should be a reasonable size to review (larger patches take longer) -Once you have made your change, commit it. In your commit message include the -ticket number and specify that it's a DevTools patch. +Once you have made your change, commit it. In your commit message include the ticket number and specify that it's a DevTools patch. git commit -m "#175024 DevTools: This describes the Goat Teleporter" -It is a good idea to pull down any changes that have been added since you last -did one and merge them with your branch. +It is a good idea to pull down any changes that have been added since you last did one and merge them with your branch. -Once everything for your patch is complete, you will want to write and run -relevant layout tests. To get started with layout tests for the DevTools see the +Once everything for your patch is complete, you will want to write and run relevant layout tests. To get started with layout tests for the DevTools see the [WebKit layout tests](http://www.chromium.org/developers/testing/webkit-layout-tests) guide. -

Note: If your patch includes changes that require writing new unit tests or -UI tests, they will need to be created and included as part of the patch.

+

Note: If your patch includes changes that require writing new unit tests or UI tests, they will need to be created and included as part of the patch.

### Step 6: Upload your Patch @@ -323,18 +270,14 @@ If your patch is finished and all tests pass, upload your changes:
git cl upload --bypass-hooks -Your editor prompts you to write the patch description. Explain the -change in much detail as you like. Save and exit the editor to -finalize the patch submission. +Your editor prompts you to write the patch description. Explain the change in much detail as you like. Save and exit the editor to finalize the patch submission. -You must have an account for [codereview.chromium.org](http://codereview.chromium.org) and you'll enter in your -credentials in this process. Afterwards, you'll get the codereview URL e.g.
+You must have an account for [codereview.chromium.org](http://codereview.chromium.org) and you'll enter in your credentials in this process. Afterwards, you'll get the codereview URL e.g.
`Issue created. URL: https://codereview.chromium.org/18173008". Take note of this URL, you can go to the page and view the status of it.` -Now you just have to wait for your friendly neighborhood reviewers to check -things out to make sure it's all good. +Now you just have to wait for your friendly neighborhood reviewers to check things out to make sure it's all good. **Cleanup** @@ -345,16 +288,13 @@ Go back to master branch. ## Troubleshooting workflows -Below are a couple alternative perspectives from some of the contributors who -described their workflows and some tips you might find helpful along the way. If you run into any issues following the steps outlined in this -document above, we've documented these to help you troubleshoot things should -you run into any issues. +Below are a couple alternative perspectives from some of the contributors who described their workflows and some tips you might find helpful along the way. If you run into any issues following the steps outlined in this document above, we've documented these to help you troubleshoot things should you run into any issues. ### Alternative workflow #1 You get to pick between two workflows: **merge** or **rebase**. Both are -"_mathematically equivalent_" but you use different commands. Unless you are a -git uber-guru, the workflows and thinking for each are different.
+"_mathematically equivalent_" but you use different commands. Unless you are a git uber-guru, the workflows and thinking for each are different.
+ About half of the contributors to Chromium use this **rebase workflow**. 1. git checkout -b myAwesomeBranch @@ -370,9 +310,7 @@ About half of the contributors to Chromium use this **rebase workflow**. * should be the exact patch you're expecting to upload 11. git cl upload -The _merge workflow_ is slightly less work but you end up with merge revisions -in your history. Also, it can be harder to think of it in such that the -code/patch which you are authoring will eventually be something you apply to +The _merge workflow_ is slightly less work but you end up with merge revisions in your history. Also, it can be harder to think of it in such that the code/patch which you are authoring will eventually be something you apply to `master`. ### Alternative workflow #2 @@ -394,12 +332,9 @@ code/patch which you are authoring will eventually be something you apply to 8. If received LGTM from owners - press commit button. 9. Otherwise, fix comments in local checkout in that branch and proceed to step 3. -Sometimes you may need to rebase if the "commit" button fails on codereview -page. Some reviewers don't like rebasing during a codereview since it makes -reviewing harder for them. +Sometimes you may need to rebase if the "commit" button fails on codereview page. Some reviewers don't like rebasing during a codereview since it makes reviewing harder for them. -While waiting for comments you can switch to another branch and work -on a fix for another issue while this one is "frozen", waiting for review. +While waiting for comments you can switch to another branch and work on a fix for another issue while this one is "frozen", waiting for review. ### Running Layout tests @@ -416,13 +351,8 @@ On a Mac or Linux machine you can simply run: If you have problems with this step you can look at [Clang](https://code.google.com/p/chromium/wiki/Clang) for Mac help and the [Linux build instructions](https://code.google.com/p/chromium/wiki/LinuxBuildInstructions) for Linux help. -This will also take some time. Once it has finished providing you with warmth from your laptop then you are -good to run the layout tests which can be run with from your src directory -`webkit/tools/layout_tests/run_webkit_tests.sh`. Replace the .sh with .bat if you -are on Windows. Some failures are expected! (unfortunatly). A good process here -is to run them before you make any changes, then run them after you make your -changes. It can also take an argument to a directory so you can just point it to -the `LayoutTests/inspector` directory to run. +This will also take some time. Once it has finished providing you with warmth from your laptop then you are good to run the layout tests which can be run with from your src directory +`webkit/tools/layout_tests/run_webkit_tests.sh`. Replace the .sh with .bat if you are on Windows. Some failures are expected! (unfortunatly). A good process here is to run them before you make any changes, then run them after you make your changes. It can also take an argument to a directory so you can just point it to the `LayoutTests/inspector` directory to run. ### Frequently Asked Questions