forked from jdf/peasycam
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
executable file
·214 lines (172 loc) · 7.94 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<project name="PeasyCam" default="build">
<description>
PeasyCam build
</description>
<property name="processing" location="../peasy" />
<property name="processingLibraries" location="/Processing/libraries/" />
<property name="libraryClasspath" location="${processing}/lib" />
<path id="library-classpath">
<fileset dir="${libraryClasspath}">
<include name="core.jar" />
</fileset>
</path>
<property name="javaVersion" value="1.5" />
<property file="library.properties" prefix="library" />
<property name="author" value="Jonathan Feinberg" />
<property name="copyright" value="(c) 2011" />
<property name="libraryName" value="peasycam" />
<property name="yourLink" value="http://mrfeinberg.com" />
<property name="keywords" value="3D,camera,rotation" />
<property name="tested:platform" value="Windows" />
<property name="tested:processingVersion" value="1.5.1" />
<property name="tested:dependencies" value="" />
<property name="source:host" value="GitHub" />
<property name="source:url" value="http://github.com/jdf/peasycam/" />
<property name="source:repository" value="http://github.com/jdf/peasycam/" />
<!-- no changes or adjustments required below -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="./resources/code/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<property name="jarFile" value="peasycam.jar" />
<property name="src" location="src" />
<property name="bin" location="bin" />
<property name="reference" location="reference" />
<property name="dist" location="distribution" />
<target name="init">
<echo>Properties initialized.
src path ${src}
bin path ${bin}
libraryClasspath ${libraryClasspath}
processing Libraries ${processingLibraries}
java version ${javaVersion}
</echo>
<echo>building library ...</echo>
<!-- Create the time stamp -->
<tstamp>
<format property="date" pattern="MM/dd/yyyy" offset="0" unit="hour" />
</tstamp>
<mkdir dir="${dist}" />
</target>
<target name="pushweb" depends="build">
<exec executable="sh" dir="distribution/web">
<arg value="-c"/>
<arg value="chmod -R +rwX *"/>
</exec>
<exec executable="sh" dir="distribution/web">
<arg value="-c"/>
<arg value="rsync -azv --exclude .svn --delete -e ssh * [email protected]:/var/www/html/mrfeinberg.com/peasy"/>
</exec>
<exec executable="sh" dir="distribution/web">
<arg value="-c"/>
<arg value="ssh [email protected] chmod -R a+rX /var/www/html/mrfeinberg.com/peasy"/>
</exec>
</target>
<!-- compile the library -->
<target name="compile" depends="init" description="compile the source">
<echo message="Bump version number in applet"/>
<replaceregexp
match='VERSION = "[^"]+"'
replace='VERSION = "${library.version}"'
file="${src}/peasy/PeasyCam.java"/>
<echo message="bin: ${bin}"/>
<echo message="javaVersion: ${javaVersion}"/>
<echo message="library-classpath$ ${library-classpath}"/>
<mkdir dir="${bin}"/>
<javac target="${javaVersion}" destdir="${bin}" source="${javaVersion}">
<classpath>
<path refid="library-classpath" />
</classpath>
<src path="${src}" />
</javac>
</target>
<!-- build the distribution of the library -->
<target name="build" depends="compile" description="generate the distribution">
<!-- delete the previous content of the ${dist} folder -->
<delete dir="${dist}" />
<!-- build the structure for ${dist} -->
<mkdir dir="${dist}" />
<property name="realDist" value="${dist}/peasycam"/>
<mkdir dir="${realDist}" />
<mkdir dir="${realDist}/library" />
<mkdir dir="${realDist}/examples" />
<mkdir dir="${realDist}/reference" />
<mkdir dir="${realDist}/src" />
<jar jarfile="${realDist}/library/${jarFile}" basedir="${bin}" />
<copy todir="${realDist}" file="library.properties"/>
<copy todir="${realDist}/examples">
<fileset dir="examples" />
</copy>
<copy todir="${realDist}/src">
<fileset dir="src" />
</copy>
<copy todir="web" file="${realDist}/library/${jarFile}"/>
<copy todir="../Patchy/web" file="${realDist}/library/${jarFile}"/>
<!-- create the java reference of the library -->
<mkdir dir="${reference}" />
<javadoc bottom="processing library ${libraryName} by ${author}. ${copyright}" classpath="${libraryClasspath}/core.jar" destdir="${reference}" verbose="false" stylesheetfile="resources/stylesheet.css" doctitle="Javadocs: ${libraryName}" public="true" version="false" windowtitle="Javadocs: ${libraryName}">
<taglet name="ExampleTaglet" path="resources/code" />
<fileset dir="${src}" excludes="**/*.gz">
<include name="**/*" />
</fileset>
</javadoc>
<copy todir="${realDist}/reference">
<fileset dir="${reference}" />
</copy>
<!-- copy the jar file to processing's libraries -->
<copy todir="${processingLibraries}">
<fileset dir="${dist}" />
</copy>
<!-- zip the distribution of the library -->
<zip destfile="${dist}/${libraryName}.zip" basedir="${dist}" excludes="**/_DS.Store,**/applet/**" />
<copy file="${dist}/${libraryName}.zip" tofile="${dist}/${libraryName}_${library.version}.zip" />
<!-- organize the ${dist} folder -->
<mkdir dir="${dist}/web" />
<move todir="${dist}/web/reference">
<fileset dir="${realDist}/reference" />
</move>
<move todir="${dist}/web/examples">
<fileset dir="${realDist}/examples" />
</move>
<delete dir="${dist}/library" />
<copy todir="${dist}/web">
<fileset dir="web" />
</copy>
<copy tofile="${dist}/web/peasycam.txt" file="library.properties"/>
<replaceregexp file="${dist}/web/index.html" match="##yourLibrary##" replace="${libraryName}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##author##" replace="${author}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##versionNumber##" replace="${library.version}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##yourLink##" replace="${yourLink}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##date##" replace="${date}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##keywords##" replace="${keywords}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##tested:platform##" replace="${tested:platform}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##tested:processingVersion##" replace="${tested:processingVersion}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##tested:dependencies##" replace="${tested:dependencies}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##source:host##" replace="${source:host}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##source:url##" replace="${source:url}" flags="g" />
<replaceregexp file="${dist}/web/index.html" match="##source:repository##" replace="${source:repository}" flags="g" />
<echo>---------------------</echo>
<antcall target="processExamples" />
<echo>---------------------</echo>
<replaceregexp file="${dist}/web/index.html" match="##examples##" replace="" flags="g" />
<!-- finish organizating library's distribution -->
<copy file="${dist}/${libraryName}.zip" todir="${dist}/web" />
<copy file="${dist}/${libraryName}_${library.version}.zip" todir="${dist}/web" />
<copy todir="${processingLibraries}/peasycam/reference">
<fileset dir="${reference}" />
</copy>
<!-- done, finished. -->
<echo>done, finished.</echo>
</target>
<!-- parsing the examples folder -->
<target name="processExamples">
<dirset id="examples.contents" dir="examples" excludes="*/*" />
<property name="examples.list" refid="examples.contents" />
<foreach list="${examples.list}" target="addExamples" param="exampleDir" delimiter=";">
</foreach>
</target>
<target name="addExamples">
<replaceregexp file="${dist}/web/index.html" match="(##examples##)" replace="<li><a href="examples/${exampleDir}/applet/index.html">${exampleDir}</a></li> \1" flags="g" />
</target>
</project>