From a065e04d529da1d847b5062a12c46d916408bf32 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 21:46:22 -0500 Subject: update based on https://github.com/mdn/yari/issues/2028 --- .../b2g_os/platform/gaia/hacking/index.html | 332 --------------------- files/vi/archive/b2g_os/platform/gaia/index.html | 62 ---- 2 files changed, 394 deletions(-) delete mode 100644 files/vi/archive/b2g_os/platform/gaia/hacking/index.html delete mode 100644 files/vi/archive/b2g_os/platform/gaia/index.html (limited to 'files/vi/archive/b2g_os/platform/gaia') diff --git a/files/vi/archive/b2g_os/platform/gaia/hacking/index.html b/files/vi/archive/b2g_os/platform/gaia/hacking/index.html deleted file mode 100644 index c8e9a219f2..0000000000 --- a/files/vi/archive/b2g_os/platform/gaia/hacking/index.html +++ /dev/null @@ -1,332 +0,0 @@ ---- -title: Hacking Gaia -slug: Archive/B2G_OS/Platform/Gaia/Hacking -translation_of: Firefox_OS/Developing_Gaia ---- -
-

Trang này nhằm tới các nhà phát triển của dự án Gaia. Nếu bạn đang tìm kiếm thông tin về việc làm thế nào để tạo dựng và chạy hệ điều hành Firefox( Firefox OS),  bạn nên tham khảo Building and installing Firefox OS page thay thế.

-
-
-

Gaia là bộ sưu tập những web apps nhằm tạo nên bộ mặt cho Firefox OS. Mọi thứ bạn thấy trên màn hình Firefox được xây dựng bằng các công nghệ Web mở. Bao gồm màn hình chính (home screen) và toàn bộ các ứng dụng mặc định. Bài viết này cung cấp một hướng dẫn chi tiết để tinh chỉnh, sửa đổi cho Gaia.

-
-

Nhận mã nguồn

-

Để nhận mã nguồn của Gaia fork us on GitHub và sau đó tạo bản sao fork của bạn bằng cách sử dụng git.

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

Chạy Gaia

-

Bạn có thể chạy Gaia trên màn hình Desktop, trong Firefox hoặc trên một thiết bị di động tích hợp sẵn.

-

Màn hình nền B2G

-

Màn hình B2G là một loại màn hình nền xây dựng dựa trên ứng dụng thời gian chạy (runtime app) dùng trong các thiết bị sử dụng hệ điều hành Firefox, cái mà bạn có thể dùng để chạy Gaia trên màn hình nền máy tính của bạn.

-

Bạn có thể tải về một bản nightly build của B2G desktop từ  Firefox Nightly site. Dựa trên phiên bản mà bạn đang nhắm tới, bạn có thể muốn một phiên bản cụ thể-mới nhất nào đó của mozilla-b2g18. Đã có sẵn các phiên bản cho Linux(32 bit và 64 bit), Mac OS X và Windows.

-

Nightly builds gồm phiên bản hiện tại của Gaia. Sau khi bạn đã tải về bản nén, tất cả những gì bạn cần làm là giải nén nó vào một thư mục và chạy tệp b2g trong thư mục vừa được giải nén.

-
$ cd b2g
-$ ./b2g
-

Để chạy B2G với phiên bản Gaia dành cho nhà phát triển, đầu tiên bạn cần tạo một hồ sơ cá nhân từ bản sao của bạn:

-
$ cd /path/to/gaia
-$ DEBUG=1 DESKTOP=0 make
-

Việc này sẽ tạo một mục trong thư mục gaia của bạn, tên là profile. Phần DEBUG có vai trò như ứng dụng chủ nhà trên máy chủ web tích hợp sẵn, chứ không phải gói ứng dụng mặc định cần phải làm lại gói sau mỗi lần thay đổi. Bạn có thể tìm đường dẫn đến thư mục hồ sơ bằng cách nhìn vào dòng cuối của thư mục xuất sau khi chạy dòng lệnh trên, nó sẽ phải trông như thế này:

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

Sau đó bạn có thể chạy màn hình nền B2G với hồ sơ bạn vừa tạo như sau:

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

Nếu muốn bạn có thể tạo màn hình B2G của chính mình từ nguồn.

-
-

Ghi chú : Trên Mac OS X, tệp b2g sẽ nằm trong B2G.app. Bạn sẽ cần chạy:

