MozillaZine

Packaging extensions

From MozillaZine Knowledge Base

(Difference between revisions)
Revision as of 19:13, 28 August 2005
Asqueella (Talk | contribs)
(put packaging info from main page here)
<-- Previous diff
Revision as of 19:29, 28 August 2005
Asqueella (Talk | contribs)

Next diff -->
Line 1: Line 1:
{{extdev}} {{extdev}}
 +Before [[releasing extension]], you need to package it into an XPI file, so that others can easily install it with a few clicks.
- +Mozilla.org provides the most comprehensive [http://www.mozilla.org/projects/firefox/extensions/packaging/extensions.html technical document] on packaging extensions. It explains the format of the install.rdf manifest for those wishing to create one from scratch. See [[install.rdf]] page for the list of tools and a template that make it easier to create an install manifest.
-== With .jar file ==+
-Mozilla.org provides the most comprehensive [http://www.mozilla.org/projects/firefox/extensions/packaging/extensions.html technical document] on packaging extensions. It explains the format of the install.rdf file for those wishing to create one from scratch. However, there also are tools and templates for easier creation of the [[install.rdf]] file.+
The Extension Manager&mdash;and hence the extension/theme packaging system&mdash;underwent a major revision with Firefox 0.9 and Thunderbird 0.7. If you wish to support earlier versions of these products, or the Mozilla Suite, you will need to provide the old-style [[install.js]] file as well as the new install.rdf. The Extension Manager&mdash;and hence the extension/theme packaging system&mdash;underwent a major revision with Firefox 0.9 and Thunderbird 0.7. If you wish to support earlier versions of these products, or the Mozilla Suite, you will need to provide the old-style [[install.js]] file as well as the new install.rdf.
Line 10: Line 9:
The whole process for the new packaging system is made clear in both [http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/#testing roachfiend&rsquo;s tutorial] and [http://www.borngeek.com/firefox/tutorial/part_06.html Jonah Bishop's toolbar tutorial]. The [http://xulplanet.com/tutorials/xultu/xpinstall.html tutorial on XulPlanet] covers the old system (most of this tutorial also applies to new-style extensions too). Jed Brown also has a tutorial on [http://jedbrown.net/1.0/mozilla/EM/ repackaging old extensions] in the new style. The whole process for the new packaging system is made clear in both [http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/#testing roachfiend&rsquo;s tutorial] and [http://www.borngeek.com/firefox/tutorial/part_06.html Jonah Bishop's toolbar tutorial]. The [http://xulplanet.com/tutorials/xultu/xpinstall.html tutorial on XulPlanet] covers the old system (most of this tutorial also applies to new-style extensions too). Jed Brown also has a tutorial on [http://jedbrown.net/1.0/mozilla/EM/ repackaging old extensions] in the new style.
-There are also tools which will automatically package your extension files: a [[bash build script]], [[Windows build script]], [http://www.borngeek.com/firefox/tutorial/build_script.txt Googlebar Lite Perl build script], a [[Makefile for packaging an extension|makefile]].+There are also tools which will automatically package your extension files: [[bash build script]]s, [[Windows build script]], [http://www.borngeek.com/firefox/tutorial/build_script.txt Googlebar Lite Perl build script], and a [[Makefile for packaging an extension|makefile]].
 + 
 +== Packaging without .jar file ==
 +: ''Note: this tip is most useful for developing extensions in the Mozilla Suite or Firefox/Thunderbird 1.0 or older. If you develop for Firefox/Thunderbird 1.5 or if you are new to extension development, you really ought to consider using the [[Getting_started_with_extension_development#reg-em|new features of Extension Manager]] instead.''
-== without .jar file ==+While developing your extension it may make sense not to put your chrome files in a single JAR file but to use them directly instead. That way you can debug in the extensions directory of a user profile directly without having to rebuild the JAR for each change. Creating a package without a .jar file is the same like described above with only some changes:
-While developing your Extension it can make sense not to .jar files but to use them directly instead. That way you can debug in the extensions directory of a usersprofile directly without re-packing and re-jaring. Creating a package without a .jar file is the same like described above with only some changes:+
* '''Use a directory instead of a JAR:'''<br />Instead of packing your files into a file called <tt>chrome/myextension.jar</tt> you copy them into a directory called <tt>chrome/myextension</tt> * '''Use a directory instead of a JAR:'''<br />Instead of packing your files into a file called <tt>chrome/myextension.jar</tt> you copy them into a directory called <tt>chrome/myextension</tt>
* '''Change the install.rdf:'''<br />Change it from:<br /><tt><Description about="urn:mozilla:extension:file:myextension.jar"></tt><br />to:<br /><tt><Description about="urn:mozilla:extension:file:myextension"></tt> * '''Change the install.rdf:'''<br />Change it from:<br /><tt><Description about="urn:mozilla:extension:file:myextension.jar"></tt><br />to:<br /><tt><Description about="urn:mozilla:extension:file:myextension"></tt>
-* '''Change the install.js:'''<br />For Mozilla Suite there might be additional modifications in the install.js file necessary which reflect the install.rdf file changes which is replaced by the .js file. It is unknown if this applies to Firefox or Thunderbird, too.+* '''Change the install.js:'''<br />For Mozilla Suite there might be additional modifications in the install.js file necessary which reflect the install.rdf file changes which is replaced by the .js file.
-More: [[Dev_:_Tips_:_Disable_XUL_cache#Getting_rid_of_JARs|Getting rid of JARs (Tip & Example)]]. Please note, that it's recommended to package chrome files in a JAR, for better startup performance.+More: [[Dev_:_Tips_:_Disable_XUL_cache#Getting_rid_of_JARs|Getting rid of JARs (Tip & Example)]]. Please note, that it's recommended to package chrome files in a JAR in a release version, for better startup performance.

Revision as of 19:29, 28 August 2005

This page is part of the extension development documentation project.

Ask your questions in MozillaZine Forums. Also try browsing example code.

Note: development documentation is in process of being moved to Mozilla Development Center (MDC).

Before releasing extension, you need to package it into an XPI file, so that others can easily install it with a few clicks.

Mozilla.org provides the most comprehensive technical document on packaging extensions. It explains the format of the install.rdf manifest for those wishing to create one from scratch. See install.rdf page for the list of tools and a template that make it easier to create an install manifest.

The Extension Manager—and hence the extension/theme packaging system—underwent a major revision with Firefox 0.9 and Thunderbird 0.7. If you wish to support earlier versions of these products, or the Mozilla Suite, you will need to provide the old-style install.js file as well as the new install.rdf.

The whole process for the new packaging system is made clear in both roachfiend’s tutorial and Jonah Bishop's toolbar tutorial. The tutorial on XulPlanet covers the old system (most of this tutorial also applies to new-style extensions too). Jed Brown also has a tutorial on repackaging old extensions in the new style.

There are also tools which will automatically package your extension files: bash build scripts, Windows build script, Googlebar Lite Perl build script, and a makefile.

Packaging without .jar file

Note: this tip is most useful for developing extensions in the Mozilla Suite or Firefox/Thunderbird 1.0 or older. If you develop for Firefox/Thunderbird 1.5 or if you are new to extension development, you really ought to consider using the new features of Extension Manager instead.

While developing your extension it may make sense not to put your chrome files in a single JAR file but to use them directly instead. That way you can debug in the extensions directory of a user profile directly without having to rebuild the JAR for each change. Creating a package without a .jar file is the same like described above with only some changes:

  • Use a directory instead of a JAR:
    Instead of packing your files into a file called chrome/myextension.jar you copy them into a directory called chrome/myextension
  • Change the install.rdf:
    Change it from:
    <Description about="urn:mozilla:extension:file:myextension.jar">
    to:
    <Description about="urn:mozilla:extension:file:myextension">
  • Change the install.js:
    For Mozilla Suite there might be additional modifications in the install.js file necessary which reflect the install.rdf file changes which is replaced by the .js file.

More: Getting rid of JARs (Tip & Example). Please note, that it's recommended to package chrome files in a JAR in a release version, for better startup performance.