Source

processing-mother / Foetus / resources / build.xml

Full commit
<project name="processingLibs" default="build" basedir="../">
    
	<description>
        processingLibs. ant build file.
    </description>

	
<!-- #### (1) where are your processing libraries located? edit location. #### -->
	<property name="processing" location="D:\Documents\Processing\libraries"/>


<!-- #### (2) where are the jar files located that are required for compiling 
		your library such as e.g. core.jar ? edit location. #### -->

	<property name="libraryClasspath"  location="C:\Program Files\Processing\lib"/>	
	<path id="library-classpath">
		<fileset dir="${libraryClasspath}" >		
<!-- #### (3) add the jar files that are required for compiling. edit name.
		for more include files. duplicate <include name="" /> #### -->
			<include name="core.jar"/>
		</fileset>
	</path>		
	

<!-- #### (4) set the java version that should be used to compile your library. #### -->	
	<property name="javaVersion" value="1.6"/>
		
		
		
	<!-- #### 	the following items are properties that will be used to make changes to 
				the html document template. values of properties will be 
				implemented ito the document automatically. #### -->	
				
<!-- #### (5) who is the author of this library?  edit value.  #### -->
	<property name="author" value="Ilias Bergstrom"/>
	
<!-- #### (6) which copyright?  edit value.  #### -->
	<property name="copyright" value="(c) 2009"/>

<!-- #### (7) give your library a name. edit value.  #### -->
	<property name="libraryName"  value="Foetus"/>
	
<!-- #### (8) give your library a name. edit value.   #### -->
	<property name="versionNumber"  value="0.5.0"/>
	
<!-- #### (9) your contact url. edit value. #### -->
	<property name="yourLink"  value="http://www.onar3d.com" />
	
<!-- #### (10) a comma separated list of keywords describing your library. edit value. #### -->
	<property name="keywords"  value="Live, Performance, VJ, VJ-ing, OSC" />
	
<!-- #### (11) a comma separated list of platforms the library has been tested. edit value. #### -->
	<property name="tested:platform"  value="Windows" />
	
<!-- #### (12) the processing version this library has been tested with. edit value. #### -->
	<property name="tested:processingVersion"  value="1.0.7" />
	
<!-- #### (13) does the library depend on any other library, dll, jnilib, etc. edit value. #### -->
	<property name="tested:dependencies"  value="?" />
	
