-
Notifications
You must be signed in to change notification settings - Fork 86
/
build.xml
95 lines (78 loc) · 3.5 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="Hasher" default="all" basedir="./">
<description>
Hasher Build Task. Unify files, compress, validate, generate documentation and distribution files.
</description>
<!-- properties -->
<property file="dev/build/build.properties"/>
<!-- targets -->
<target name="purge" description="Delete destination directories.">
<delete dir="${deploy.dir}" />
</target>
<target name="-mkdirs" description="Make required dirs.">
<mkdir dir="${deploy.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${docs.dir}"/>
</target>
<target name="-purgeDocs">
<delete dir="${docs.dir}" />
</target>
<target name="-purgeJS">
<delete dir="${dist.dir}" />
</target>
<target name="concat" depends="-purgeJS, -mkdirs" description="Concatenate Files and outputs uncompressed version of Hasher.">
<echo message="Building ${dist.name}" />
<tstamp>
<format property="build.date" pattern="yyyy/MM/dd hh:mm aa" unit="hour"/>
</tstamp>
<loadfile property="hasher.js" srcFile="${src.dir}/hasher.js"/>
<loadfile property="license.txt" srcFile="${src.dir}/license.txt"/>
<copy file="${src.dir}/wrapper.js" tofile="${dist.dir}/${dist.name}" />
<replace>
<fileset dir="${dist.dir}" includes="${dist.name}" />
<replacefilter token="//::LICENSE:://" value="${license.txt}" />
<replacefilter token="//::HASHER:://" value="${hasher.js}" />
<!-- version number, build number/date should come after other replaces -->
<replacefilter token="::VERSION_NUMBER::" value="${version.number}"/>
<replacefilter token="::BUILD_DATE::" value="${build.date}"/>
<replacefilter token="::BUILD_NUMBER::" value="${build.number}" />
</replace>
<echo message="${dist.name} built" />
</target>
<target name="minify" description="Build minified version of Hasher.">
<echo message="Building ${dist.min.name}" />
<apply executable="java" parallel="false" verbose="true" dest="${dist.dir}">
<fileset dir="${dist.dir}">
<include name="*.js" />
</fileset>
<arg line="-jar" />
<arg path="${yuicompressor.jar}" />
<arg value="--charset" />
<arg value="ANSI" />
<arg value="-o" />
<targetfile />
<mapper type="glob" from="*.js" to="*.min.js" />
</apply>
<echo message="${dist.min.name} built." />
</target>
<target name="generateDocs" depends="-purgeDocs" description="Build Hasher and generates documentation.">
<echo message="Generating documentation" />
<apply executable="java" parallel="false" verbose="true">
<fileset dir="${dist.dir}">
<include name="${dist.name}" />
</fileset>
<arg line="-jar" />
<arg path="${jsdoc-toolkit.dir}/jsrun.jar" />
<arg value="${jsdoc-toolkit.dir}/app/run.js" />
<arg value="-t=${jsdoc-toolkit.dir}/templates/hasher" />
<arg value="-d=${docs.dir}" />
</apply>
<echo message="Documentation generated" />
</target>
<target name="compile" depends="concat, minify">
<echo message="Compiled." />
</target>
<target name="deploy" depends="purge, -mkdirs, compile, generateDocs">
<echo message="Build Complete." />
</target>
</project>