File:  [mozdev] / needlesearch / build.xml
Revision 1.17: download - view: text, annotated - select for diffs - revision graph
Mon Oct 27 21:57:01 2003 UTC (16 years, 7 months ago) by eelco
Branches: MAIN
CVS tags: HEAD
no 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="copy-from-live" description="Copies files from the test environment to src tree">
        <echo message="Copy files from ..\..\browsers\mozilla${test.browser.version}\chrome\ "/>
        <copy todir="src/.">
        	<fileset dir="F:\\Program Files\\mozilla.org\\Mozilla\\chrome">
        	  <exclude name="needlesearch/**/NeedleSearchData.rdf"/>
        	  <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>		
        </copy>
    </target>
    
    <target name="deploy-to-live" description="Deploy to live environment Mozilla ${test.browser.version}">
        
        <echo message="Copy files from src tree to Mozilla ${test.browser.version}"/>
        <copy todir="${test.browser.location}\\chrome">
        	<fileset dir="src/.">
        	  <exclude name="needlesearch/**/NeedleSearchData.rdf"/>
        	  <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>		
        </copy>
        
      </target>
	
	<target name="create-install-all.js" description="Creating install.js">
		
		<delete file="src/install.js"/>
		<copy file="src/install-all.js" tofile="src/install.js"/>
		<replace file="src/install.js" token="@@version-number@@" value="&quot;${app.version}&quot;"/>
		<replace file="src/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/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/install.js" token="@@message@@" value="NeedleSearch Toolbar"/>
	</target>
	
	<target name="version" description="Replacing all version numbers">
		
		<replace file="src/needlesearch/content/NeedleSearchPref.xul" token="@@version-number@@" value="${app.version}"/>
		<replace file="src/needlesearch/content/NeedleSearchPrefDialog.xul" token="@@version-number@@" value="${app.version}"/>
		<replace file="src/needlesearch/content/NeedleSearchPrefOverlay.xul" token="@@version-number@@" value="${app.version}"/>
		
	</target>
	
	<target name="deversion" description="Replacing all version numbers for replacevalue">
		
		<replace file="src/needlesearch/content/NeedleSearchPref.xul" token="${app.version}" value="@@version-number@@"/>
		<replace file="src/needlesearch/content/NeedleSearchPrefDialog.xul" token="${app.version}" value="@@version-number@@"/>
		<replace file="src/needlesearch/content/NeedleSearchPrefOverlay.xul" token="${app.version}" value="@@version-number@@"/>
		
	</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.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="extra/**/*.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/install.js"/-->

    </target>
	
	
    <target name="make-xpi" 
    		description="Make XPI for version ${app.version}" 
    		depends="label-build,version,create-install-all.js,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 monochromatic iconpack"/>
        <delete file="./icon/install.js"/>
		<copy file="./icon/install-icons.js" tofile="./icon/install.js"/>
		<replace file="./icon/install.js" token="@@dirname@@" value="monochromatic"/>
        <zip destfile="bin/ns-icons-monochromatic.xpi">
			<fileset dir="./icon">
					  <include name="monochromatic/*.gif"/>
					  <include name="install.js"/>
        	</fileset>		
        </zip>
        
      </target>
      
</project>

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