File:  [mozdev] / needlesearch / build.xml
Revision 1.22: download - view: text, annotated - select for diffs - revision graph
Tue Jul 27 13:57:49 2004 UTC (15 years, 8 months ago) by eelco
Branches: MAIN
CVS tags: HEAD
*** empty log message ***

<project name="NeedleSearch Toolbar" default="make-xpi" basedir=".">

      <property file="build.properties"/>
      
      <property name="app.name" value="NeedleSearch"/>

  <!-- Actions -->

    <!-- Label the build -->
      <target name="label-build" description="Label the build">

        <propertyfile
            file="build-info.${user.name}.properties"
            comment="Build information" >
          <entry  key="developer" value="${user.name}" />
          <entry  key="date" type="date" value="now"/>
          <entry  key="build-nr" type="int" default="0" operation="+"/>
        </propertyfile>

        <propertyfile
            file="developer.properties"
            comment="Build information" >
          <entry  key="developer" value="${user.name}" />
        </propertyfile>

        <loadfile property="build-info-string" srcFile="build-info.${user.name}.properties">
          <filterchain>
            <striplinebreaks/>
          </filterchain>
        </loadfile>

        <!-- add to the build history -->
        <concat append="yes" destfile="build-history.${user.name}.txt" >${build-info-string}</concat>

      </target>


    <target name="deploy-to-live" description="Deploy to live environment Mozilla ${deploy.location}" depends="jar">
        
        <echo message="Copy files from src tree to Mozilla ${deploy.location}"/>
        <copy todir="${deploy.location}">
            <fileset dir="${src.dir}/chrome/.">
              <include name="needlesearch.jar"/>
              <include name="NeedleSearchBookmarks.rdf"/>
            </fileset>      
        </copy>
        
      </target>
    
    <target name="create-install-all.js" description="Creating install.js">
        
        <delete file="${src.dir}/install.js"/>
        <copy file="${src.dir}/install-all.js" tofile="${src.dir}/install.js"/>
        <replace file="${src.dir}/install.js" token="@@version-number@@" value="&quot;${app.version}&quot;"/>
        <replace file="${src.dir}/install.js" token="@@entries@@">
        <replacevalue>          
            registerChrome(CONTENT | DELAYED_CHROME, getFolder(findDir, "content"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/en-US/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/de-AT/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/es-AR/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/fr/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/fi/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/nl/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/da/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/cy-GB/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/it/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/ru/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/zh-CN/needlesearch"));
            registerChrome(LOCALE | DELAYED_CHROME, getFolder(findDir, "locale/se/needlesearch"));
        </replacevalue>
        </replace>
        
        <replace file="${src.dir}/install.js" token="//@@profileentries@@">
        <replacevalue>          
            //Now install the profile folder
            setPackageFolder(findDir);
            var err = addDirectory("needlesearch");
                if ( err == SUCCESS ) { 
                    registerChrome(CONTENT | PROFILE_CHROME, getFolder(findDir, &quot;profile&quot;));
                    err = performInstall();
                    if ( err != SUCCESS ) {
                        alert("performInstall() bailed");
                    }
                } else { 
                    alert("Creating the profile directory: needlesearch failed. Are you logged in as root?\nLinux/Unix user: make sure that all files in the directory chrome/needlesearch/ have write permissions");
                }
        </replacevalue>
        </replace>
        
        <replace file="${src.dir}/install.js" token="@@message@@" value="NeedleSearch Toolbar"/>
    </target>
    
    <target name="version" description="Replacing all version numbers">
        <replace file="${src.dir}/install.rdf" token="@@version-number@@" value="${app.version}"/>
        <replace file="${src.dir}/needlesearch/content/needlesearch/settings.xul" token="@@version-number@@" value="${app.version}"/>
        <replace file="${src.dir}/needlesearch/content/needlesearch/settingsDialog.xul" token="@@version-number@@" value="${app.version}"/>
        <replace file="${src.dir}/needlesearch/content/needlesearch/settingsOverlay.xul" token="@@version-number@@" value="${app.version}"/>
        
    </target>
    
    <target name="deversion" description="Replacing all version numbers for replacevalue">
        <replace file="${src.dir}/install.rdf" value="@@version-number@@" token="${app.version}"/>
        <replace file="${src.dir}/needlesearch/content/needlesearch/settings.xul" token="${app.version}" value="@@version-number@@"/>
        <replace file="${src.dir}/needlesearch/content/needlesearch/settingsDialog.xul" token="${app.version}" value="@@version-number@@"/>
        <replace file="${src.dir}/needlesearch/content/needlesearch/settingsOverlay.xul" token="${app.version}" value="@@version-number@@"/>
        
    </target>
    
   	<target name="create-dirs" description="Creating chrome dir">
		<mkdir dir="./src/chrome"/>
   		<mkdir dir="./bin"/>
	</target>
    
    <target name="jar" description="Make jar file" depends="create-dirs">
		<jar destfile="src/chrome/needlesearch.jar">
			<fileset dir="./src/needlesearch">
					  <include name="**/*.js"/>
					  <include name="**/*.xul"/>
					  <include name="**/*.dtd"/>
					  <include name="**/*.rdf"/>
					  <include name="**/*.properties"/>
					  <include name="**/*.gif"/>
					  <include name="**/*.png"/>
					  <include name="**/*.css"/>					  
        	</fileset>		
        </jar>
	</target>
    
    <target name="make-target" description="Make XPI for version ${app.version}">
        <property file="build-info.${user.name}.properties"/>
        
        <!--echo message="copy install.js"/>
        <copy file="src/install-all.js" tofile="src/install.js"/-->

        <echo message="Packaging webapp ${app.name}-${app.version}-(${build-nr}).xpi"/>
        <zip destfile="bin/${app.name}-${app.version}-(${build-nr}).xpi">
			<fileset dir="./src">
					  <include name="install.*"/>
					  <include name="chrome/needlesearch.jar"/>
					  <include name="chrome/NeedleSearchBookmarks.rdf"/>
					  
					  <!--exclude name="needlesearch/locale/zh-CN/**/*.*"/-->
					  <!--exclude name="needlesearch/locale/cy-GB/**/*.*"/-->
					  <!--exclude name="needlesearch/locale/it/**/*.*"/-->
        	</fileset>		
        </zip>

        <echo message="Cleaning up..."/>
        <!--delete file="${src.dir}/install.js"/-->

    </target>
    
    
    <target name="make-xpi" 
            description="Make XPI for version ${app.version}" 
            depends="label-build,version,jar,make-target,deversion"/>

    <target name="make-deinstaller" description="Make deinstaller for the toolbar">
        <property file="build-info.${user.name}.properties"/>
        
        <echo message="Packaging webapp deinstall-${app.name}.xpi"/>
        <jar destfile="bin/deinstall-${app.name}.xpi">
            <fileset dir="./deinstall-src">
                      <exclude name="needlesearch/**/NeedleSearchData.rdf"/>
                      <include name="install.js"/>
                      <include name="needlesearch/**/*.js"/>
                      <include name="needlesearch/**/*.xul"/>
                      <include name="needlesearch/**/*.dtd"/>
                      <include name="needlesearch/**/*.rdf"/>
                      <include name="needlesearch/**/*.properties"/>
                      <include name="needlesearch/**/*.gif"/>
                      <!--include name="needlesearch/**/*.png"/-->
            </fileset>      
        </jar>
      </target>

    <target name="make-iconpacks" description="Make iconpacks">
        
        <echo message="Packaging default iconpack"/>
        <delete file="./icon/install.js"/>
        <copy file="./icon/install-icons.js" tofile="./icon/install.js"/>
        <replace file="./icon/install.js" token="@@dirname@@" value="default"/>
        <zip destfile="bin/ns-icons-default.xpi">
            <fileset dir="./icon">
                      <include name="default/*.gif"/>
                      <include name="install.js"/>
            </fileset>      
        </zip>

        <echo message="Packaging modern iconpack"/>
        <delete file="./icon/install.js"/>
        <copy file="./icon/install-icons.js" tofile="./icon/install.js"/>
        <replace file="./icon/install.js" token="@@dirname@@" value="modern"/>
        <zip destfile="bin/ns-icons-modern.xpi">
            <fileset dir="./icon">
                      <include name="modern/*.gif"/>
                      <include name="install.js"/>
            </fileset>      
        </zip>
        
        <echo message="Packaging monochrome iconpack"/>
        <delete file="./icon/install.js"/>
        <copy file="./icon/install-icons.js" tofile="./icon/install.js"/>
        <replace file="./icon/install.js" token="@@dirname@@" value="monochrome"/>
        <zip destfile="bin/ns-icons-monochrome.xpi">
            <fileset dir="./icon">
                      <include name="monochrome/*.gif"/>
                      <include name="install.js"/>
            </fileset>      
        </zip>
        
      </target>
      
</project>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>