XUL Application Packaging

From CDOT Wiki
Revision as of 16:44, 13 December 2008 by Jsdoodna (talk | contribs) (To Do)
Jump to: navigation, search

Project Name

XUL Application Packaging

Project Description

Help to develop an automated packaging system for XULRunner applications.

Resources:

Project Leader(s)

Project Contributor(s)

  • Rob Mensching

Project Details

Introduction

Creating an application packager to allow developers of XULRunner applications to focus more on development, rather than the tedious work of having to figure out how to bundle and deploy their application. Developers shouldn't need to focus on this simple task, they should be able to quickly and easily put their new application into a packager and have those repetitive tasks done for them, so they can prepare for deployment.


XULRunner

XULRunner is a runtime environment developed by Mozilla for providing a common backend for XUL applications.XUL-based applications include Firefox, Thunderbird, Songbird Flickr Uploader, SeaMonkey, which all run off or have the ability to run from XULRunner.

  • I have heard of XULRunner only once, at the Mozilla Developer Days, but I have no idea how it works, so after downloading and installing, first step is to break down how the XULRunner environment works.
  • the sdk download is about 21MB~30MB depending on what platform, and once downloaded it only needs to be unzipped or untarred into an directory, I just dumped it in root, so I don't have to move around directories too much.
  • Surprisingly I've learned that XUL is mixture of XML files and JavaScript, stuck into a simple directory structure.
+ /AppName
|
+-+ /chrome
| |
| +-+ /content
| | |
| | +- main.xul
| | +- main.js
| |
| +- chrome.manifest
|
+-+ /defaults
| |
| +-+ /preferences
|   |
|   +- prefs.js
|
+-+ /extension
|
+- application.ini
  • the application.ini file simply sets some meta information about the application, and min and max version the application will work with
  • the chrome.manifest file is used to locate application resources
  • the prefs.js' tells XULRunner where is XUL application file is, to open the main window
  • the main.xul file is basically the physical layout of the application, which is written in XML
  • the main.js file is all the logic for the application, written in JavaScript

Writing Programs in XUL

The two main files in any XULRunner application are the .xul and .js file in the content directory. the .xul file gives your application all the layout detail of the program, very similar to something like an HTML file for a web page. The .js file give your application all the logic needed for your application to be useful, similar to an external JavaScript used on an HTML page, or an CSharp file linked to an ASP web page. For XRap I am calling my JavaScript file in my XUL application using:

<script src="XRap.js" type="text/javascript"/>

To call a function in my JavaScript file from XUL is use

<command id="cmd_read" oncommand="getFile()" />
  • where the control on the XUL app calls the id of the command
<button id="btn_read" label="Read File" command="cmd_read"/>

File IO in XUL

Reading Files in XUL
Writing Files in XUL


XML in XUL

Windows Development

WiX

WiX

Project News

  • Offically started project on September 18, 2008
  • September 20, 2008
    • Downloaded XULRunner SDK
      • Followed tutorial and started to build small XULRunner applications, learning about the structure of XULRunner apps
      • Downloaded some applications which others have created to get an idea of the structure others are creating their app
        • Found out that the most of the code is being archived into a .jar file
        • Problem: Don't know if this will create a problem when installing
  • September 29, 2008
    • Talked with Mark Finkle and Dave Humphrey on IRC about various Application Packagers for Windows
    • Talked about milestone goals for my project, and set them:
      • Version 0.1: Stable Windows release of Packager
      • Version 0.2: Stable Linux release
      • Version 0.3: Stable Mac OS release
  • October 2, 2008
    • Browsed through the list of Application Packagers which were recommended by Mark and Dave
    • Decided to use WiX as my Packager of choice, mainly because of their use of XML
  • October 6, 2008
    • Began going through the manual for WiX
    • Followed the tutorial on packaging their sample application
      • Success! I made an .msi file and installed it on my computer on the first try! It installs into the 'Program Files' directory and adds an item to the Start menu
    • Solved: Files in the .jar file don't need to be taken out of the archive for the program to work, which won't create a problem when installing
  • October 8, 2008
    • Decided to use C# to generate the XML file and passes it to WiX for packaging
    • Began coding a command-line based program, which will take one arguments as the root directory of a XULRunner application, and generate an XML file for WiX
      • Using the sample WiX application, I was able to generate the .wxs XML file, and using WiX manually generate a working .msi
    • Created a recursive algorithm to get all files and sub-directories of a XULRunner application
      • Problem: I have no problem getting the all the files and sub-directories, the problem is adding them to the XML file in the correct structure which they came from
  • October 9, 2008
    • Working on structure problem, can only get the files and directories to be added one level deep in the XML file
  • October 16, 2008
    • Working Solution: Using the Stack I am able to get 2 levels deep, it will work for basic XULRunner applications

Releases

Version

0.1

XRap

Command: XULRunnerApplicationPackager.exe [Path to XulRunner Root Folder]
0.3 XRap v0.3 Installer
0.3 XRap v0.3 Source

To Do

  • Learn how XULRunner works
  • Build a XULRunner Application
  • Find other XULRunner Applications
  • Learn about Packagers and what they do
  • Choose a Packager
  • Learn about the Packager selected
    • WiX is the packager I am going to be using
  • Package a small application
    • WiX tutorial offered me a sample application to follow with
  • Create or find a XULRunner app, package it, and install it
  • Create a program to Package a XULRunner app Only works with simple apps
    • Automatically generate WiX XML schema of Directory structure This is the problem area
    • Generate GUID, and pass it to WiX Code (Used Guid structure in .NET Framework)
    • Get argument from command-line of the location of the XULRunner app
  • Learn how to create a XUL app
  • Learn JavaScript
    • How to call JavaScript from XUL app
    • Using the Mozilla/XUL Interfaces
  • XUL
    • File IO using Interfaces
      • Reading files
      • Writing files
    • XML using Interfaces
    • Executing System Commands
  • Clean up code
  • Do some validation

External Links