Skip to content

Commit

Permalink
Add new build based on jQuery UI build file
Browse files Browse the repository at this point in the history
  • Loading branch information
jzaefferer committed Mar 20, 2011
1 parent d47ed83 commit 16c064b
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions build.xml
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="jquery-validation" default="release" basedir=".">

<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="build/ant-contrib-0.6.jar"/>
</classpath>
</taskdef>

<property file="ant.properties" />

<loadfile failonerror="no" srcFile="version.txt" property="release.version">
<filterchain><striplinebreaks/></filterchain>
</loadfile>
<property name="release.filename" value="jquery-validation-${release.version}" />

<property name="dist.dir" value="dist/${release.filename}/" />

<property description="Google Closure" name="closure-jar" value="build/google-compiler-20110320.jar" />

<target name="release" depends="clean, copy, minify, replace-version, prepend-header, zip" description="Release builder">
</target>

<target name="replace-version">
<replaceregexp match="@VERSION" replace="${release.version}" flags="g" byline="true">
<fileset dir="${dist.dir}/" includes="*.js"/>
</replaceregexp>
<echo message="Replaced all @VERSION to ${release.version}." />
</target>

<target name="prepend-header">
<copy todir="${dist.dir}/headers/">
<fileset dir="${dist.dir}/" includes="*.js" excludes="*.min.js" />
</copy>
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
<fileset dir="${dist.dir}/headers/" includes="*.js"/>
</replaceregexp>
<for param="file">
<path><fileset dir="${dist.dir}/" includes="*.min.js" /></path>
<sequential>
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/>
<concat destfile="${dist.dir}/headered/${target}.min.js">
<header file="${dist.dir}/headers/${target}.js" />
<fileset file="@{file}" />
</concat>
</sequential>
</for>
<copy todir="${dist.dir}" overwrite="true">
<fileset dir="${dist.dir}/headered/" includes="*.js" />
</copy>

<delete dir="${dist.dir}/headers/" />
<delete dir="${dist.dir}/headered/" />
</target>

<target description="Zip the package" name="zip">
<zip destfile="${dist.dir}/../${release.filename}.zip">
<zipfileset dir="dist/" />
</zip>
</target>

<target name="minify">
<echo message="Building minified" />
<apply executable="java" parallel="false">
<fileset dir="${dist.dir}" includes="*.js" />
<arg line="-jar" />
<arg path="${closure-jar}" />
<arg value="--warning_level" />
<arg value="QUIET" />
<arg value="--js_output_file" />
<targetfile />
<arg value="--js" />
<mapper type="glob" from="*.js" to="${dist.dir}/*.min.js" />
</apply>
</target>

<target description="Copy needed folders" name="copy">
<echo message="Copying files" />
<mkdir dir="${dist.dir}" />
<copy overwrite="true" todir="${dist.dir}/">
<fileset dir="." excludes="**/.*, .*, .git/, dist/, test/, build/, build.xml" />
</copy>
</target>

<target name="clean">
<delete dir="${dist.dir}" />
<delete file="${dist.dir}/../${release.filename}.zip" />
</target>

<target name="whitespace">
<replaceregexp match="[\t ]+$" replace="" flags="g" byline="true">
<fileset dir="${src.dir}" includes="*.js"/>
<fileset dir="${src.dir}/i18n/" includes="*.js"/>
</replaceregexp>
<echo message="All trailing spaces removed." />
</target>

</project>
Binary file added build/ant-contrib-0.6.jar
Binary file not shown.
Binary file added build/google-compiler-20110320.jar
Binary file not shown.

0 comments on commit 16c064b

Please sign in to comment.