mozilla

Revision 203075 of ant script to assemble an extension

  • Revision slug: ant_script_to_assemble_an_extension
  • Revision title: ant script to assemble an extension
  • Revision id: 203075
  • Created:
  • Creator: Régis Décamps1
  • Is current revision? No
  • Comment category & short descr

Revision Content

This ant script helps to package an extension.

<?xml version="1.0"?>
This build file was written by Régis Décamps <decamps@users.sf.net>

<project name="blogmark" default="createxpi">
       <property name="VERSION" value="1.3-rc1"/>
       <property name="DESCRIPTION" value="New context-menu item to add
                                           the current page in your Blogmarks"/>
       XPI file is created after "chrome/blogmark.jar"               is created, which is then stuffed into "blogmark.xpi"
       <target name="createxpi" depends="createjar" 
               description="Assemble the final build blogmark.xpi">
               <zip destfile="blogmark-${VERSION}.xpi">
                        <zipfileset dir="." includes="chrome/blogmark.jar" />
                        <zipfileset dir="." includes="install.rdf" />
                </zip>
        </target>

       Everything inside the chrome directory is zipped into chrome/blogmark.jar
       <target name="createjar" depends="templates" description="Assemble the jar">
                <jar destfile="chrome/blogmark.jar">
                       <fileset dir="chrome/">
                               <include name="**/*"/>
                               <exclude name="**/*~"/>
                               <exclude name="**/*.tpl.*"/>
                               <exclude name="blogmark.jar"/>
                       </fileset>
                </jar>        
        </target>
    
       <target name="templates" description="Generate files from templates.">
               <copy file="chrome/content/blogmark/contents.rdf.tpl.xml"
                     tofile="chrome/content/blogmark/contents.rdf"
                     overwrite="true">
                       <filterchain>
                               <replacetokens>
                                       <token key="VERSION" value="${VERSION}"/>
                                       <token key="DESCRIPTION" value="${DESCRIPTION}"/>
                               </replacetokens>
                       </filterchain>        
               </copy>
               <copy file="chrome/content/blogmark/about.xul.tpl.xml"
                       tofile="chrome/content/blogmark/about.xul" 
                       overwrite="true">
                       <filterchain>
                               <replacetokens>
                                       <token key="VERSION" value="${VERSION}"/>
                               </replacetokens>
                       </filterchain>        
               </copy>
               <copy file="install.rdf.tpl.xml"
                       tofile="install.rdf"
                       overwrite="true">
                       <filterchain>
                               <replacetokens>
                                       <token key="VERSION" value="${VERSION}"/>
                                       <token key="DESCRIPTION" value="${DESCRIPTION}"/>
                               </replacetokens>
                       </filterchain>        
               </copy>
       </target>
</project>

Revision Source

<p>This ant script helps to package an extension.
</p>
<pre class="eval">&lt;?xml version="1.0"?&gt;
<span class="comment">This build file was written by Régis Décamps &lt;decamps@users.sf.net&gt;</span>

&lt;project name="blogmark" default="createxpi"&gt;
       &lt;property name="VERSION" value="1.3-rc1"/&gt;
       &lt;property name="DESCRIPTION" value="New context-menu item to add
                                           the current page in your Blogmarks"/&gt;
       <span class="comment">XPI file is created after "chrome/blogmark.jar"               is created, which is then stuffed into "blogmark.xpi"</span>
       &lt;target name="createxpi" depends="createjar" 
               description="Assemble the final build blogmark.xpi"&gt;
               &lt;zip destfile="blogmark-${VERSION}.xpi"&gt;
                        &lt;zipfileset dir="." includes="chrome/blogmark.jar" /&gt;
                        &lt;zipfileset dir="." includes="install.rdf" /&gt;
                &lt;/zip&gt;
        &lt;/target&gt;

       <span class="comment">Everything inside the chrome directory is zipped into chrome/blogmark.jar</span>
       &lt;target name="createjar" depends="templates" description="Assemble the jar"&gt;
                &lt;jar destfile="chrome/blogmark.jar"&gt;
                       &lt;fileset dir="chrome/"&gt;
                               &lt;include name="**/*"/&gt;
                               &lt;exclude name="**/*~"/&gt;
                               &lt;exclude name="**/*.tpl.*"/&gt;
                               &lt;exclude name="blogmark.jar"/&gt;
                       &lt;/fileset&gt;
                &lt;/jar&gt;        
        &lt;/target&gt;
    
       &lt;target name="templates" description="Generate files from templates."&gt;
               &lt;copy file="chrome/content/blogmark/contents.rdf.tpl.xml"
                     tofile="chrome/content/blogmark/contents.rdf"
                     overwrite="true"&gt;
                       &lt;filterchain&gt;
                               &lt;replacetokens&gt;
                                       &lt;token key="VERSION" value="${VERSION}"/&gt;
                                       &lt;token key="DESCRIPTION" value="${DESCRIPTION}"/&gt;
                               &lt;/replacetokens&gt;
                       &lt;/filterchain&gt;        
               &lt;/copy&gt;
               &lt;copy file="chrome/content/blogmark/about.xul.tpl.xml"
                       tofile="chrome/content/blogmark/about.xul" 
                       overwrite="true"&gt;
                       &lt;filterchain&gt;
                               &lt;replacetokens&gt;
                                       &lt;token key="VERSION" value="${VERSION}"/&gt;
                               &lt;/replacetokens&gt;
                       &lt;/filterchain&gt;        
               &lt;/copy&gt;
               &lt;copy file="install.rdf.tpl.xml"
                       tofile="install.rdf"
                       overwrite="true"&gt;
                       &lt;filterchain&gt;
                               &lt;replacetokens&gt;
                                       &lt;token key="VERSION" value="${VERSION}"/&gt;
                                       &lt;token key="DESCRIPTION" value="${DESCRIPTION}"/&gt;
                               &lt;/replacetokens&gt;
                       &lt;/filterchain&gt;        
               &lt;/copy&gt;
       &lt;/target&gt;
&lt;/project&gt;
</pre>
Revert to this revision