-

./B2G.app/Contents/MacOS/b2g /path/to/gaia/profile

-
-

Sử dụng Gaia trong Firefox

-

Gaia cũng có thể chạy trong Firefox. Nó sẽ cho bạn một số lợi ích trong việc có một vòng tròn phát triển (development cycle) siêu tốc, cùng với các công cụ phát triển Web tiêu chuẩn và các debugger.Xem Quickstart guide to Gaia development trong Firefox để biết chi tiết cách làm.

-

Sử dụng Gaia trên các thiết bị

-

Nếu bạn có một thiết bị di động tích hợp sẵn, bạn có thể chạy Gaia bằng cách cài nó vào hệ điều hành Firefox. Xem Building and installing Firefox OS để biết thêm chi tiết. Chúng tôi cũng có những tài liệu về how to test Firefox OS.

-

Kiểm tra đơn vị

-

Xem Gaia unit tests để biết các tài liệu về việc làm thế nào để tạo và chạy quá trình kiểm tra đơn vị cho Gaia.

-

Nộp hồ sơ lỗi

-

Các hồ sơ lỗi được nộp cho Bugzilla qua Firefox OS > Gaia. Đệ trình một lỗi mới qua tính năng của Gaia (hoặc một trong những tính năng phụ).

-

Đóng góp cho Gaia

-

Mozilla dựa trên những đóng góp từ nguồn cộng đồng mở giúp phát triển các ứng dụng Gaia, và chúng tôi mừng là bạn đã tham gia.

-

Một vài chỗ thú vị để tìm lỗi và bắt đầu làm việc:

- -

Phong cách mã hóa cơ bản

- -

Các điều cần biết

-

Sai:

-
if (expression) doSomething();
-
-

Đúng:

-
if (expression) {
-  doSomething();
-}
-
-

Nếu bạn làm việc trên ứng dụng hệ thống, xem hướng dẫn tại đây.

-

Trước khi đệ trình một bản patch, chúng tôi khuyến nghị bạn hãy sử dụng lệnh 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.

-
-

Note: Except under unusual circumstances, patches should be landing first on the master branch, not a release branch like v1-train, v1.3, etc. If they need to land on a release branch, they must go through the usual approval process as outlined on the B2G Landing wiki page.

-
-

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 seen 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 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 merges the commit (usually the reviewer) would add a r= flag in the comment of the merge commit.

-

Make options

-

you use the make command inside the Gaia repo to create a Gaia profile that can be loaded onto your device or run in a B2G Desktop build. This section looks in detail at the different make options available.

-

There are many environment variables present in the Makefile. Do not depend on them as they may be removed in the future.

-

Created profiles are stored in /gaia/profile, and contain the following items:

- -
-

Note: When you've already made a profile and you want to build a new one, you must delete the existing profile directory before trying to generate a new one.

-
-

Default

-
make
-

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 all existing profiles, web apps and database entries (a new settings database will be initialized) before pushing Gaia from your working directory to your device ; install-gaia will just push updates of Gaia. There is also a  third option:

-
make profile
-

pushes only the existing profile.

-

Production make

-
PRODUCTION=1 make
-

This creates a production build of Gaia:

- -
-

Note: You can also use the alias make production.

-
-

Debug make

-
DEBUG=1 make
-

The DEBUG variable runs Gaia as hosted apps on a built-in web server on a specific GAIA_PORT, rather than the default of packaged apps which have to be re-packaged after every change; this makes things easier to test. Launching the profile with the latest Firefox Nightly will also give you nice B2G specific panels on the Firefox Developer Tools.

-

In addition:

- -

Device debug make

-
DEVICE_DEBUG=1 make
-

This disables screen lock on the device, and enables debugging with the ADB tool, so is useful for device debugging.

-

In Firefox OS version > 1.2, specify this param when you want to debug Firefox OS webapps with the App Manager.

-

Enable remote debugging

-
REMOTE_DEBUGGER=1
-

This enables remote debugging on the device, the same as using the option in the developer settings.

-

Debug desktop make

-
DEBUG=1 DESKTOP=0 make
-

This option creates a desktop debug version, for running inside B2G desktop.

-

Build specific apps

-
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-packing and re-push all the Gaia apps.

-

Official Mozilla branding make

-
MOZILLA_OFFICIAL=1 make
-

Use this to make an official Mozilla-branded build.

