mozilla
Vos résultats de recherche

    Hacking Gaia

    This page is targeted at Gaia developers. If you're looking for information about how to build and run Firefox OS, you should consult the Building and installing Firefox OS page instead.

    Gaia est une collection d' applications Web qui constituent le front end de Firefox OS. Tout ce que vous voyez à l'écran dans Firefox OS est construit en utilisant les technologies Web ouvertes. Cela comprend l'écran d'accueil et toutes les applications par défaut.

    Obtenir les sources

    Pour obtenir les sources de Gaia, fork us on GitHub puis clonez votre fork en utilisant git.

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

    Lancer Gaia

    Vous pouvez lancer Gaia sur votre ordinateur, dans Firefox, ou sur un téléphone compatible.

    Le bureau B2G

    B2G Desktop est une version bureau exécutable de l'application utilisée sur les appareils Firefox OS que vous pouvez utiliser pour exécuter Gaia sur votre ordinateur de bureau.

    Vous pouvez télécharger une version expérimentale de B2G à partir d'ici. En fonction de la version que vous voulez, vous pourriez vouloir une version différente de test-mozilla-b2g18. Il y a des versions pour Linux (32 bit et 64 bit), Mac OS X et Windows.

    Les versions expérimentales sont fournies avec une version récente de Gaia. Quand vous avez téléchargé l'archive, vous avez juste à l'extraire dans un dossier et à lancer le programme b2g depuis l'archive.

    $ 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

    Étiquettes et contributeurs liés au document

    Contributors to this page: Benlamara, nounoursheureux
    Dernière mise à jour par : Benlamara,
    Masquer la barre latérale