Skip to content
This repository
Browse code

Add new build based on jQuery UI build file

  • Loading branch information...
commit 16c064b89912b64b0445e0dfd112096c1ff5f52e 1 parent d47ed83
Jörn Zaefferer authored March 20, 2011
98  build.xml
... ...
@@ -0,0 +1,98 @@
  1
+<?xml version="1.0" encoding="iso-8859-1"?>
  2
+<project name="jquery-validation" default="release" basedir=".">
  3
+	
  4
+	<taskdef resource="net/sf/antcontrib/antcontrib.properties">
  5
+		<classpath>
  6
+			<pathelement location="build/ant-contrib-0.6.jar"/>
  7
+		</classpath>
  8
+	</taskdef>
  9
+	
  10
+	<property file="ant.properties" />
  11
+
  12
+	<loadfile failonerror="no" srcFile="version.txt" property="release.version">
  13
+		<filterchain><striplinebreaks/></filterchain>
  14
+	</loadfile>
  15
+	<property name="release.filename" value="jquery-validation-${release.version}" />
  16
+
  17
+	<property name="dist.dir" value="dist/${release.filename}/" />
  18
+
  19
+	<property description="Google Closure" name="closure-jar" value="build/google-compiler-20110320.jar" />
  20
+	
  21
+	<target name="release" depends="clean, copy, minify, replace-version, prepend-header, zip" description="Release builder">
  22
+	</target>
  23
+	
  24
+	<target name="replace-version">
  25
+		<replaceregexp match="@VERSION" replace="${release.version}" flags="g" byline="true">
  26
+		    <fileset dir="${dist.dir}/" includes="*.js"/>
  27
+		</replaceregexp>
  28
+		<echo message="Replaced all @VERSION to ${release.version}." />
  29
+	</target>
  30
+	
  31
+	<target name="prepend-header">
  32
+		<copy todir="${dist.dir}/headers/">
  33
+			<fileset dir="${dist.dir}/" includes="*.js" excludes="*.min.js" />
  34
+		</copy>
  35
+		<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
  36
+		    <fileset dir="${dist.dir}/headers/" includes="*.js"/>
  37
+		</replaceregexp>
  38
+		<for param="file">
  39
+			<path><fileset dir="${dist.dir}/" includes="*.min.js" /></path>
  40
+			<sequential>
  41
+				<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/>
  42
+				<concat destfile="${dist.dir}/headered/${target}.min.js">
  43
+					<header file="${dist.dir}/headers/${target}.js" />
  44
+					<fileset file="@{file}" />
  45
+				</concat>
  46
+			</sequential>
  47
+		</for>
  48
+		<copy todir="${dist.dir}" overwrite="true">
  49
+			<fileset dir="${dist.dir}/headered/" includes="*.js" />
  50
+		</copy>
  51
+		
  52
+		<delete dir="${dist.dir}/headers/" />
  53
+		<delete dir="${dist.dir}/headered/" />
  54
+	</target>
  55
+
  56
+	<target description="Zip the package" name="zip">
  57
+		<zip destfile="${dist.dir}/../${release.filename}.zip">
  58
+			<zipfileset dir="dist/" />
  59
+		</zip>
  60
+	</target>
  61
+
  62
+	<target name="minify">
  63
+		<echo message="Building minified" />
  64
+		<apply executable="java" parallel="false">
  65
+			<fileset dir="${dist.dir}" includes="*.js" />
  66
+			<arg line="-jar" />
  67
+			<arg path="${closure-jar}" />
  68
+			<arg value="--warning_level" />
  69
+			<arg value="QUIET" />
  70
+			<arg value="--js_output_file" />
  71
+			<targetfile />
  72
+			<arg value="--js" />
  73
+			<mapper type="glob" from="*.js" to="${dist.dir}/*.min.js" />
  74
+		</apply>
  75
+	</target>
  76
+	
  77
+	<target description="Copy needed folders" name="copy">
  78
+		<echo message="Copying files" />
  79
+		<mkdir dir="${dist.dir}" />
  80
+		<copy overwrite="true" todir="${dist.dir}/">
  81
+			<fileset dir="." excludes="**/.*, .*, .git/, dist/, test/, build/, build.xml" />
  82
+		</copy>
  83
+	</target>
  84
+	
  85
+	 <target name="clean">
  86
+	 	<delete dir="${dist.dir}" />
  87
+	 	<delete file="${dist.dir}/../${release.filename}.zip" />
  88
+    </target>
  89
+	
  90
+	<target name="whitespace">
  91
+		<replaceregexp match="[\t ]+$" replace="" flags="g" byline="true">
  92
+		    <fileset dir="${src.dir}" includes="*.js"/>
  93
+		    <fileset dir="${src.dir}/i18n/" includes="*.js"/>
  94
+		</replaceregexp>
  95
+		<echo message="All trailing spaces removed." />
  96
+	</target>
  97
+	
  98
+</project>
BIN  build/ant-contrib-0.6.jar
Binary file not shown
BIN  build/google-compiler-20110320.jar
Binary file not shown

0 notes on commit 16c064b

Please sign in to comment.
Something went wrong with that request. Please try again.