|
1 | 1 | <?xml version="1.0"?> |
2 | 2 | <project name="Boilerplate Build" default="build" basedir="../"> <!-- one back since we're in build/ --> |
| 3 | + <!-- load property files --> |
3 | 4 | <property file="./build/build.properties"/> |
4 | | - <property name="build.number" value="${build.number}"/> |
| 5 | + <property file="./build/default.properties"/> |
| 6 | + |
5 | 7 | <target name="current-number"> |
6 | 8 | <echo>Current build number:${build.number}</echo> |
7 | 9 | </target> |
| 10 | + |
| 11 | + <!-- Increase the current build number by one and set build date --> |
| 12 | + <!-- as per http://www.ibmpressbooks.com/articles/article.aspx?p=519946 --> |
8 | 13 | <target name="rev"> |
9 | 14 | <echo message="Rev the build number..."/> |
10 | | - <propertyfile file="./build/build.properties"> |
11 | | - <entry key="build.number" type="int" operation="+" value="1" pattern="000"/> |
| 15 | + <propertyfile file="./build/${html5boilerplate.build.info}" comment="Build Information File - DO NOT CHANGE"> |
| 16 | + <entry key="build.number" type="int" default="0000" operation="+" pattern="0000"/> |
| 17 | + <entry key="build.date" type="date" value="now" pattern="dd.MM.yyyy HH:mm"/> |
12 | 18 | </propertyfile> |
13 | 19 | </target> |
| 20 | + |
14 | 21 | <target name="clean"> |
15 | 22 | <echo message="Cleaning up previous build directory..."/> |
16 | 23 | <delete dir="./publish/"/> |
17 | 24 | </target> |
| 25 | + |
18 | 26 | <target name="copy" depends="clean"> |
19 | 27 | <echo message="Copying over new files..."/> |
20 | 28 | <copy todir="./publish"> |
|
28 | 36 | </fileset> |
29 | 37 | </copy> |
30 | 38 | </target> |
| 39 | + |
31 | 40 | <target name="usemin" depends="copy"> |
32 | 41 | <echo message="Switching to minified js files..."/> |
33 | 42 |
|
|
37 | 46 | <replaceregexp match="(\d|\d(\.\d)+)\/jquery\.js" replace="\1/jquery.min.js" file="./publish/index.html" flags=""/> |
38 | 47 |
|
39 | 48 | </target> |
| 49 | + |
40 | 50 | <target name="scripts" depends="copy"> |
41 | 51 | <echo message="Concatenating and minifying javascript"/> |
42 | 52 | <concat destfile="./publish/js/script-${build.number}.js"> |
|
55 | 65 | </apply> |
56 | 66 | <!-- <delete file="./publish/js/script-${build.number}.js"/> View source has a posse. --> |
57 | 67 | </target> |
| 68 | + |
58 | 69 | <target name="css" depends="copy"> |
59 | 70 | <echo message="Minifying css..."/> |
60 | 71 | <concat destfile="./publish/css/style-${build.number}.css"> |
|
72 | 83 | <replace token="style.css" value="style-${build.number}.min.css" file="./publish/index.html"/> |
73 | 84 | <!-- <delete file="./publish/css/style-${build.number}.css"/> --> |
74 | 85 | </target> |
| 86 | + |
75 | 87 | <target name="imagespng" depends="copy"> |
76 | 88 | <echo message="Optimizing images"/> |
77 | 89 | <apply executable="optipng" osfamily="unix"> |
|
93 | 105 | </fileset> |
94 | 106 | </apply> |
95 | 107 | </target> |
| 108 | + |
96 | 109 | <target name="imagesjpg" depends="copy"> |
97 | 110 | <echo message="Clean up those jpgs..."/> |
98 | 111 | <apply executable="jpegtran" osfamily="unix"> |
|
129 | 142 | <mapper type="glob" from="*.jpg" to="./publish/images/*.jpg"/> |
130 | 143 | </apply> |
131 | 144 | </target> |
| 145 | + |
132 | 146 | <target name="html" depends="scripts"> |
133 | 147 | <echo message="Clean up the html..."/> |
134 | 148 |
|
|
151 | 165 |
|
152 | 166 |
|
153 | 167 | </target> |
| 168 | + |
154 | 169 | <target name="text" depends="current-number,clean,rev,copy,usemin,scripts,css,html" description="Concats files, runs YUI Compressor on them and makes magic happen."/> |
155 | 170 | <target name="build" depends="current-number,clean,rev,copy,usemin,scripts,css,html,imagespng,imagesjpg" description="Concats files, runs YUI Compressor, optimizes images. There is much rejoicing."/> |
156 | 171 | </project> |
0 commit comments