Skip to content

Commit

Permalink
Added best practices of build version incrementing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Garowetz committed Aug 26, 2010
1 parent d9fcb27 commit ff3d10e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,3 +1,3 @@
publish/
build/build.properties
build/buildinfo.properties

3 changes: 3 additions & 0 deletions build/build.properties
@@ -0,0 +1,3 @@
# build.properties file defines overrides for default.properties
# Explaination: This file should be created by each user as and when he or she needs to override particular values.
# Consequently, it should not be placed under version control.
21 changes: 18 additions & 3 deletions build/build.xml
@@ -1,20 +1,28 @@
<?xml version="1.0"?>
<project name="Boilerplate Build" default="build" basedir="../"> <!-- one back since we're in build/ -->
<!-- load property files -->
<property file="./build/build.properties"/>
<property name="build.number" value="${build.number}"/>
<property file="./build/default.properties"/>

<target name="current-number">
<echo>Current build number:${build.number}</echo>
</target>

<!-- Increase the current build number by one and set build date -->
<!-- as per http://www.ibmpressbooks.com/articles/article.aspx?p=519946 -->
<target name="rev">
<echo message="Rev the build number..."/>
<propertyfile file="./build/build.properties">
<entry key="build.number" type="int" operation="+" value="1" pattern="000"/>
<propertyfile file="./build/${html5boilerplate.build.info}" comment="Build Information File - DO NOT CHANGE">
<entry key="build.number" type="int" default="0000" operation="+" pattern="0000"/>
<entry key="build.date" type="date" value="now" pattern="dd.MM.yyyy HH:mm"/>
</propertyfile>
</target>

<target name="clean">
<echo message="Cleaning up previous build directory..."/>
<delete dir="./publish/"/>
</target>

<target name="copy" depends="clean">
<echo message="Copying over new files..."/>
<copy todir="./publish">
Expand All @@ -28,6 +36,7 @@
</fileset>
</copy>
</target>

<target name="usemin" depends="copy">
<echo message="Switching to minified js files..."/>

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

</target>

<target name="scripts" depends="copy">
<echo message="Concatenating and minifying javascript"/>
<concat destfile="./publish/js/script-${build.number}.js">
Expand All @@ -55,6 +65,7 @@
</apply>
<!-- <delete file="./publish/js/script-${build.number}.js"/> View source has a posse. -->
</target>

<target name="css" depends="copy">
<echo message="Minifying css..."/>
<concat destfile="./publish/css/style-${build.number}.css">
Expand All @@ -72,6 +83,7 @@
<replace token="style.css" value="style-${build.number}.min.css" file="./publish/index.html"/>
<!-- <delete file="./publish/css/style-${build.number}.css"/> -->
</target>

<target name="imagespng" depends="copy">
<echo message="Optimizing images"/>
<apply executable="optipng" osfamily="unix">
Expand All @@ -93,6 +105,7 @@
</fileset>
</apply>
</target>

<target name="imagesjpg" depends="copy">
<echo message="Clean up those jpgs..."/>
<apply executable="jpegtran" osfamily="unix">
Expand Down Expand Up @@ -129,6 +142,7 @@
<mapper type="glob" from="*.jpg" to="./publish/images/*.jpg"/>
</apply>
</target>

<target name="html" depends="scripts">
<echo message="Clean up the html..."/>

Expand All @@ -151,6 +165,7 @@


</target>

<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."/>
<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."/>
</project>
3 changes: 3 additions & 0 deletions build/default.properties
@@ -0,0 +1,3 @@

# Build Versioning
html5boilerplate.build.info = buildinfo.properties

2 comments on commit ff3d10e

@roblarsen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool. Lots to learn from here.

@Garowetz
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the article links, I took most of that from the best practices there.

Please sign in to comment.