Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /nyar4psg/trunk/resources/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1158 - (hide annotations) (download) (as text)
Tue Jan 6 07:38:11 2015 UTC (9 years, 3 months ago) by nyatla
File MIME type: application/xml
File size: 14572 byte(s)
パッケージ構成をProcessing2.0向けに更新

1 nyatla 1158 <project name="ProcessingLibs" default="clean" basedir="../">
2    
3    
4     <!--
5     Properties for your project should be set and modified in the
6     build.properties file (located in the same folder as this build.xml file).
7    
8     THIS FILE SHOULD NOT BE EDITED, unless you know what you are doing.
9     If you have recommendations for improvements, please let Elie know
10     at prisonerjohn@gmail.com
11     -->
12    
13    
14    
15     <property file="./resources/build.properties" />
16    
17     <description>
18     ${ant.description}
19     </description>
20    
21    
22    
23    
24     <property name="line" value="------------------------------------------------------------------------------------------------" />
25    
26     <condition property="is.normal">
27     <equals arg1="${project.compile}" arg2="normal" />
28     </condition>
29    
30    
31     <!-- set the OS properties -->
32     <condition property="is.mac">
33     <os family="mac" />
34     </condition>
35     <condition property="is.windows">
36     <os family="windows" />
37     </condition>
38     <condition property="is.unix">
39     <os family="unix" />
40     </condition>
41    
42    
43     <property name="project.jar.name" value="${project.name}.jar"/>
44     <property name="project.src" location="src"/>
45     <property name="project.tmp" location="tmp"/>
46     <property name="project.web" location="web"/>
47     <property name="project.data" location="data"/>
48     <property name="project.lib" location="lib"/>
49     <property name="project.bin" location="bin"/>
50     <property name="project.bin.data" location="${project.bin}/data"/>
51     <property name="project.examples" location="examples"/>
52     <property name="project.reference" location="reference"/>
53     <property name="project.dist" location="distribution"/>
54     <property name="project.dist.version" location="distribution/${project.name}-${library.version}"/>
55     <property name="install.source" location="resources/install_instructions.txt"/>
56     <property name="install.destination" location="${project.dist.version}/INSTALL.txt"/>
57     <property name="libprops.source" location="resources/library.properties"/>
58    
59     <taskdef resource="net/sf/antcontrib/antcontrib.properties">
60     <classpath>
61     <pathelement location="./resources/code/ant-contrib-1.0b3.jar"/>
62     </classpath>
63     </taskdef>
64    
65    
66     <path id="classpath">
67     <fileset dir="${classpath.local.location}" includes="${classpath.local.include}" />
68     <fileset dir="${classpath.libraries.location}" includes="**/*.jar" />
69     <fileset dir="${project.lib}" includes="**/*.jar" />
70     </path>
71    
72    
73    
74     <!-- Create the time stamp -->
75     <tstamp>
76     <format property="date" pattern="MM/dd/yyyy" offset="0" unit="hour"/>
77     </tstamp>
78    
79     <target name="init">
80     <echo>${line}
81     Building the Processing library ${project.name} ${library.version}
82     ${line}
83     src path ${project.src}
84     bin path ${project.bin}
85     classpath.local ${classpath.local.location}
86     sketchbook ${sketchbook.location}
87     java version ${java.target.version}
88     ${line}
89     </echo>
90    
91    
92     <mkdir dir="${project.bin}"/>
93     </target>
94    
95    
96    
97     <target name="library.init" depends="init">
98     <echo message="init library ..." />
99     </target>
100    
101    
102    
103     <target name="library.run" depends="library.init">
104     <echo message="building library ..." />
105     <antcall target="generate.structure"><param name="folder" value="library"/></antcall>
106     <antcall target="generate.source" />
107     <antcall target="compile" />
108     <antcall target="generate.jar"><param name="folder" value="library"/></antcall>
109     <antcall target="generate.javadoc" />
110     <antcall target="generate.libprops" />
111     <antcall target="copyToSketchbook"><param name="folder" value="libraries"/></antcall>
112     <antcall target="generate.distribution" />
113     <antcall target="generate.install.library" />
114     <antcall target="generate.web" />
115     <antcall target="generate.zip" />
116     <delete dir="${project.tmp}"/>
117     </target>
118    
119    
120    
121     <target name="generate.libprops" if="is.normal">
122     <property name="libprops.destination" location="${project.tmp}/${project.name}/library.properties"/>
123     <copy file="${libprops.source}" tofile="${libprops.destination}" />
124     <antcall target="parse.file"><param name="file" value="${libprops.destination}"/></antcall>
125     </target>
126    
127    
128    
129     <target name="copyToSketchbook">
130     <echo message="copying files to the ${folder} folder in your sketchbook." />
131     <!-- copy the jar file to processing's sketchbook libraries folder -->
132     <delete dir="${sketchbook.location}/${folder}/${project.name}" />
133     <mkdir dir="${sketchbook.location}/${folder}/${project.name}" />
134     <copy todir="${sketchbook.location}/${folder}/${project.name}">
135     <fileset dir="${project.tmp}/${project.name}"/>
136     </copy>
137     </target>
138    
139    
140     <target name="compile">
141     <javac srcdir="${project.tmp}/${project.name}/src" destdir="${project.bin}" source="${java.target.version}" target="${java.target.version}" includeantruntime="false">
142     <classpath>
143     <path refid="classpath"/>
144     </classpath>
145     <compilerarg value="-Xlint"/>
146     </javac>
147     <copy todir="${project.bin.data}">
148     <fileset dir="${project.data}" excludes="README" />
149     </copy>
150     </target>
151    
152    
153     <target name="generate.jar">
154     <jar jarfile="${project.tmp}/${project.name}/${folder}/${project.jar.name}" basedir="${project.bin}"/>
155     </target>
156    
157    
158     <target name="generate.structure">
159     <delete dir="${project.tmp}" />
160     <mkdir dir="${project.tmp}" />
161     <mkdir dir="${project.tmp}/${project.name}" />
162     <mkdir dir="${project.tmp}/${project.name}/${folder}" />
163     <mkdir dir="${project.tmp}/${project.name}/examples" />
164     <mkdir dir="${project.tmp}/${project.name}/reference" />
165     <mkdir dir="${project.tmp}/${project.name}/src" />
166     <copy todir="${project.tmp}/${project.name}/examples">
167     <fileset dir="${project.examples}">
168     <exclude name="**/*README*"/>
169     </fileset>
170     </copy>
171     <copy todir="${project.tmp}/${project.name}/src">
172     <fileset dir="${project.src}"/>
173     </copy>
174     <copy todir="${project.tmp}/${project.name}/${folder}">
175     <fileset dir="${project.lib}" excludes="README" />
176     </copy>
177     </target>
178    
179    
180     <target name="generate.source" if="is.normal">
181     <antcall target="generate.source.win"/>
182     <antcall target="generate.source.nix"/>
183     </target>
184    
185    
186     <!-- These two targets are pretty much the same, except for the delimiter (can't find a better way of doing this) -->
187     <target name="generate.source.win" if="is.windows">
188     <echo message="generating source (windows) ..."/>
189     <path id="src.contents"><fileset dir="${project.tmp}/${project.name}/src" includes="**/*.java" /></path>
190     <property name="src.list" refid="src.contents" />
191     <foreach list="${src.list}" param="file" target="parse.file" delimiter=";" />
192     </target>
193     <target name="generate.source.nix" unless="is.windows">
194     <echo message="generating source (mac/linux) ..."/>
195     <path id="src.contents"><fileset dir="${project.tmp}/${project.name}/src" includes="**/*.java" /></path>
196     <property name="src.list" refid="src.contents" />
197     <foreach list="${src.list}" param="file" target="parse.file" delimiter=":" />
198     </target>
199    
200    
201     <target name="generate.distribution" if="is.normal">
202     <mkdir dir="${project.dist}"/>
203     <delete dir="${project.dist.version}"/>
204     <mkdir dir="${project.dist.version}" />
205     <mkdir dir="${project.dist.version}/${project.name}" />
206     <move file="${project.tmp}/${project.name}" toDir="${project.dist.version}" />
207     </target>
208    
209    
210    
211     <target name="generate.javadoc" if="is.normal">
212     <!-- create the java reference of the library -->
213     <javadoc bottom="Processing library ${project.name} by ${author.name}. ${library.copyright}"
214     classpath="${classpath.local.location}/core.jar;{project.bin}"
215     destdir="${project.tmp}/${project.name}/reference"
216     verbose="false"
217     stylesheetfile="resources/stylesheet.css"
218     doctitle="Javadocs: ${project.name}"
219     public="true" version="false"
220     windowtitle="Javadocs: ${project.name}">
221    
222     <link href="${javadoc.java.href}" />
223     <link href="${javadoc.processing.href}" />
224     <taglet name="ExampleTaglet" path="resources/code" />
225     <fileset dir="${project.tmp}/${project.name}/src" defaultexcludes="yes">
226     <!-- add packages to be added to reference. -->
227     <include name="**/*"/>
228     </fileset>
229     </javadoc>
230     </target>
231    
232    
233     <target name="generate.web" if="is.normal">
234    
235     <mkdir dir="${project.dist.version}/web" />
236     <copy todir="${project.dist.version}/web/reference">
237     <fileset dir="${project.dist.version}/${project.name}/reference" />
238     </copy>
239    
240     <copy todir="${project.dist.version}/web/examples">
241     <fileset dir="${project.dist.version}/${project.name}/examples" />
242     </copy>
243    
244     <copy todir="${project.dist.version}/web">
245     <fileset dir="${project.web}" />
246     </copy>
247    
248     <antcall target="parse.file"><param name="file" value="${project.dist.version}/web/index.html"/></antcall>
249    
250     <antcall target="processExamples" />
251    
252     <replaceregexp file="${project.dist.version}/web/index.html" match="##examples##" replace="" flags="g" />
253     </target>
254    
255    
256    
257     <!-- find and replace ##placeholder## keywords in a file -->
258     <target name="parse.file">
259     <echo message="${file}" />
260    
261     <replaceregexp file="${file}" match="##date##" replace="${date}" flags="g" />
262     <replaceregexp file="${file}" match="##copyright##" replace="${library.copyright}" flags="g" />
263    
264     <replaceregexp file="${file}" match="##author##" replace="${author.name} ${author.url}" flags="g" />
265     <replaceregexp file="${file}" match="##author.name##" replace="${author.name}" flags="g" />
266     <replaceregexp file="${file}" match="##author.url##" replace="${author.url}" flags="g" />
267    
268     <replaceregexp file="${file}" match="##library.name##" replace="${project.prettyName}" flags="g" />
269     <replaceregexp file="${file}" match="##project.name##" replace="${project.name}" flags="g" />
270    
271     <replaceregexp file="${file}" match="##library.version##" replace="${library.version}" flags="g" />
272     <replaceregexp file="${file}" match="##library.prettyVersion##" replace="${library.prettyVersion}" flags="g" />
273    
274     <replaceregexp file="${file}" match="##compatible.minRevision##" replace="${compatible.minRevision}" flags="g" />
275     <replaceregexp file="${file}" match="##compatible.maxRevision##" replace="${compatible.maxRevision}" flags="g" />
276    
277     <replaceregexp file="${file}" match="##library.url##" replace="${library.url}" flags="g" />
278     <replaceregexp file="${file}" match="##library.category##" replace="${library.category}" flags="g" />
279     <replaceregexp file="${file}" match="##library.sentence##" replace="${library.sentence}" flags="g" />
280     <replaceregexp file="${file}" match="##library.paragraph##" replace="${library.paragraph}" flags="g" />
281     <replaceregexp file="${file}" match="##library.keywords##" replace="${library.keywords}" flags="g" />
282     <replaceregexp file="${file}" match="##library.dependencies##" replace="${library.dependencies}" flags="g" />
283    
284     <replaceregexp file="${file}" match="##source.host##" replace="${source.host}" flags="g" />
285     <replaceregexp file="${file}" match="##source.url##" replace="${source.url}" flags="g" />
286     <replaceregexp file="${file}" match="##source.repository##" replace="${source.repository}" flags="g" />
287    
288     <replaceregexp file="${file}" match="##tested.platform##" replace="${tested.platform}" flags="g" />
289     <replaceregexp file="${file}" match="##tested.processingVersion##" replace="${tested.processingVersion}" flags="g" />
290     </target>
291    
292    
293    
294     <target name="generate.install.library" if="is.normal">
295     <copy file="${install.source}" tofile="${project.dist.version}/INSTALL.txt" />
296    
297     <antcall target="parse.file"><param name="file" value="${install.destination}"/></antcall>
298     </target>
299    
300    
301    
302     <target name="generate.zip" if="is.normal">
303     <!-- zip the distribution of the library -->
304    
305     <move todir="${project.dist.version}/tmp/${project.name}">
306     <fileset dir="${project.dist.version}/${project.name}" />
307     </move>
308    
309     <copy file="${project.dist.version}/tmp/${project.name}/library.properties" tofile="${project.dist.version}/web/download/${project.name}.txt" />
310    
311     <zip destfile="${project.dist.version}/${project.name}.zip"
312     basedir="${project.dist.version}/tmp"
313     excludes="**/.DS_Store"
314     />
315    
316     <move file="${project.dist.version}/${project.name}.zip" todir="${project.dist.version}/web/download" />
317    
318     <copy file="${project.dist.version}/web/download/${project.name}.zip" tofile="${project.dist.version}/web/download/${project.name}-${library.version}.zip" />
319     <copy file="${project.dist.version}/web/download/${project.name}.txt" tofile="${project.dist.version}/web/download/${project.name}-${library.version}.txt" />
320    
321     <move todir="${project.dist.version}">
322     <fileset dir="${project.dist.version}/web" />
323     </move>
324    
325     <delete dir="${project.dist.version}/tmp" />
326     </target>
327    
328    
329    
330     <!-- parsing the examples folder -->
331     <target name="processExamples">
332     <dirset id="examples.contents" dir="${project.examples}" excludes="*/*"/>
333     <property name="examples.list" refid="examples.contents"/>
334     <foreach list="${examples.list}" target="addExamples" param="exampleDir" delimiter=";">
335     </foreach>
336     </target>
337    
338    
339    
340     <target name="addExamples">
341     <echo>${exampleDir}</echo>
342     <propertyregex property="pde"
343     input="${exampleDir}"
344     regexp="^.*\/(.*)$"
345     select="\1"
346     casesensitive="false"
347     defaultValue="${exampleDir}" />
348    
349     <propertyregex property="data"
350     input="${exampleDir}"
351     regexp="data$"
352     select="true"
353     casesensitive="false"
354     defaultValue="false" />
355    
356     <if>
357     <equals arg1="${data}" arg2="false" />
358     <then>
359     <replaceregexp file="${project.dist.version}/web/index.html"
360     match="(##examples##)"
361     replace="&lt;li&gt;&lt;a href=&quot;examples/${exampleDir}/${pde}.pde&quot;&gt;${exampleDir}&lt;/a&gt;&lt;/li&gt; \1"
362     flags="g" />
363     </then>
364     <else>
365     <echo message="Data folder, attention." />
366     </else>
367     </if>
368     </target>
369    
370    
371    
372     <target name="clean" depends="library.run">
373     <delete dir="${project.bin}"/>
374     <delete dir="${project.tmp}"/>
375     <echo>
376    
377     ${line}
378     Name ${project.name}
379     Version ${library.prettyVersion} (${library.version})
380     Compiled ${project.compile}
381     Sketchbook ${sketchbook.location}
382     ${line}
383     done, finished.
384     ${line}
385     </echo>
386     </target>
387    
388     </project>
389    

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26