-

Dogfood make

-
DOGFOOD=1 make
-

Dogfood is turned on.

-

System apps make

-
B2G_SYSTEM_APPS=1 make
-

This environment variable lets you push an app to /system/b2g instead of /data/local. You should use this when you work with a user build. This variable is automatically set when running make production. This can be used for install-gaia or reset-gaia too.

-

JavaScript optimization make

-
GAIA_OPTIMIZE=1 make
-

This triggers an optimization pass on Gaia's JavaScript, concatenating/compressing the files. This is automatically set when running make production. This can be used for install-gaia or reset-gaia too.

-

High resolution image assets

-
GAIA_DEV_PIXELS_PER_PX=1.5 make
-

When packaging the app, this option replaces images with their *@1.5x.(gif|jpg|png) equivalents if such images exist. You need to use the above option as part of a standard make command, for example:

-
GAIA_DEV_PIXELS_PER_PX=1.5 make reset-gaia
-
-GAIA_DEV_PIXELS_PER_PX=1.5 make install-gaia
-

Gaia is currently targetting the following screen resolutions:

- -

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.

-

Disable first time user guide

-
NOFTU=1
-
-

Disable the first time user guide with this environment variable.

-

Distribution and market customization build

-
GAIA_DISTRIBUTION_DIR=./dir
-

Read Market Customizations for more details.

-

Reference Workloads

-

Reference workloads allow developers/testers to quickly install a large amount of data in several applications, typically on a newly-flashed phone.

-

The commands are (from the gaia directory):

-
make reference-workload-light
- -
make reference-workload-medium
- -
make reference-workload-heavy
- -
make reference-workload-x-heavy
- -

These targets accept the APP environment variable, or an APPS environment variable that should contain the app names separated by a space, e.g.:

-
APP=sms make reference-workload-light
-APPS="sms communications/contacts" make reference-workload-heavy
-
-

The apps available are:

-
APPS="gallery music video communications/contacts sms communications/dialer"
-

In order to install music (songs) with reference workloads, the utility mid3v2 must be installed. This utility can be installed with:

-
sudo apt-get install python-mutagen
-

If you run Fedora or RHEL instead, use:

-
sudo yum install python-mutagen
-

Documentation make

-

Gaia docs can be built, via jsdoc3. To generate these, you can use the following command:

-
make docs
-

Enabling IME layout and dictionaries

-

To enable keyboard IME layout and dictionaries enabled, use following command structure:

-
GAIA_KEYBOARD_LAYOUTS=en,zh-Hant-Zhuyin,el,de,fr,zh-Hans-Pinyin make
-

Customizing the build-time apps

-

The apps that run on Firefox OS are all contained within the Gaia source tree, in one of two locations:

- -
-

Note: If you are building B2G rather than Gaia, the paths will of course have B2G/ on the front, e.g. B2G/gaia/apps and B2G/gaia/external-apps.

-
-

If you want to omit some of these apps from your build of Gaia/B2G, you can do this in a few different ways:

