mozilla
Your Search Results

    Hacking Gaia

    Aquesta pàgina està dirigida a desenvolupadors Gaia. Si busques sobre com crear i arrencar una aplicació Firefox OS, tindries que consultar Creant i instal·lant una pàgina Firefox OS.

    Gaia és un conjunt d'aplicacions web que formen la cara visible de Firefox OS. Tot el que veus a la pantalla de Firefox OS està creat amb tecnología web de codi obert. Això inclou la pantalla inicial i les seves aplicacions inicials. 

    Obtenint el codi

    Per obternir el codi font de Gaia, fork us on GitHub and then clone your fork using git.

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

    Running Gaia

    You can either run Gaia on the desktop, in Firefox, or on a compatible mobile device.

    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.

    $ cd b2g
    $ ./b2g

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

    $ cd /path/to/gaia
    $ DEBUG=1 DESKTOP=0 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.

    Using Gaia in 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.

    Using Gaia on a device

    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.

    Unit tests

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

    Filing bugs

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

    Contributing to 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:

    Coding style basics

    • 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.

    Additional rules

    Bad:

    if (expression) doSomething();
    

    Correct:

    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

    Submitting a patch

    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, attach the pull request to the bug in Bugzilla by 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 (very important - otherwise your bug will not likely be seem by anyone). 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; you may need to amend the original commit and force push it to the original branch/pull request. 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.

    Make options

    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

    Concate and optimize build-in app's javascript to improve load time.

    Preference shortcuts

    NOFTU=1
    

    Disable First time user guide.

    REMOTE_DEBUGGER=1

    Enable debug with adb tool

    DEVICE_DEBUG=1

    While in OS version > 1.2, specify this param when you want debug FirefoxOS webapp with App Manager

    Distribution and market customization build

    GAIA_DISTRIBUTION_DIR=./dir

    Read Customization Overview for detail.

    Contacting the Team

    Document Tags and Contributors

    Contributors to this page: djpaliobcn
    Last updated by: djpaliobcn,