Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding build.xml to repo

  • Loading branch information...
commit f3c8687ee7a58cf961849d0ad5e0846d9aa4468f 1 parent d0f8e9b
@draeton authored
Showing with 174 additions and 1 deletion.
  1. +0 −1  .gitignore
  2. +174 −0 build.xml
View
1  .gitignore
@@ -1,4 +1,3 @@
dist/
README
build.properties
-build.xml
View
174 build.xml
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project name="Stitches" basedir="." default="prod">
+
+ <description>ANT build file for git://github.com/draeton/stitches</description>
+
+ <target name="-load.properties" description="Set properties for this build">
+ <echo message="Set properties for this build"/>
+
+ <property environment="env"/>
+ <property file="build.properties"/>
+
+ <property name="version" value="${build.major}.${build.minor}.${build.number}"/>
+ </target>
+
+
+ <target name="-init" description="Make project directory structure">
+ <echo message="Starting build ${version}..."/>
+ <echo message="Make project directory structure"/>
+
+ <delete dir="${build}"/>
+ <delete dir="${docs}"/>
+
+ <mkdir dir="${build}"/>
+ <mkdir dir="${docs}"/>
+ </target>
+
+
+ <target name="jshint" depends="-load.properties" description="JSHint check">
+ <echo message="JSHint check"/>
+
+ <pathconvert pathsep=" " property="jsfiles">
+ <fileset dir="${src}">
+ <include name="**/*.js"/>
+ </fileset>
+ </pathconvert>
+ <exec dir="${src}" executable="java" failonerror="true">
+ <arg line="-jar ${rhino} ${jshint} ${jsfiles}"/>
+ </exec>
+ <echo>Finished</echo>
+ </target>
+
+
+ <target name="-increment" depends="-load.properties" description="Increment build number">
+ <echo message="Increment build number"/>
+
+ <propertyfile file="build.properties">
+ <entry key="build.number" type="int" operation="+" default="0"/>
+ </propertyfile>
+ </target>
+
+
+ <target name="-readme" depends="-increment" description="Updating version number in README">
+ <echo message="Updating version number in README"/>
+
+ <delete file="README.md"/>
+ <copy file="README" tofile="README.md"/>
+ <replace file="README.md" token="@VERSION@" value="${version}"/>
+ </target>
+
+
+ <target name="-docco" depends="-init" description="Create docs using Docco">
+ <echo message="Create docs using Docco"/>
+
+ <exec executable="${docco}">
+ <arg value="${src}/main.js"/>
+ <arg value="${src}/icons.js"/>
+ <arg value="${src}/icon.js"/>
+ <arg value="${src}/page.js"/>
+ </exec>
+ <!-- clean up after docco -->
+ <delete dir="-p"/>
+ </target>
+
+
+ <target name="-concat" depends="-init" description="Concatenation of JS and CSS">
+ <echo message="Concatenation of JS and CSS"/>
+
+ <concat destfile="${build}/js/stitches-${version}.js" force="no">
+ <fileset dir="${src}" includes="main.js" />
+ <fileset dir="${src}" includes="icons.js" />
+ <fileset dir="${src}" includes="icon.js" />
+ <fileset dir="${src}" includes="page.js" />
+ </concat>
+ <concat destfile="${build}/css/stitches-${version}.css" force="no">
+ <fileset dir="${src}" includes="stitches.css" />
+ </concat>
+ </target>
+
+
+ <target name="-minify" depends="-concat" description="Invoke YUI compressor">
+ <echo message="Invoke YUI compressor"/>
+
+ <path id="task.classpath">
+ <pathelement location="${yui-compressor.jar}"/>
+ <pathelement location="${yui-compressor-ant-task.jar}"/>
+ </path>
+ <taskdef name="yui-compressor" classname="net.noha.tools.ant.yuicompressor.tasks.YuiCompressorTask">
+ <classpath refid="task.classpath"/>
+ </taskdef>
+
+ <yui-compressor warn="false" charset="UTF-8" fromdir="${build}" todir="${build}">
+ <include name="js/stitches-${version}.js" />
+ <include name="css/stitches-${version}.css" />
+ </yui-compressor>
+ </target>
+
+
+ <target name="-copylib" depends="-init" description="Copying dependencies">
+ <echo message="Copying dependencies"/>
+
+ <copy todir="${build}/js">
+ <fileset dir="${src}" includes="*.html"/>
+ </copy>
+ <copy todir="${build}/js">
+ <fileset dir="${src}/lib"/>
+ </copy>
+ </target>
+
+
+ <target name="-zip" depends="-init" description="Create a zip file for distribution">
+ <echo message="Create a zip file for distribution" />
+
+ <zip destfile="${dist}/stitches-${version}.zip" basedir="${build}" />
+ </target>
+
+
+ <target name="-commit" depends="-init" description="Commit new build to git repo">
+ <echo message="Commit new build to git repo"/>
+
+ <macrodef name="git">
+ <attribute name="command"/>
+ <attribute name="failonerror" default="true"/>
+ <attribute name="dir" default=""/>
+ <element name="args" optional="true"/>
+ <sequential>
+ <echo message="git @{command}"/>
+ <exec executable="git" dir="@{dir}">
+ <arg line="@{command}"/>
+ <args/>
+ </exec>
+ </sequential>
+ </macrodef>
+
+ <git command="add">
+ <args>
+ <arg line="."/>
+ </args>
+ </git>
+
+ <git command="commit">
+ <args>
+ <arg value="-am Build ${version} completed"/>
+ </args>
+ </git>
+ </target>
+
+
+ <!-- * build * -->
+ <target name="prod"
+ description="Builds project files for production use"
+ depends="
+ -load.properties,
+ -init,
+ jshint,
+ -increment,
+ -readme,
+ -docco,
+ -concat,
+ -minify,
+ -copylib,
+ -zip,
+ -commit">
+ </target>
+</project>
Please sign in to comment.
Something went wrong with that request. Please try again.