Confirmed users
478
edits
(Grammar, terms etc.) |
(Edits) |
||
| Line 1: | Line 1: | ||
= Overviews = | = Overviews = | ||
| Line 14: | Line 4: | ||
* A lot of OS-specific detail leaks through, making modification hard to debug | * A lot of OS-specific detail leaks through, making modification hard to debug | ||
* While providing a CommonJS interface, the environment does not come with common | * While providing a CommonJS interface, the environment does not come with common Node.js modules (e.g. fs, path, etc.), making reuse of code hard and creating new features harder. | ||
In contrast, Node.js and the NPM packages runs on it can do things entirely simply in JavaScript. By substitute runtime dependency from XPCShell to Node.js, we would get a stable and common runtime environment, and gain access to NPM packages. | |||
It's worthy to pointing out not building Gaia in XPCShell means we no longer considering making Firefox the sole dependency to build Gaia an eventual goal (i.e. develop Gaia with WebIDE & a "build Gaia" add-on and no extra dependency). Yet, considering the reward we decided using | It's worthy to pointing out not building Gaia in XPCShell means we no longer considering making Firefox the sole dependency to build Gaia an eventual goal (i.e. develop Gaia with WebIDE & a "build Gaia" add-on and no extra dependency). Yet, considering the reward we decided using Node.js is the better way moving forward. | ||
= Profit from [http://nodejs.org/ Node.js] = | |||
* Easier to catch up: Web developers are familiar with JavaScript, also [http://nodejs.org/ Node.js] is the most popular and acceptable for those who are familiar with client-side JavaScript. It could attract more contributors to involve and improve Firefox OS. | |||
* Abundant tool: NPM is a well-known build-in package manager of node, such tool is commonly used for web developers for years. It will make your life easier that developers can install third-party libraries and prevent us to reinvent the wheel if there is no such library provided by XULRunner. | |||
* Pure JS: It would be great if we build up a pure JS system. To re-implement Makefile into JS is a hard work without third-party library, NPM provides a bunch of packages that let us build our pure JS system more quickly, flexible and maintainable. | |||
= Plan = | = Plan = | ||
| Line 36: | Line 32: | ||
== Milestone 1 == | == Milestone 1 == | ||
Tackle each of the build system core functions (parallel build, webapp-manifests, preferences, webapp-optimize, webapp-zip... etc). All of them exist certain specific code only use for XPCShell. We would also like to finish the previous attempt to wrap | Tackle each of the build system core functions (parallel build, webapp-manifests, preferences, webapp-optimize, webapp-zip... etc). All of them exist certain specific code only use for XPCShell. We would also like to finish the previous attempt to wrap Node.js APIs into high-level Utils in (build/node-utils.js) (See also: {{Bug|955988}}). During this milestone, we will ensure the build system continue to work on both XPCShell setup and Node.js. Once we complete all the work for the milestone, Gbn and Gbun should be green and set visible. | ||
* '''Deliverable:''' Complete the implementation of node build scripts that coexist with XPCShell and passes Gbn / Gbun tests | * '''Deliverable:''' Complete the implementation of node build scripts that coexist with XPCShell and passes Gbn / Gbun tests | ||
| Line 107: | Line 103: | ||
= Q & A = | |||
== Which Gaia build task will continue to rely on b2g_sdk after Node.js transition? == | |||
b2g_sdk run on ... | |||
* Building Gaia (including sub-commands) | |||
* Running build integration test | |||
* Running push to device | |||
* '''Running marionette integration test (must)''' | |||
All of the above can be replaced with node.js smoothly except marionette test. Since the B2G Desktop is the test target for these tests, it's impossible to remove from our dependency. However, it's not necessary to download a b2g_sdk package if someone do not execute marionette test. | |||
== What of the effect on Gaia if build script run on node.js instead of b2g_sdk? == | |||
* Pros: | |||
** Build Gaia without downloading b2g (but we still download b2g while launching marionette tests) | |||
* Cons: | |||
** Requiring Node.js as a build prerequisite -- User must make available <code>node</code> before building Gaia. | |||
** We will need to download NPM packages and other NPM command-line tools | |||
== Why are we giving up making Firefox as the only Gaia development dependency? Isn't that better and more inviting? == | |||
Weighting the benefits, we believe requiring Node.js won't frustrate many users to get started with hacking Gaia, since Node.js comes with installers for all platforms. Again, using Node.js means we can build up new features quickly by NPM and also speed up rewriting Makefile to pure JS. | |||
On the other hand, try to rewrite Makefile from scratch in XULRunner is proven to be hard. In sum, we believe that NPM ecosystem will bring lots of benefits more than XULRunner. | |||
== How do we ensure NPM package access to all parties, e.g. partner in China or Try servers == | |||
It should continue to work if we keep hosting our gaia-node-modules mirror to solve such situation. Replacing the make-shift gaia-node-modules mirror is not the scope of this work, but we are looking forward to find a way to do that. | |||
== In M2, buildbot should pre-install proper command tools (node.js, gulp) if we decide to use gulp.js, right? == | |||
Buildbot has already installed node environment except gulp. We can pre-install gulp -g in buildbot, or download gulp while first time build then launch it by relative path. | |||
== Would the new build system slower than we have right now? == | |||
Although we believe that M1 & M3 won't effect obviously on performance, it probably happen on M2. So we should ensure that we take full advantage of multi-core systems to speed up our workflow in Node.js environment (with gulp). | |||