forked from millermedeiros/crossroads.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
90 lines (69 loc) · 3.31 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
<?xml version="1.0" encoding="utf-8"?>
<project name="crossroads" default="" basedir=".">
<!-- properties -->
<property file="dev/build/build.properties" />
<!-- custom tasks -->
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="${closure_compiler.jar}"/>
<!-- targets -->
<target name="-purgeJsDeploy">
<delete>
<fileset dir="${dist.dir}" includes="${dist.name} ${dist.min.name}" />
</delete>
<echo message="Purged JS deploy..." />
</target>
<target name="build" depends="-purgeJsDeploy">
<echo message="Building ${dist.name}..." />
<buildnumber file="${build.dir}/build.number"/>
<tstamp>
<format property="build.date" pattern="yyyy/MM/dd hh:mm aa" unit="hour"/>
</tstamp>
<loadfile property="license.txt" srcFile="${src.dir}/license.txt"/>
<loadfile property="intro.js" srcFile="${src.dir}/intro.js"/>
<loadfile property="crossroads.js" srcFile="${src.dir}/crossroads.js"/>
<loadfile property="route.js" srcFile="${src.dir}/route.js"/>
<loadfile property="lexer.js" srcFile="${src.dir}/pattern_lexer.js"/>
<copy file="${src.dir}/wrapper.js" tofile="${dist.dir}/${dist.name}" />
<!-- replace tokens -->
<replace>
<fileset dir="${dist.dir}" includes="${dist.name}" />
<replacefilter token="//::LICENSE:://" value="${license.txt}" />
<replacefilter token="//::INTRO_JS:://" value="${intro.js}" />
<replacefilter token="//::CROSSROADS_JS:://" value="${crossroads.js}" />
<replacefilter token="//::ROUTE_JS:://" value="${route.js}" />
<replacefilter token="//::LEXER_JS:://" value="${lexer.js}" />
<!-- version number, build number/date should come after other replaces -->
<replacefilter token="::VERSION_NUMBER::" value="${version.number}" />
<replacefilter token="::BUILD_NUMBER::" value="${build.number}" />
<replacefilter token="::BUILD_DATE::" value="${build.date}" />
</replace>
<echo message="${dist.name} built." />
</target>
<target name="minify">
<echo message="Building ${dist.min.name}..." />
<jscomp compilationLevel="simple" warning="verbose" debug="false" output="${dist.dir}/${dist.min.name}">
<externs dir="${build.dir}">
<file name="externs.js"/>
</externs>
<sources dir="${dist.dir}">
<file name="${dist.name}"/>
</sources>
</jscomp>
<echo message="${dist.min.name} built." />
</target>
<target name="jshint">
<apply dir="${dist.dir}" executable="java" parallel="false" failonerror="true">
<fileset dir="${dist.dir}">
<include name="${dist.name}"/>
</fileset>
<arg value="-jar" />
<arg path="${rhino.jar}" />
<arg path="${jshint.js}" />
<srcfile/>
<arg value="${jshint.opts}" />
</apply>
<echo>JSHint Successful</echo>
</target>
<target name="compile" depends="build, minify, jshint">
<echo message="Build Complete." />
</target>
</project>