<commit_before><!--
Copyright 2010 <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!--
ngooglecode upload task: http://code.google.com/p/ant-googlecode/
svnant task: http://subclipse.tigris.org/svnant/svn.html
-->

<project default="test">

	<property file="build.credentials.properties" />
	<property file="build.properties" />
	<property name="svnroot" value="https://wordcram.googlecode.com/svn" />

	<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
	<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" classpath="lib/ant-googlecode/ant-googlecode-0.0.2.jar" name="gcupload" />
	<typedef resource="org/tigris/subversion/svnant/svnantlib.xml">
		<classpath>
			<fileset dir="lib/svnant">
				<include name="*.jar" />
			</fileset>
		</classpath>
	</typedef>

	<property name="classpath" value="lib/processing/core.jar;lib/jsoup-1.3.3.jar;lib/cue.language.jar" />

	<target name="clean">
		<delete dir="build" />
	</target>

	<target name="compile" depends="clean">
	  <mkdir dir="build/classes" />
	  <javac srcdir="src" destdir="build/classes" classpath="${classpath}" source="1.5" target="1.5" includeantruntime="false">
	    <compilerarg value="-Xlint" />
	  </javac>
	</target>

	<target name="test" depends="compile">
	  <mkdir dir="build/tests" />
	  <javac srcdir="test" destdir="build/tests" source="1.5" target="1.5" includeantruntime="false"
		 classpath="${classpath};lib/junit/junit-4.8.2.jar;lib/mockito-all-1.8.5.jar;build/classes">
	    <compilerarg value="-Xlint" />
	  </javac>
	  <junit dir="build/tests" haltonfailure="true">
	    <classpath path="${classpath};lib/junit/junit-4.8.2.jar;lib/mockito-all-1.8.5.jar;build/classes;build/tests" />
	    <formatter type="brief" usefile="false" />

	    <batchtest fork="yes">
	      <fileset dir="test">
		<include name="**/*.java" />
	      </fileset>
	    </batchtest>
	  </junit>
	</target>

	<target name="bundleForProcessing" depends="test">
		<mkdir dir="build/p5lib/WordCram/library" />
		<jar destfile="build/p5lib/WordCram/library/WordCram.jar" basedir="build/classes" />
		<copy file="lib/jsoup-1.3.3.jar" todir="build/p5lib/WordCram/library" />
		<copy file="lib/cue.language.jar" todir="build/p5lib/WordCram/library" />

		<mkdir dir="build/p5lib/WordCram/examples" />
		<copy todir="build/p5lib/WordCram/examples">
			<fileset dir="example" />
		</copy>

		<mkdir dir="build/p5lib/WordCram/src" />
		<copy todir="build/p5lib/WordCram/src">
			<fileset dir="src" />
		</copy>

		<mkdir dir="build/p5lib/WordCram/reference" />		
		<javadoc classpath="${classpath}" sourcepath="src" destdir="build/p5lib/WordCram/reference" 
			 windowtitle="WordCram API" use="true" overview="src/overview.html" header="WordCram 0.5">
		  <!-- TODO version # in build file - property? Or rather, pass it as an arg, and have it default to 'latest' or something. --> 
		  <!-- TODO put these in if it ever seems useful.
		  <link href="http://processing.googlecode.com/svn/trunk/processing/build/javadoc/" />
		  <link href="http://developer.java.sun.com/developer/products/xml/docs/api/"/>
		  -->
		</javadoc>
		
		<copy file="wordcram.png" todir="build/p5lib/WordCram/reference" />
	</target>

	<target name="publish.daily" depends="bundleForProcessing">
		<input message="Give us a quick summary for Google Code:" addproperty="publish.summary" />

		<tstamp>
			<format property="date" pattern="yyyyMMdd" />
		</tstamp>

		<property name="pub.file" value="wordcram.${date}" />
		<tar destfile="build/${pub.file}.tar.gz" basedir="build/p5lib" compression="gzip" />
		<zip destfile="build/${pub.file}.zip" basedir="build/p5lib" />

		<gcupload username="${gc.username}" password="${<PASSWORD>}" projectname="wordcram"
			  filename="build/${pub.file}.tar.gz" targetfilename="${pub.file}.tar.gz" 
			  summary="${publish.summary}" labels="development, daily" />
		<gcupload username="${gc.username}" password="${<PASSWORD>}" projectname="wordcram" 
			  filename="build/${pub.file}.zip" targetfilename="${pub.file}.zip" 
			  summary="${publish.summary}" labels="development, daily" />
	</target>
	
	<target name="makeReleaseBranch"> <!-- description="Make a release branch from the trunk." -->
		<input message="What's the release number?:" addproperty="publish.releaseNumber" /> <!-- TODO version # in build file - property? --> 
		
		<svn><copy srcUrl="${svnroot}/trunk" 
				destUrl="${svnroot}/branches/RB-${publish.releaseNumber}" 
				message="Added release branch ${publish.releaseNumber}" />
		</svn>
	</target>

	<target name="publish.release" depends="bundleForProcessing">
		<!-- run this from a RELEASE branch, NOT TRUNK  TODO add a check: check that current dir is under branches.  
			Can we find the release # from the branch name?  should be able to...  -->
		<input message="Give us a quick summary for Google Code:" addproperty="publish.summary" />

		<!-- TODO version # in build file - property? --> 
		<input message="...and the release number (should match the branch you're on):" addproperty="publish.releaseNumber" />  
		
		<property name="pub.file" value="wordcram.${publish.releaseNumber}" />
		<!-- zip -5Tr wordcram.0.5.1.zip WordCram -->
		<!-- tar -cvz WordCram > wordcram.0.5.1.tar.gz -->
		<tar destfile="build/${pub.file}.tar.gz" basedir="build/p5lib" compression="gzip" />
		<zip destfile="build/${pub.file}.zip" basedir="build/p5lib" />

		<gcupload username="${gc.username}" password="${<PASSWORD>}" projectname="wordcram" 
			  filename="build/${pub.file}.tar.gz" targetfilename="${pub.file}.tar.gz" 
			  summary="${publish.summary}" labels="release, stable, Featured" />
		<gcupload username="${gc.username}" password="${<PASSWORD>}" projectname="wordcram" 
			  filename="build/${pub.file}.zip" targetfilename="${pub.file}.zip" 
			  summary="${publish.summary}" labels="release, stable, Featured" />

		<svn><info target="." propprefix="branch" /></svn>
		<svn username="${gc.username}" password="${<PASSWORD>}"><commit_msg>Delete makeReleaseBranch ant task - we'll use a simpler strategy with git<commit_after><!--