-
    -
  1. -

    The "brute force" method is to simply delete the apps you don't want to be present at build time, before building.

    -
  2. -
  3. -

    The more refined method is to edit the gaia/build/config/apps-*.list files to include the paths to the apps you want to include at build time. For example, gaia/build/config/apps-production.list looks something like this:

    -
    apps/*
    -external-apps/*
    -outoftree_apps/*
    -

    But you could also include specific apps rather than just picking them all, for example:

    -
    apps/clock
    -

    The mechanism for choosing which apps-*.list file is used during the build to determine the available apps is contained inside gaia/Makefile:

    -
    GAIA_APP_TARGET?=engineering
    -...
    -ifeq ($(MAKECMDGOALS), demo)
    -GAIA_DOMAIN=thisdomaindoesnotexist.org
    -GAIA_APP_TARGET=demo
    -else ifeq ($(MAKECMDGOALS), dogfood)
    -DOGFOOD=1
    -else ifeq ($(MAKECMDGOALS), production)
    -PRODUCTION=1
    -endif
    -...
    -ifeq ($(PRODUCTION), 1)
    -GAIA_OPTIMIZE=1
    -GAIA_APP_TARGET=production
    -endif
    -
    -ifeq ($(DOGFOOD), 1)
    -GAIA_APP_TARGET=dogfood
    -endif
    -...
    -ifndef GAIA_APP_CONFIG
    -GAIA_APP_CONFIG=build$(SEP)config$(SEP)apps-$(GAIA_APP_TARGET).list
    -endif
    -

    Initially, the GAIA_APP_TARGET variable is set to engineering, so by default building gaia from source will use app-engineering.list (which includes all the tests, demos, etc.):

    -
    make
    -
    -

    To specify usage of a different apps list you specify different options when running the make command. To build with apps-production.list, for example, you'd use

    -
    PRODUCTION=1 make
    -
      -
    • If you specifically build with DEMO=1 specified, then it will use apps-demo.list.
    • -
    • If you specifically build with DOGFOOD=1 specified, then it will use apps-dogfood.list.
    • -
    • You can completely override the decision by using GAIA_APP_CONFIG and providing your own apps-*.list file.
    • -
    -

    gaia/Android.mk contains these lines:

    -
    ifneq ($(filter user userdebug, $(TARGET_BUILD_VARIANT)),)
    -GAIA_MAKE_FLAGS += PRODUCTION=1
    -B2G_SYSTEM_APPS := 1
    -endif
    -

    When you build, if VARIANT=user or VARIANT=userdebug are set (these wind up getting reflected in the TARGET_BUILD_VARIANT variable), PRODUCTION=1 is automatically set when building gaia.

    -
  4. -
  5. -

    The third, and most refined (but most complex) method is to use customizations. These allow you to specify build-time customization instructions in separate difrectories, without modifying the core Gaia repo. You can include your own customizations in distinct directories, or use the preexisting directories that come with the source.

    -

    For example, the basic Firefox tablet customized app list is defined in apps.list under the distribution_tablet folder (gaia/distribution_tablet). These customizations can be applied at build time using options like this:

    -
    GAIA_DISTRIBUTION_DIR=distribution_tablet make
    -
    -

    Note: Customizations is its own separate topic entirely. To learn more about it, read Market Customizations.

    -
    -
    -

    Note: If you want to include custom external apps as part of your Gaia build, you need to build them in a specific way, and then place them into the gaia/external-apps/ folder. Read Building Prebundled web apps to find out how.

    -
    -
  6. -
-
-

Important: If you are a device vendor creating a custom B2G/Gaia build for distribution, you need to satisfy certain criteria before you are allowed to include the Firefox Marketplace app on your phones/tablets/etc. Contact Mozilla for more details.

-
-

Contacting the Team

- diff --git a/files/vi/archive/b2g_os/platform/gaia/index.html b/files/vi/archive/b2g_os/platform/gaia/index.html deleted file mode 100644 index 55c335022e..0000000000 --- a/files/vi/archive/b2g_os/platform/gaia/index.html +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: Gaia -slug: Archive/B2G_OS/Platform/Gaia -tags: - - B2G - - Gaia - - Mobile - - NeedsTranslation - - TopicStub -translation_of: Archive/B2G_OS/Platform/Gaia ---- -

Gaia is the user interface level of Firefox OS. Everything that appears on the screen after Firefox OS starts up is drawn by Gaia, including the lock screen, home screen, dialer, and other applications. Gaia is written entirely in HTML, CSS, and JavaScript. Its only interface to the underlying operating system and hardware is through standard Web APIs, which are implemented by Gecko.

- -

Because of this design, not only can Gaia be run on Firefox OS devices, but also on other operating systems and in other web browsers (albeit with potentially degraded functionality depending on the capabilities of the browser).

- -

Third party applications onto the device installed alongside Gaia can be launched by Gaia.

- - - - - - - - -
-

Documentation about Gaia

- -
-
Introduction to Gaia
-
Gaia is the user interface application for Firefox OS devices; it's simply a Web application running atop the Firefox OS software stack. This guide introduces Gaia at a high level.
-
Gaia apps
-
Information on each of the default apps available in the Gaia family, including tips on how to use them, and how to modify them.
-
Gaia hacking guide
-
A guide to hacking and modifying the Gaia interface.
-
Gaia Build System Primer
-
Most of the meaningful work for the build steps are performed by the scripts that live inside the build/ subdirectory of Gaia.
-
Gaia Hacking Tips And FAQ
-
A list of helpful tips and frequently asked questions around hacking on Gaia.
-
- -

View All...

-
- - - - -

Resources

- - -
-- cgit v1.2.3-54-g00ecf