Hackeando Gaia

Esta página está dirigida a desarrolladores de Gaia. Si usted está buscando información acerca de cómo construir y ejecutar Firefox OS, debería consultar la página de Construyendo e Instalando Firefox OS en su lugar.

Gaia es la colección de aplicaciones web que forman la interfaz de Firefox OS. Cualquier cosa que usted vea en la pantalla del Firefox OS es creada usando tecnologías web abiertas. Esto incluye la pantalla de inicio y todas las aplicaciones predeterminadas.

Obteniendo el código fuente

Para obtener el código fuente de Gaia, fork us on GitHub and then clone your fork using git.

$ git clone https://github.com/mozilla-b2g/gaia.git

Ejecutando Gaia

Usted puede ejecutar Gaia en el escritorio, en Firefox, o en un un dispositivo móvil compatible.

B2G desktop

B2G desktop is a desktop build of the app runtime used on Firefox OS devices which you can use to run Gaia on your desktop computer.

You can download a nightly build of B2G desktop from here. Depending on what version you are targeting, you may want a specific version of latest-mozilla-b2g18. There are builds for Linux (32 bit and 64 bit), Mac OS X and Windows.

Nightly builds come packaged with a recent version of gaia. Once you've downloaded the archive, all your need to do is extract it to a folder and run the b2g binary from the extracted folder.

Note: 64-bit Linux builds do not currently work on some distributions, this is bug 812484. If you have problems try a 32-bit build instead.

$ cd b2g
$ ./b2g

To run B2G with your own version of Gaia for development purposes you first need build a profile from your clone:

$ cd /path/to/gaia
$ DEBUG=1 make

This will generate a directory in your gaia directory called profile. The DEBUG part runs Gaia as hosted apps on a built-in web server, rather than the default packaged apps which have to be re-packaged after every change. You can find the path to the profile directory by taking a look at last line of output after running the above command, which should look like:

Profile Ready: please run [b2g|firefox] -profile /path/to/gaia/profile

You can then run B2G Desktop with your generated profile like so:

$ ./b2g /path/to/gaia/profile

If you want to you can build your own B2G desktop from source.

Usando Gaia en Firefox

It's also possible to run Gaia inside of Firefox. This gives you the advantages of having a rapid development cycle, as well as standard web development tools and debuggers. See Using Gaia in Firefox for details on how to do this.

Usando Gaia en un dispositivo

If you have a compatible mobile device you can also run Gaia by flashing it with Firefox OS. See Building and installing Firefox OS for details on how to do this. We also have documentation for how to test Firefox OS.

Unidad de pruebas

See Gaia unit tests for documentation about how to create and run unit tests for Gaia.

Presentando errores

Bugs are filed on Bugzilla under Firefox OS > Gaia. File a new bug under the Gaia component (or one of the sub-components).

Contribuyendo a Gaia

Mozilla depends on contributions from the open source community to help develop Gaia apps and we'd love you to get involved.

Some great places to find some bugs to start hacking on:

Estilos de codificación básicos

  • Background:
  • Make sure HTML files are declared <!DOCTYPE html> (that is, as HTML5 documents). If you don't, Internet Explorer 9 and later will load them in compatibility mode.
  • Include the "use strict"; statement (just like that, including the quotes) to the top of your JavaScript files to put them into strict mode.
  • Always use two spaces for indentation, rather than tabs.
  • Please use line breaks to separate logical bits of code!
  • Multi-word file names should use the "underscore" character to separate words, like_this.js.
  • Use single quotes instead of double quotes for strings.

Reglas Adicionales

Mal:

if (expression) doSomething();

Correcto:

if (expression) {
  doSomething();
}

If you're working on the system app, check out the guidance listed here.

Before submitting a patch we recommend you run gjslint on it to check for any style errors:

gjslint --nojsdoc my_file.js

Enviando un parche

First file or assign a bug to yourself on Bugzilla, you'll need a Bugzilla account.

Then create a branch on your fork of Gaia:

$ git branch branchname
$ git checkout branchname

Commit your changes:

$ git add /file/to/add
$ git commit -m "Bug XXXXX - Fix the broken Gaia and save the world"

Push your branch:

$ git push origin branchname

Send a pull request by navigating to the branch in your fork on GitHub and finding the pull request button.

To request a review of your patch, add an attachment to the bug in Bugzilla referencing the URL of the pull request and set the review ("r") flag to "?" and enter the bugzilla ID of one of the module owners and peers. The Github tweaks for bugzilla extension on AMO can help automate this process by automatically creating the attachment and adding it to the bug; you will still need to set the review flag on Bugzilla.

The reviewer may ask you to make some changes. Once they're is happy with your patch, they will merge it into the master branch for you. Before they do this they would prefer it if you could squash all your changes into a single commit, so your contribution can be tracked easily.

The person who merge the commit (usually the reviewer) would add a r= flag in the comment of the merge commit.

Opciones de Make

There are many undocumented nor unsupported environment variable presists in the Makefile. Do not depend on them as they may be removed in the future.

Default

make

Make a profile with packaged apps, lunachable by B2G Desktop and can be pushed to device.

Debug make

DEBUG=1 make

The DEBUG part runs Gaia as hosted apps on a built-in web server, rather than the default packaged apps which have to be re-packaged after every change. Launch the profile with the latest Firefox Nightly will also give you nice B2G specific panels on the Firefox Developer Tools.

Push to device

make install-gaia

make reset-gaia

With adb (Android Debug Bridge) setup, these make targets will push Gaia to the device. reset-gaia will purge the profile and all other webapps before pushing the new Gaia copy.

Selective build

APP=system make

APP=system make install-gaia

With a profile already exists, APP allow you to specify which app to re-package, instead of re-pack and re-push all the Gaia apps.

High resolution image assets

GAIA_DEV_PIXELS_PER_PX=1.5 make

When packaging the app, replace images with their *@1.5x.(gif|jpg|png) ones if such image exists.

Gaia is currently targetting HBGA (320x240), qHD (540×960) and WVGA (480×800) only; use GAIA_DEV_PIXELS_PER_PX to make sure the images looks sharp on qHD and WVGA devices. see A pixel is not a pixel for more information about device pixels per css pixels.

Script compression and optimization

GAIA_OPTIMIZE=1 make

(TBA)

App selection

GAIA_APP_SRCDIRS=apps test_apps showcase_apps

(TBA)

App selection shortcuts

PRODUCTION=1
DOGFOOD=1

(TBA)

Preference shortcuts

NOFTU=1
REMOTE_DEBUGGER=1

(TBA)

Device webapp installation partation selection

B2G_SYSTEM_APPS=1

(TBA)

Distribution and market customization build

GAIA_DISTRIBUTION_DIR=./dir

Read Customization Overview for detail.

Contacting the Team

Etiquetas y colaboradores del documento

Colaboradores de esta página: StripTM, EdwardNavarro, cargabsj175
Última actualización por: StripTM,
Ocultar la barra lateral