forked from codecomputerlove/Util
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
161 lines (96 loc) · 4.34 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?xml version="1.0" encoding="UTF-8"?>
<project name="Code.Util" default="build" basedir=".">
<property file="build.properties"/>
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="tools/google-closure/compiler.jar" />
<taskdef name="jshint" classname="com.philmander.jshint.JsHintAntTask" classpath="tools/ant-jshint-0.3.6/ant-jshint-0.3.6-SNAPSHOT-deps.jar" />
<target name="build">
<buildnumber/>
<echo>Building = ${project.build.version}</echo>
<!-- Delete and re-create working and artifact directory -->
<delete dir="${project.build.workdir}"/>
<delete dir="${project.build.artifactdir}/${project.build.version}"/>
<mkdir dir="${project.build.workdir}"/>
<mkdir dir="${project.build.artifactdir}/${project.build.version}"/>
<antcall target="checkJS" />
<antcall target="buildJs">
<param name="engine" value=""/>
</antcall>
<antcall target="buildJs">
<param name="engine" value=".jquery"/>
</antcall>
<antcall target="buildLibs" />
<antcall target="moveToArtifact" />
</target>
<target name="checkJS">
<jshint dir="${project.src.dir}" jshintSrc="tools\jshint-2.4.3\jshint.js" options="es3=true,browser=true,jquery=true,undef=true,unused=vars,strict=false,noarg=true,plusplus=false,curly=true,trailing=true">
<include name="**/*.js"/>
<exclude name="**/*.min.js"/>
<exclude name="**/lib/*.js"/>
</jshint>
</target>
<target name="buildJs">
<concat destfile="${project.build.workdir}/code.util${engine}-${project.build.version}.js">
<fileset dir="." includes="${project.src.dir}/util.js" />
<fileset dir="." includes="${project.src.dir}/browser.js" />
<fileset dir="." includes="${project.src.dir}/events${engine}.js" />
<fileset dir="." includes="${project.src.dir}/dom${engine}.js" />
<fileset dir="." includes="${project.src.dir}/ghostclick.js" />
<fileset dir="." includes="${project.src.dir}/animation.js" />
<fileset dir="." includes="${project.src.dir}/touchelement.js" />
<fileset dir="." includes="${project.src.dir}/touchelement.class.js" />
</concat>
<antcall target="versionStamp">
<param name="filePath" value="${project.build.workdir}/code.util${engine}-${project.build.version}.js"/>
</antcall>
<antcall target="minimizeJS">
<param name="dir" value="${project.build.workdir}" />
<param name="file" value="code.util${engine}-${project.build.version}.js"/>
<param name="output" value="${project.build.workdir}/code.util${engine}-${project.build.version}.min.js"/>
</antcall>
<antcall target="addLicense">
<param name="file" value="${project.build.workdir}/code.util${engine}-${project.build.version}.min.js"/>
</antcall>
</target>
<target name="buildLibs">
<!-- Copy the library folder to the working folder -->
<copy todir="${project.build.workdir}/lib">
<fileset dir="${project.src.dir}/lib"/>
</copy>
</target>
<target name="moveToArtifact">
<copy todir="${project.build.artifactdir}/${project.build.version}">
<fileset dir="${project.build.workdir}"/>
<fileset file="MIT-license.txt"/>
<fileset file="README.md"/>
<fileset file="${project.src.dir}/change.log"/>
</copy>
<copy todir="${project.build.artifactdir}/${project.build.version}/lib">
<fileset dir="${project.build.workdir}/lib"/>
</copy>
<delete dir="${project.build.workdir}" />
<fixcrlf srcdir="${project.build.artifactdir}" includes="**/*.log,**/*.js,**/*.txt,**/*.css,**/*.html" eol="crlf" />
</target>
<!-- Utility tasks -->
<target name="minimizeJS">
<jscomp compilationLevel="simple" debug="false" output="${output}">
<sources dir="${dir}">
<file name="${file}" />
</sources>
</jscomp>
</target>
<target name="addLicense">
<concat destfile="${file}.tmp">
<fileset dir="." includes="${project.src.dir}/version.header.txt" />
<fileset dir="." includes="${file}" />
</concat>
<antcall target="versionStamp">
<param name="filePath" value="${file}.tmp"/>
</antcall>
<delete file="${file}"/>
<move file="${file}.tmp" tofile="${file}" />
</target>
<target name="versionStamp">
<replace file="${filePath}" token="%%version%%" value="${project.build.version}"/>
<replace file="${filePath}" token="%%year%%" value="${project.build.year}"/>
</target>
</project>