<!-- #### (14) where can the source code be found? edit value. #### -->
	<property name="source:host"  value="google code" />
	<property name="source:url"  value="http://code.google.com/p/processing-mother" />
	<property name="source:repository"  value="http://code.google.com/p/processing-mother/source/browse/" />








	
	
	
	
	<!-- no changes or adjustments required below -->
	
	
	
	
	
	
	
	
	
	
	<taskdef resource="net/sf/antcontrib/antcontrib.properties">
		<classpath>
			<pathelement location="./resources/code/ant-contrib-1.0b3.jar"/>
		</classpath>
	</taskdef>
	<property name="jarFile" value="${libraryName}.jar"/>
	<property name="src" location="src"/>
	<property name="bin" location="bin"/>
	<property name="reference" location="reference"/>
	<property name="dist" location="distribution"/>
	
	
	
	<target name="init">
	<echo>Properties initialized.
	src path			${src}
	bin path 			${bin}
	libraryClasspath		${libraryClasspath}
	processing Libraries	${processing}
	java version		${javaVersion}
	</echo>		
	<echo>building library ...</echo>
	<!-- Create the time stamp -->
	<tstamp> 
		<format property="date" pattern="MM/dd/yyyy" offset="0" unit="hour"/>
	</tstamp>
	<mkdir dir="${dist}"/>
  </target>
  
	<!-- compile the library -->
  <target name="compile" depends="init" description="compile the source" >  	
		<javac srcdir="${src}" destdir="${bin}" source="${javaVersion}">
			<classpath>
				<path refid="library-classpath"/>
			</classpath>
		</javac>
  </target>

	<!-- build the distribution of the library -->
  <target name="build" depends="compile" description="generate the distribution" >
  	<!-- delete the previous content of the ${dist} folder -->
  	<delete dir="${dist}" />
  	
  	<!-- build the structure for ${dist} -->
  	<mkdir dir="${dist}" />
  	<mkdir dir="${dist}/library" />
  	<mkdir dir="${dist}/examples" />
  	<mkdir dir="${dist}/reference" />
  	<mkdir dir="${dist}/src" />
  	<jar jarfile="${dist}/library/${jarFile}" basedir="${bin}"/>
  	<copy todir="${dist}/examples">
  		<fileset dir="examples"/>
  	</copy>
  	<copy todir="${dist}/src">
  		<fileset dir="src"/>
  	</copy> 
  	
	<!-- create the java reference of the library -->
 	<mkdir dir="${reference}" />
 	<javadoc bottom="processing library ${libraryName} by ${author}. ${copyright}" 
 			 classpath="${libraryClasspath}/core.jar" 
 			 destdir="${reference}" 
 			 verbose="false" 
 			 stylesheetfile="resources/stylesheet.css" 
 			 doctitle="Javadocs: ${libraryName}" 
 			 public="true" version="false" 
 			 windowtitle="Javadocs: ${libraryName}">
 		<taglet name="ExampleTaglet" path="resources/code" />
 		<fileset dir="${src}" defaultexcludes="yes">
 			<!-- #### (9) add packages to be added to reference. #### -->
			<include name="**/*"/>
		</fileset>
 	</javadoc>
 	
	<copy todir="${dist}/reference">
		<fileset dir="${reference}" />
	</copy>
  	
  	  	<!-- copy the jar file to processing's libraries -->
  	  	<mkdir dir="${processing}/${libraryName}" />
  		<copy todir="${processing}/${libraryName}">
  			<fileset dir="${dist}"/>
  		</copy> 

  	<!-- zip the distribution of the library -->
  	<zip destfile="${dist}/${libraryName}.zip"
  	       basedir="${dist}"
  	       excludes="**/_DS.Store"
	/>
  	
  	<!-- <rename src="${dist}/${libraryName}.zip" dest="${dist}/${libraryName}_${versionNumber}.zip" /> -->
 	
  	<!-- organize the ${dist} folder -->
  	<mkdir dir="${dist}/web" />
  	<move todir="${dist}/web/reference">
  		<fileset dir="${dist}/reference" />
  	</move>
  	
  	<move todir="${dist}/web/examples">
  		<fileset dir="${dist}/examples" />
  	</move>
  	
  	<delete dir="${dist}/library" />
  	
  	<copy todir="${dist}/web">
  		<fileset dir="web" />
  	</copy>
  	
  	<!--
  	format the index.html file. 
  	regular expressions are used to parse the web index.html file. 
  	key words starting and ending with ## are replaced by values 
  	defined earlier in the beginning of this build file.
  	-->
  	
  	<replaceregexp file="${dist}/web/index.html"
  	                         match="##yourLibrary##"
  	                         replace="${libraryName}"
  	                         flags="g" />
  	
  	<replaceregexp file="${dist}/web/index.html"
							match="##author##"
							replace="${author}"
							flags="g" />
  	
  	<replaceregexp file="${dist}/web/index.html"
							match="##versionNumber##"
							replace="${versionNumber}"
							flags="g" />
  	
	<replaceregexp file="${dist}/web/index.html"
							match="##yourLink##"
  							replace="${yourLink}"
							flags="g" />
  	
  	<replaceregexp file="${dist}/web/index.html"
  							match="##date##"
  	  						replace="${date}"
  	  						flags="g" />
  	  						
  	 <replaceregexp file="${dist}/web/index.html"
  							match="##keywords##"
  	  						replace="${keywords}"
  	  						flags="g" />
  	  						
  	  						
  	  						
  	 <replaceregexp file="${dist}/web/index.html"
  							match="##tested:platform##"
  	  						replace="${tested:platform}"
  	  						flags="g" />
  	 <replaceregexp file="${dist}/web/index.html"
  							match="##tested:processingVersion##"
  	  						replace="${tested:processingVersion}"
  	  						flags="g" />
  	 <replaceregexp file="${dist}/web/index.html"
  							match="##tested:dependencies##"
  	  						replace="${tested:dependencies}"
  	  						flags="g" />
  	 <replaceregexp file="${dist}/web/index.html"
  							match="##source:host##"
  	  						replace="${source:host}"
  	  						flags="g" />
  	 <replaceregexp file="${dist}/web/index.html"
  							match="##source:url##"
  	  						replace="${source:url}"
  	  						flags="g" />
  	 <replaceregexp file="${dist}/web/index.html"
  							match="##source:repository##"
  	  						replace="${source:repository}"
  	  						flags="g" />

  	
  	<echo>---------------------</echo>
  	<antcall target="processExamples" />
  	<echo>---------------------</echo>
  	
  	<replaceregexp file="${dist}/web/index.html"
  	  							match="##examples##"
  	  	  						replace=""
  	  	  						flags="g" />
  	  	  						
  	  	  						
  	<!-- finish organizating library's distribution -->
  	<mkdir dir="${dist}/web/download" />
  	<copy file="${dist}/${libraryName}.zip" todir="${dist}/web/download" />
  	
  	<copy todir="${processing}/${libraryName}/reference">
		<fileset dir="${reference}" />
	</copy>
  	
  	<!-- done, finished. -->
  	<echo>done, finished.</echo>
 </target>
 
 
 	
	<!-- parsing the examples folder -->
	<target name="processExamples">
		<dirset id="examples.contents" dir="examples" excludes="*/*"/>
		<property name="examples.list" refid="examples.contents"/>
		<foreach list="${examples.list}" target="addExamples" param="exampleDir" delimiter=";">
		</foreach>
	</target>
		
	<target name="addExamples">
		<replaceregexp file="${dist}/web/index.html"
	  					match="(##examples##)"
	  	  				replace="&lt;li&gt;&lt;a href=&quot;examples/${exampleDir}/${exampleDir}.pde&quot;&gt;${exampleDir}&lt;/a&gt;&lt;/li&gt; \1"
	  	  				flags="g" />
		</target>
</project>