Copyright 2010 <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!--
ngooglecode upload task: http://code.google.com/p/ant-googlecode/
svnant task: http://subclipse.tigris.org/svnant/svn.html
-->

<project default="test">

	<property file="build.credentials.properties" />
	<property file="build.properties" />
	<property name="svnroot" value="https://wordcram.googlecode.com/svn" />

	<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
	<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" classpath="lib/ant-googlecode/ant-googlecode-0.0.2.jar" name="gcupload" />
	<typedef resource="org/tigris/subversion/svnant/svnantlib.xml">
		<classpath>
			<fileset dir="lib/svnant">
				<include name="*.jar" />
			</fileset>
		</classpath>
	</typedef>

	<property name="classpath" value="lib/processing/core.jar;lib/jsoup-1.3.3.jar;lib/cue.language.jar" />

	<target name="clean">
		<delete dir="build" />
	</target>

	<target name="compile" depends="clean">
	  <mkdir dir="build/classes" />
	  <javac srcdir="src" destdir="build/classes" classpath="${classpath}" source="1.5" target="1.5" includeantruntime="false">
	    <compilerarg value="-Xlint" />
	  </javac>
	</target>

	<target name="test" depends="compile">
	  <mkdir dir="build/tests" />
	  <javac srcdir="test" destdir="build/tests" source="1.5" target="1.5" includeantruntime="false"
		 classpath="${classpath};lib/junit/junit-4.8.2.jar;lib/mockito-all-1.8.5.jar;build/classes">
	    <compilerarg value="-Xlint" />
	  </javac>
	  <junit dir="build/tests" haltonfailure="true">
	    <classpath path="${classpath};lib/junit/junit-4.8.2.jar;lib/mockito-all-1.8.5.jar;build/classes;build/tests" />
	    <formatter type="brief" usefile="false" />

	    <batchtest fork="yes">
	      <fileset dir="test">
		<include name="**/*.java" />
	      </fileset>
	    </batchtest>
	  </junit>
	</target>

	<target name="bundleForProcessing" depends="test">
		<mkdir dir="build/p5lib/WordCram/library" />
		<jar destfile="build/p5lib/WordCram/library/WordCram.jar" basedir="build/classes" />
		<copy file="lib/jsoup-1.3.3.jar" todir="build/p5lib/WordCram/library" />
		<copy file="lib/cue.language.jar" todir="build/p5lib/WordCram/library" />

		<mkdir dir="build/p5lib/WordCram/examples" />
		<copy todir="build/p5lib/WordCram/examples">
			<fileset dir="example" />
		</copy>

		<mkdir dir="build/p5lib/WordCram/src" />
		<copy todir="build/p5lib/WordCram/src">
			<fileset dir="src" />
		</copy>

		<mkdir dir="build/p5lib/WordCram/reference" />		
		<javadoc classpath="${classpath}" sourcepath="src" destdir="build/p5lib/WordCram/reference" 
			 windowtitle="WordCram API" use="true" overview="src/overview.html" header="WordCram 0.5">
		  <!-- TODO version # in build file - property? Or rather, pass it as an arg, and have it default to 'latest' or something. --> 
		  <!-- TODO put these in if it ever seems useful.
		  <link href="http://processing.googlecode.com/svn/trunk/processing/build/javadoc/" />
		  <link href="http://developer.java.sun.com/developer/products/xml/docs/api/"/>
		  -->
		</javadoc>
		
		<copy file="wordcram.png" todir="build/p5lib/WordCram/reference" />
	</target>

	<target name="publish.daily" depends="bundleForProcessing">
		<input message="Give us a quick summary for Google Code:" addproperty="publish.summary" />

		<tstamp>
			<format property="date" pattern="yyyyMMdd" />
		</tstamp>

		<property name="pub.file" value="wordcram.${date}" />
		<tar destfile="build/${pub.file}.tar.gz" basedir="build/p5lib" compression="gzip" />
		<zip destfile="build/${pub.file}.zip" basedir="build/p5lib" />

		<gcupload username="${gc.username}" password="${<PASSWORD>}" projectname="wordcram"
			  filename="build/${pub.file}.tar.gz" targetfilename="${pub.file}.tar.gz" 
			  summary="${publish.summary}" labels="development, daily" />
		<gcupload username="${gc.username}" password="${<PASSWORD>}" projectname="wordcram" 
			  filename="build/${pub.file}.zip" targetfilename="${pub.file}.zip" 
			  summary="${publish.summary}" labels="development, daily" />
	</target>

	<target name="publish.release" depends="bundleForProcessing">
		<!-- run this from a RELEASE branch, NOT TRUNK  TODO add a check: check that current dir is under branches.  
			Can we find the release # from the branch name?  should be able to...  -->
		<input message="Give us a quick summary for Google Code:" addproperty="publish.summary" />

		<!-- TODO version # in build file - property? --> 
		<input message="...and the release number (should match the branch you're on):" addproperty="publish.releaseNumber" />  
		
		<property name="pub.file" value="wordcram.${publish.releaseNumber}" />
		<!-- zip -5Tr wordcram.0.5.1.zip WordCram -->
		<!-- tar -cvz WordCram > wordcram.0.5.1.tar.gz -->
		<tar destfile="build/${pub.file}.tar.gz" basedir="build/p5lib" compression="gzip" />
		<zip destfile="build/${pub.file}.zip" basedir="build/p5lib" />

		<gcupload username="${gc.username}" password="${<PASSWORD>}" projectname="wordcram" 
			  filename="build/${pub.file}.tar.gz" targetfilename="${pub.file}.tar.gz" 
			  summary="${publish.summary}" labels="release, stable, Featured" />
		<gcupload username="${gc.username}" password="${<PASSWORD>}" projectname="wordcram" 
			  filename="build/${pub.file}.zip" targetfilename="${pub.file}.zip" 
			  summary="${publish.summary}" labels="release, stable, Featured" />

		<svn><info target="." propprefix="branch" /></svn>
		<svn username="${gc.username}" password="${<PASSWORD>}">
{'fraction_non_alphanumeric': 0.1812300319488818, 'fraction_numerical': 0.009744408945686902, 'mean_word_length': 4.3508547008547005, 'pattern_counts': {'":': 0, '<': 201, '<?xml version=': 0, '>': 203, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5464448', 'n_tokens_mistral': 4442, 'n_tokens_neox': 4095, 'n_words': 849}