Skip to content

Commit ff3d10e

Browse files
committed
Added best practices of build version incrementing
Referencing http://www.ibmpressbooks.com/articles/article.aspx?p=519946 default.properties was added as well as build.properties(now used for overiding values in default.properties). Using the new buildinfo.properties file which is created dynamically to track the build number and build date. Also added a few comments and spaces between tasks to make the file easier to read. Changed .gitignore to ignore the buildinfo file not the build file.
1 parent d9fcb27 commit ff3d10e

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
publish/
2-
build/build.properties
2+
build/buildinfo.properties
33

‎build/build.properties‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# build.properties file defines overrides for default.properties
2+
# Explaination: This file should be created by each user as and when he or she needs to override particular values.
3+
# Consequently, it should not be placed under version control.

‎build/build.xml‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
<?xml version="1.0"?>
22
<project name="Boilerplate Build" default="build" basedir="../"> <!-- one back since we're in build/ -->
3+
<!-- load property files -->
34
<property file="./build/build.properties"/>
4-
<property name="build.number" value="${build.number}"/>
5+
<property file="./build/default.properties"/>
6+
57
<target name="current-number">
68
<echo>Current build number:${build.number}</echo>
79
</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 -->
813
<target name="rev">
914
<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"/>
1218
</propertyfile>
1319
</target>
20+
1421
<target name="clean">
1522
<echo message="Cleaning up previous build directory..."/>
1623
<delete dir="./publish/"/>
1724
</target>
25+
1826
<target name="copy" depends="clean">
1927
<echo message="Copying over new files..."/>
2028
<copy todir="./publish">
@@ -28,6 +36,7 @@
2836
</fileset>
2937
</copy>
3038
</target>
39+
3140
<target name="usemin" depends="copy">
3241
<echo message="Switching to minified js files..."/>
3342

@@ -37,6 +46,7 @@
3746
<replaceregexp match="(\d|\d(\.\d)+)\/jquery\.js" replace="\1/jquery.min.js" file="./publish/index.html" flags=""/>
3847

3948
</target>
49+
4050
<target name="scripts" depends="copy">
4151
<echo message="Concatenating and minifying javascript"/>
4252
<concat destfile="./publish/js/script-${build.number}.js">
@@ -55,6 +65,7 @@
5565
</apply>
5666
<!-- <delete file="./publish/js/script-${build.number}.js"/> View source has a posse. -->
5767
</target>
68+
5869
<target name="css" depends="copy">
5970
<echo message="Minifying css..."/>
6071
<concat destfile="./publish/css/style-${build.number}.css">
@@ -72,6 +83,7 @@
7283
<replace token="style.css" value="style-${build.number}.min.css" file="./publish/index.html"/>
7384
<!-- <delete file="./publish/css/style-${build.number}.css"/> -->
7485
</target>
86+
7587
<target name="imagespng" depends="copy">
7688
<echo message="Optimizing images"/>
7789
<apply executable="optipng" osfamily="unix">
@@ -93,6 +105,7 @@
93105
</fileset>
94106
</apply>
95107
</target>
108+
96109
<target name="imagesjpg" depends="copy">
97110
<echo message="Clean up those jpgs..."/>
98111
<apply executable="jpegtran" osfamily="unix">
@@ -129,6 +142,7 @@
129142
<mapper type="glob" from="*.jpg" to="./publish/images/*.jpg"/>
130143
</apply>
131144
</target>
145+
132146
<target name="html" depends="scripts">
133147
<echo message="Clean up the html..."/>
134148

@@ -151,6 +165,7 @@
151165

152166

153167
</target>
168+
154169
<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."/>
155170
<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."/>
156171
</project>

‎build/default.properties‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
# Build Versioning
3+
html5boilerplate.build.info = buildinfo.properties

0 commit comments

Comments
 (0)