Hello everyone,
About one month ago, Yuren and I have announced a idea about modularizing
the current Gaia repo, which would allow developers to develop built-in
apps in a way close to ordinary web apps.
(presentation):
https://docs.google.com/presentation/d/1gO6NLhYHRmscJF14MezfP9BDZIVRJ6Mw_o1ZqWhvbf4/edit?usp=sharing
Now the first runnable demo is available on GitHub, and it includes these
sub-projects:
1. Calendar app for demo:
https://github.com/snowmantw/gaia-calendar
2. Homescreen for demo:
https://github.com/snowmantw/gaia-homescreen
3. Essential parts of building profile:
https://github.com/snowmantw/gaia-essential
4. Template.js in Bower package:
https://github.com/snowmantw/libgaia-html
5. Grunt task for building Gaia profile:
https://github.com/snowmantw/grunt-gaia-builder
There are two auxiliary tools for the Grunt plugin:
6. To build the profile:
https://github.com/snowmantw/gaia-profile-builder
7. To build the config:
https://github.com/snowmantw/gaia-config
Now I'm going to explain these tools and how to run the demo.
## Build a demo profile
Imaging you're a Calendar app developer, which should only care about the
app itself, and only do tests and publish for that. Now you want to build a
Gaia only contains Calendar and System, because you don't need any other
parts of Gaia, you'll need to:
1. Download the [1.] repo (gaia-calendar) to get the Calendar app
2. In the Calendar's directory, type:
npm install # Install other necessary tools and download bower
packages
3. Using the libraries downloaded by Bower and CRUD in your Calendar app
4. After CRUD, commit and push the changes back to GitHub
5. Prepare to build: in the Calendar directory, type:
grunt build-vanilla # Build a minimal build only contains Calendar and
System
6. You'll have a runnable profile in '/tmp/calendar-build-profile' after
the building process done.
*The build-vanilla can be substituted with build-full, which will build a
build with the additional homescreen app*
Short version:
git clone
https://github.com/snowmantw/gaia-calendar.git && cd
gaia-calendar && npm install && grunt build-vanilla && <path to firefox>
-profile /tmp/calendar-build-profile
**Caveats**
1. Due to the mozilla-download can't work with xulrunner (yet), the
gaia-essential repo in fact include a specific version (MacOS) of XUL, so
the demo now is runnable only for MacOS. The patch won't birth quickly if
this project still remains only me as the contributor.
2. Download gaia-essential would let the program hang about 3-5 mins. It
depends on the network between your console and GitHub.
3. We propose to provide lots of pre-defined build settings to satisfy most
of our requests, but the settings mechanism isn't implemented yet.
4. You need to remove the demo build and profile directories every time to
start a new build. This is because the build path now is hard-coded in the
Gruntfile.js in the Calendar app.
5. Due to the vanilla build lacks of homescreen, you need to type the url '
http://gaia-calendar.gaiamobile.org:8080' to switch to the Calendar app
6. Cache is not implemented, so the demo would donwload repos form GitHub
every time.
## Major concepts in this demo
1. One package.json and bower.json per app to manage all app and libraries
dependencies of your app, and no more build script magics like parsing
index.html to find all related shared libraries.
2. It's possible to generate various builds with pre-defined or customized
settings.
3. If you find something is very strongly coupling with other apps, and
this building flow become the major obstacle of the development, you
probably found an immature part of our inter-app architecture, which should
allow loose the coupling among apps as much as possible.
## Future works
1. More discussions: we need more feedbacks and discussions to find out
whether this approach is good for Gaia, and how to polish this coarse demo
to become really usable.
2. More contributors... It's tired to handle these things alone. If build
system can become a formal, scheduled work, we may be able to handle these
issues better.
3. References: to find out how KDE, Gnome, Android and other similar
projects manage their sub-projects' dependencies and build system. We may
learn something helpful from their build system.
Feedbacks is welcome!
--
<
http://about.me/snowmantw>Greg Weng
http://about.me/snowmantw
*Understand y f = f [ y f ] ; lose last remaining non-major friend*
* -- Anonymous *