Loop/Development: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
 
(21 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Bug Tracking and Repositories ==
== Bug Tracking and Repositories ==
=== Need Help, want to discuss with Loop developers? ===
If you need help or want to discuss something with the Loop developers, then visit us on [irc://irc.mozilla.org/loop #loop on irc.mozilla.org] - if you need more information about IRC, see our [[IRC]] page.


=== Tracking ===
=== Tracking ===
Line 9: Line 13:
==== Looking for bugs? ====
==== Looking for bugs? ====


Try one of the [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&o1=substring&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=good%20first%20bug&component=Client&component=General&product=Loop&list_id=12141660 good first bugs] (simple bugs that are easy to fix) or a [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&o1=substring&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=good%20next%20bug&component=Client&component=General&product=Loop&list_id=12141660 good next bug].
Try one of the [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&o1=substring&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=good%20first%20bug&component=Client&component=General&product=Hello%20(Loop)&list_id=12141660 good first bugs] (simple bugs that are easy to fix) or a [https://bugzilla.mozilla.org/buglist.cgi?f1=status_whiteboard&o1=substring&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&v1=good%20next%20bug&component=Client&component=General&product=Hello%20(Loop)&list_id=12141660 good next bug].


There's also [https://bugzilla.mozilla.org/buglist.cgi?f1=bug_mentor&list_id=12141679&o1=isnotempty&resolution=---&emailtype1=exact&query_format=advanced&emailassigned_to1=1&email1=nobody%40mozilla.org&product=Loop mentored bugs] where are developers have signed up to help you fix the bugs. Most of these will be in the good first and next bug groups above.
There's also [https://bugzilla.mozilla.org/buglist.cgi?f1=bug_mentor&list_id=12141679&o1=isnotempty&resolution=---&emailtype1=exact&query_format=advanced&emailassigned_to1=1&email1=nobody%40mozilla.org&product=Hello%20(Loop) mentored bugs] where are developers have signed up to help you fix the bugs. Most of these will be in the good first and next bug groups above.


Or if not, take a look at our [[Firefox/Iterative_Hello_Development#Product_Backlog|ranked priority list]] and choose one from there.
Or if not, take a look at our [[Firefox/Iterative_Hello_Development#Product_Backlog|ranked priority list]] and choose one from there.


=== Repositories ===
=== Repositories ===
Loop is contained across several repositories:
Loop is contained across two repositories:


* Master repository for Desktop and Standalone UI: [http://hg.mozilla.org/mozilla-central/ mozilla-central] (there's a [https://github.com/mozilla/gecko-dev git mirror] of it as well)
* Master repository for Desktop and Standalone UI: [https://github.com/mozilla/loop Loop add-on and web frontend]
* [https://github.com/mozilla-services/loop-server Loop server]
* [https://github.com/mozilla-services/loop-server Loop server]


Line 42: Line 46:


== Getting started with Firefox Desktop and Standalone development ==
== Getting started with Firefox Desktop and Standalone development ==
'''Warning:''' most of these instructions are out of date, for correct information please see the [https://github.com/mozilla/loop loop repository] and the [https://github.com/mozilla/loop/blob/master/CONTRIBUTING.md Contributing file]


=== Additional Requirements ===
=== Additional Requirements ===


For Loop development, there's currently a couple of extra requirements on top of the [https://developer.mozilla.org/en-US/docs/Simple_Firefox_build#Build_prerequisites Firefox desktop build requirements].
For Loop development, there's currently a couple of extra requirements on top of the [https://developer.mozilla.org/en-US/docs/Simple_Firefox_build#Build_prerequisites Firefox desktop build requirements]
 
These are [https://nodejs.org/ NodeJS] (note, though, that you MUST currently use an old version, 0.10), react-tools and eslint.


These are npm and react-tools, which both require an up-to-date version of [https://nodejs.org/ NodeJS]
Note that when building Firefox itself, be sure to set <pre>ac_add_options --enable-optimize</pre> in your mozconfig to avoid problems with automated tests timing out.


Make sure you have npm installed:
Install NodeJS 0.10 first, then follow the instructions below


brew install npm
==== Mac installation of node 0.10 ====


and install react:
brew install homebrew/versions/node010


npm install -g react-tools
==== Windows Specific ====


=== Unit test and ui-showcase tools ===
There's a little bit more set-up required specific to Windows.
 
* Start up the mozilla-build shell via one of the start-shell-msvc*.bat files
* Work out your APPDATA path:
 
echo $APPDATA
 
* In your APPDATA, you'll need to replace various parts, so:
 
c:\Users\moztest\AppData\Roaming
 
becomes:
 
/c/Users/moztest/AppData/Roaming
 
* Now setup your profile file, replace the <code><path to APPDATA></code> with the path you just worked out.
 
echo PATH=$PATH:/c/Program\ Files/nodejs:<path to APPDATA>/npm >> ~/.profile
 
* Now exit your shell/console and re-enter it.
* Complete the steps in the "All Platforms" section
 
If you need to change the path later, you can edit the ~/.profile file.
 
==== All Platforms ====
 
Once you have Node installed, use npm (which comes with it) to globally install the extra required items:
 
npm install -g react-tools@0.12.2
npm install -g eslint
npm install -g eslint-plugin-react
 
=== Standalone server - Link-clicker UI and unit test development ===


We have a server that helps running the unit tests manually, there's also the ui-showcase which helps with previewing layouts before starting Firefox.
We have a server that helps running the unit tests manually, there's also the ui-showcase which helps with previewing layouts before starting Firefox.
Line 66: Line 106:


You only need to do <code>make runserver</code> on subsequent runs. Although <code>make install</code> may be required occasionally if dependencies get updated.
You only need to do <code>make runserver</code> on subsequent runs. Although <code>make install</code> may be required occasionally if dependencies get updated.
==== Visiting test pages ====
To view the unit tests visit:
  http://localhost:3000/test/
To view the UI-showcase, visit:
  http://localhost:3000/ui/
==== Testing out changes to the standalone UI ====
The standalone part of Loop (also known as the link-clicker UI) can be viewed in any web browser, and is hosted on a server. You can hook the development server up to talk to one of the servers to be able to test changes to the standalone UI.
To do this, setup the standalone server as described above, then rather than a simple <code>make runserver</code>, do:
LOOP_SERVER_URL=https://path/to/server make runserver
Replace the server path with one of:
* Development server: https://loop-dev.stage.mozaws.net
* Production server: https://loop.services.mozilla.com
(Generally its better to use the development server than the production one to avoid affecting the stats of production usage).
For the desktop side (also known as the link-generator):
* You may wish to create a new profile for testing purposes (since changing the pref below will loose your previously created conversations), e.g:
/path/to/firefox -createProfile myTestProfile
./mach run -P myTestProfile -purgecaches
* Visit about:config, change the <code>loop.server</code> preference to be <code>https://loop-dev.stage.mozaws.net/v0</code>
* Restart Firefox after changing the pref
* From the Hello panel, select "Start a conversation"
* Copy the url, and paste it into a browser window, but change the url
** <code>https://hello.firefox.com/1234567890a#dfkjekrltykyleoefirek</code> would become <code>http://localhost:3000/content/1234567890ab#dfkjekrltykyleoefirek</code>
You should now be able to join the room with that instance.


=== Developing ===
=== Developing ===
If you're altering any of the javascript files, you need to make sure you alter the jsx versions if they exist. Running:
If you're altering any of the javascript files, you need to make sure you alter the jsx versions if they exist.
 
You can start up the jsx compiler so that it watches the files and continuously updates them whilst the jsx is left running:


  cd browser/components/loop
  cd browser/components/loop
  ./build-jsx
  ./build-jsx -w


will generate the js versions of the file. Even better you can use:
To stop watching files and quit jsx, just use <code>ctrl-c</code>


./build-jsx -w
{{note|Note: On windows, build-jsx doesn't currently do the version check for the react version, so please keep an eye on the suggested version in case it is updated.}}
 
=== Linting ===
We use [http://eslint.org/ eslint] to parse the Loop files and check them for correctness before landing.


to keep watching the jsx files and updating them as the change.
See the [http://mxr.mozilla.org/mozilla-central/source/browser/components/loop/README.txt README.txt] for how to run it.


=== UI-showcase ===
=== UI-showcase ===


If you've got the standalone server running, you can view this by visiting http://localhost:3000/ui/ . This lets you layout the content pages (the parts displayed in the panel and conversation view) in a web context before loading and testing them in Firefox itself.
If you've got the standalone server running, you can view this by visiting http://localhost:3000/ui/ . This lets you layout the content pages (the parts displayed in the panel and conversation view) in a web context before loading and testing them in Firefox itself.
This can save you a considerable amount of time, because you don't have to (re-)build each time you made a change to see what effect it had.
This can save you a considerable amount of time, because you don't have to (re-)build each time you made a change to see what effect it had.


Line 93: Line 179:


Creating patches happens in exactly the same manner as for the rest of Firefox. See our documentation on the Mozilla Developer Network for [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch how to create and submit a patch.]
Creating patches happens in exactly the same manner as for the rest of Firefox. See our documentation on the Mozilla Developer Network for [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch how to create and submit a patch.]
[[Category:Firefox Hello]]
[[Category:Loop]]

Latest revision as of 19:36, 25 January 2016

Bug Tracking and Repositories

Need Help, want to discuss with Loop developers?

If you need help or want to discuss something with the Loop developers, then visit us on #loop on irc.mozilla.org - if you need more information about IRC, see our IRC page.

Tracking

Bugs are stored in bugzilla:

  • Desktop & Standalone (aka 'link generator' and 'link clicker', respectively): 'Loop' product, 'Client' component
  • Server: 'Loop' product, 'Server' component

Looking for bugs?

Try one of the good first bugs (simple bugs that are easy to fix) or a good next bug.

There's also mentored bugs where are developers have signed up to help you fix the bugs. Most of these will be in the good first and next bug groups above.

Or if not, take a look at our ranked priority list and choose one from there.

Repositories

Loop is contained across two repositories:

Directories

All files, apart from desktop locales are in mozilla-central, under browser/components/loop/. Within that directory there is:

  • *.jsm - Various modules used within Firefox desktop
  • build-jsx used to build the required jsx files
  • content/ - These files are all used on the desktop for the Loop panel and conversation window. They are loaded into content space rather than chrome
  • content/shared - Used for Firefox desktop, but also used for the standalone UI
  • standalone/ - Files used by the standalone application, including commands to make and run a standalone server (see below)
  • standalone/content - The content files for the standalone application
  • ui/ - A UI showcase, used to aid development and layout of styles for the various parts of the UI

A small bit of integration code with Firefox can be found in browser-loop.js.

Loop Software Architecture

More details on the structure coming soon. We have parts of Loop that run in a web-content space (those typically below a content directory), and other parts that work in a gecko privileged space (these are typically in the root directory of browser/components/loop).

A lot of the content files use a Flux based architecture, read more about that here.

Getting started with Firefox Desktop and Standalone development

Warning: most of these instructions are out of date, for correct information please see the loop repository and the Contributing file

Additional Requirements

For Loop development, there's currently a couple of extra requirements on top of the Firefox desktop build requirements.

These are NodeJS (note, though, that you MUST currently use an old version, 0.10), react-tools and eslint.

Note that when building Firefox itself, be sure to set

ac_add_options --enable-optimize

in your mozconfig to avoid problems with automated tests timing out.

Install NodeJS 0.10 first, then follow the instructions below

Mac installation of node 0.10

brew install homebrew/versions/node010

Windows Specific

There's a little bit more set-up required specific to Windows.

  • Start up the mozilla-build shell via one of the start-shell-msvc*.bat files
  • Work out your APPDATA path:
echo $APPDATA
  • In your APPDATA, you'll need to replace various parts, so:
c:\Users\moztest\AppData\Roaming

becomes:

/c/Users/moztest/AppData/Roaming
  • Now setup your profile file, replace the <path to APPDATA> with the path you just worked out.
echo PATH=$PATH:/c/Program\ Files/nodejs:<path to APPDATA>/npm >> ~/.profile
  • Now exit your shell/console and re-enter it.
  • Complete the steps in the "All Platforms" section

If you need to change the path later, you can edit the ~/.profile file.

All Platforms

Once you have Node installed, use npm (which comes with it) to globally install the extra required items:

npm install -g react-tools@0.12.2
npm install -g eslint
npm install -g eslint-plugin-react

Standalone server - Link-clicker UI and unit test development

We have a server that helps running the unit tests manually, there's also the ui-showcase which helps with previewing layouts before starting Firefox.

cd browser/components/loop/standalone
make install
make runserver

You only need to do make runserver on subsequent runs. Although make install may be required occasionally if dependencies get updated.

Visiting test pages

To view the unit tests visit:

 http://localhost:3000/test/

To view the UI-showcase, visit:

 http://localhost:3000/ui/

Testing out changes to the standalone UI

The standalone part of Loop (also known as the link-clicker UI) can be viewed in any web browser, and is hosted on a server. You can hook the development server up to talk to one of the servers to be able to test changes to the standalone UI.

To do this, setup the standalone server as described above, then rather than a simple make runserver, do:

LOOP_SERVER_URL=https://path/to/server make runserver

Replace the server path with one of:

(Generally its better to use the development server than the production one to avoid affecting the stats of production usage).

For the desktop side (also known as the link-generator):

  • You may wish to create a new profile for testing purposes (since changing the pref below will loose your previously created conversations), e.g:
/path/to/firefox -createProfile myTestProfile
./mach run -P myTestProfile -purgecaches

You should now be able to join the room with that instance.

Developing

If you're altering any of the javascript files, you need to make sure you alter the jsx versions if they exist.

You can start up the jsx compiler so that it watches the files and continuously updates them whilst the jsx is left running:

cd browser/components/loop
./build-jsx -w

To stop watching files and quit jsx, just use ctrl-c

Note: Note: On windows, build-jsx doesn't currently do the version check for the react version, so please keep an eye on the suggested version in case it is updated.

Linting

We use eslint to parse the Loop files and check them for correctness before landing.

See the README.txt for how to run it.

UI-showcase

If you've got the standalone server running, you can view this by visiting http://localhost:3000/ui/ . This lets you layout the content pages (the parts displayed in the panel and conversation view) in a web context before loading and testing them in Firefox itself.

This can save you a considerable amount of time, because you don't have to (re-)build each time you made a change to see what effect it had.

Running Tests

There's a file located at browser/components/loop/run-all-loop-tests.sh which allows all loop related tests to be run at the same time.

For information on running the tests individually, see the README.txt file.

Creating Patches

Creating patches happens in exactly the same manner as for the rest of Firefox. See our documentation on the Mozilla Developer Network for how to create and submit a patch.