summarylogtreecommitdiffstats
path: root/build.xml
blob: 8b4945dd01fad38167db6636533a452a3e8162ab (plain)
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
<?xml version="1.0"?>
<project name="Processing" default="build">

  <condition property="platform" value="linux">
    <os family="unix" />
  </condition>

  <property name="examples.dir"
            value="../../processing-docs/content/examples" />

  <fileset dir="linux/work/java" id="jre-optional-linux">
    <include name="lib/ext/dnsns.jar" />

    <include name="bin/orbd" />
    <include name="bin/policytool" />
    <include name="bin/rmid" />
    <include name="bin/rmiregistry" />
    <include name="bin/servertool" />
    <include name="bin/tnameserv" />

    <include name="bin/javaws" />
    <include name="lib/javaws.jar" />

    <include name="lib/cmm/PYCC.pf" />
  </fileset>

  <!-- Unused JavaFX files that can be removed from the JRE on Windows
       and Linux. On Mac OS X, this is removed by the appbundler task.
       www.oracle.com/technetwork/java/javase/jdk-7-readme-429198.html
       However, we're now looking into using JavaFX as the default 2D
       renderer for 3.0. So in 3.0a8, we're no longer removing javafx. -->

  <fileset dir="${platform}/work/java" id="javafx-basics">
    <include name="THIRDPARTYLICENSEREADME-JAVAFX.txt" />
    <include name="lib/javafx.properties" />
    <include name="lib/jfxrt.jar" />
    <include name="lib/security/javafx.policy" />
  </fileset>

  <fileset dir="linux/work/java" id="javafx-linux-32">
    <include name="lib/i386/fxavcodecplugin-52.so" />
    <include name="lib/i386/fxavcodecplugin-53.so" />
    <include name="lib/i386/fxplugins.so" />
    <include name="lib/i386/libglass.so" />
    <include name="lib/i386/libgstplugins-lite.so" />
    <include name="lib/i386/libgstreamer-lite.so" />
    <include name="lib/i386/libjavafx-font.so" />
    <include name="lib/i386/libjavafx-iio.so" />
    <include name="lib/i386/libjfxmedia.so" />
    <include name="lib/i386/libjfxwebkit.so" />
    <include name="lib/i386/libprism-es2.so" />
  </fileset>

  <fileset dir="linux/work/java" id="javafx-linux-64">
    <include name="lib/amd64/fxavcodecplugin-52.so" />
    <include name="lib/amd64/fxavcodecplugin-53.so" />
    <include name="lib/amd64/fxplugins.so" />
    <include name="lib/amd64/libglass.so" />
    <include name="lib/amd64/libgstplugins-lite.so" />
    <include name="lib/amd64/libgstreamer-lite.so" />
    <include name="lib/amd64/libjavafx-font.so" />
    <include name="lib/amd64/libjavafx-iio.so" />
    <include name="lib/amd64/libjfxmedia.so" />
    <include name="lib/amd64/libjfxwebkit.so" />
    <include name="lib/amd64/libprism-es2.so" />
  </fileset>

  <!-- <echo message="${java.class.path}" /> -->

  <!-- Set a property named macosx, linux, or windows.
       The 'value' chosen is arbitrary. -->
  <property name="${platform}" value="${platform}" />

  <property environment="env" />

  <condition property="target.path" value="linux/work">
    <os family="unix" />
  </condition>

  <!-- Libraries required for running processing -->
  <!-- also need to copy these to the bundleapp task for macosx -->
  <fileset dir=".." id="runtime.jars">
    <include name="app/pde.jar" />
    <include name="app/lib/antlr.jar" />
    <include name="app/lib/jna.jar" />
    <include name="app/lib/jna-platform.jar" />
    <include name="app/lib/ant.jar" />
    <include name="app/lib/ant-launcher.jar" />
  </fileset>

  <target name="build" description="Build Processing.">
    <antcall target="${platform}-build" />
  </target>

  <target name="run" description="Run Processing.">
    <antcall target="${platform}-run" />
  </target>

  <!-- Run the app in a more "native" manner, i.e. no additional
       console for debugging. Ensures that double-clicking shortcuts
       and other desktop integration features work properly. -->
  <target name="app" description="Run Processing w/o console.">
    <antcall target="${platform}-run-app" />
  </target>

  <target name="dist"
          description="Build Processing for distribution.">
    <input message="Enter version number:"
           addproperty="version"
           defaultvalue="${revision}" />

    <available file="${examples.dir}" property="examples.exist" />
    <fail unless="examples.exist" message="To do a distribution, the processing-docs repo must be checked out at the same level as the processing repo." />

    <!-- do a git pull in the docs repo so that it is up to date -->
    <exec executable="git" dir="${examples.dir}">
      <arg line="pull" />
    </exec>

    <antcall target="${platform}-dist" />
  </target>

  <!-- "§$§$&, ant doesn't have a built-in help target :(  -->
  <target name="help" description="Show project help">
    <java classname="org.apache.tools.ant.Main">
      <arg value="-p" />
    </java>
  </target>

  <!-- - - - - - - - - - - - - - - - - - -->
  <!-- Subprojects: Core, App, Libraries -->
  <!-- - - - - - - - - - - - - - - - - - -->

  <target name="subprojects-clean">
    <subant buildpath="../core" target="clean"/>
    <subant buildpath="../app" target="clean"/>
    <subant buildpath="../java/libraries/dxf" target="clean"/>
    <subant buildpath="../java/libraries/io" target="clean"/>
    <subant buildpath="../java/libraries/net" target="clean"/>
    <subant buildpath="../java/libraries/pdf" target="clean"/>
    <subant buildpath="../java/libraries/serial" target="clean"/>
    <subant buildpath="../java/libraries/svg" target="clean"/>
    <subant buildpath="shared/tools/MovieMaker" target="clean"/>
    <subant buildpath="../java" target="clean"/>

    <!-- make sure this isn't around from an old build 140730 -->
    <delete dir="../java/examples" />
  </target>

  <target name="subprojects-build">
    <subant buildpath="../core" target="build"/>
    <subant buildpath="../app" target="build"/>
    <subant buildpath="../java/libraries/dxf" target="build"/>
    <subant buildpath="../java/libraries/net" target="build"/>
    <subant buildpath="../java/libraries/pdf" target="build"/>
    <subant buildpath="../java/libraries/serial" target="build"/>
    <subant buildpath="../java/libraries/svg" target="build"/>
    <subant buildpath="shared/tools/MovieMaker" target="build"/>
    <subant buildpath="../java" target="build"/>
  </target>

  <!-- - - - - - - - - -->
  <!-- Basic Assembly  -->
  <!-- - - - - - - - - -->

  <target name="assemble" depends="version-clear, version-write">
    <fail unless="target.path"
          message="Do not call assemble from the command line." />

    <!-- copy shared tools folder -->
    <copy todir="${target.path}/tools">
      <fileset dir="shared/tools" />
    </copy>

    <copy todir="${target.path}/modes/java">
      <fileset dir="../java">
        <!-- don't include LWJGL, it's not operational -->
        <exclude name="libraries/lwjgl/**" />

        <exclude name="reference.zip" />
        <exclude name="**/._*" />
      </fileset>
    </copy>

    <!-- get the examples folder, but don't require it to buid -->
    <copy todir="${target.path}/modes/java/examples" failonerror="false">
      <fileset dir="${examples.dir}" />
    </copy>

    <!-- if we're creating a dist, the reference is required -->
    <condition property="reference.ignorable" value="false" else="true">
      <isset property="version" />
    </condition>

    <!--<echo message="ref ignoreable? ${reference.ignorable}" />-->
    <get src="http://download.processing.org/reference.zip"
         dest="../java/reference.zip"
         ignoreerrors="${reference.ignorable}"
         usetimestamp="true" />

    <unzip dest="${target.path}/modes/java"
           src="../java/reference.zip"
           overwrite="false">
      <patternset>
        <exclude name="__MACOSX/**" />
        <exclude name="**/._*" />
      </patternset>
    </unzip>

  </target>

  <target name="version-clear">
    <delete file="${target.path}/lib/version.txt" />
  </target>

  <target name="version-write" if="version">
    <echo file="${target.path}/lib/version.txt" message="${version}"/>
  </target>

  <!-- - - - - - - - -->
  <!-- Linux         -->
  <!-- - - - - - - - -->

  <target name="linux-build" depends="subprojects-build" description="Build Linux version">
    <mkdir dir="linux/work" />

    <copy todir="linux/work">
      <fileset dir=".." includes="core/library/**" />
      <fileset dir="shared" includes="launch4j/**" />
      <fileset dir="shared" includes="lib/**"  />
      <fileset dir="shared" includes="modes/**" />
      <fileset file="shared/revisions.txt" />
    </copy>

    <antcall target="assemble">
      <param name="target.path" value="linux/work" />
    </antcall>

    <property name="launch4j.dir"
              value="linux/work/modes/java/application/launch4j" />
    <property name="launch4j.variant" value="linux" />

    <!-- rename the version we need -->
    <move file="${launch4j.dir}/bin/windres-${launch4j.variant}"
          tofile="${launch4j.dir}/bin/windres" />
    <move file="${launch4j.dir}/bin/ld-${launch4j.variant}"
          tofile="${launch4j.dir}/bin/ld" />

    <!-- make executable (ant doesn't preserve) -->
    <chmod perm="ugo+x" file="${launch4j.dir}/bin/windres" />
    <chmod perm="ugo+x" file="${launch4j.dir}/bin/ld" />

    <!-- remove the others -->
    <delete failonerror="true">
      <fileset dir="${launch4j.dir}/bin" includes="ld-*" />
      <fileset dir="${launch4j.dir}/bin" includes="windres-*" />
    </delete>

    <copy todir="linux/work/lib" flatten="true">
      <fileset refid="runtime.jars" />
    </copy>

    <copy file="linux/processing" todir="linux/work" />
    <chmod perm="ugo+x" file="linux/work/processing" />

    <!-- copy command line tool -->
    <copy file="linux/processing" tofile="linux/work/processing-java" />
    <chmod perm="ugo+x" file="linux/work/processing-java" />

    <!-- This allows Linux users to add mime types to the PDE by simply
         running the install script added to the Processing folder.
         This adds the following features:
         - the icons for the PDE in different resolutions
         - icons for the files
         - a desktop icon
         - when double clicking the *.pde files, the PDE will be opened

         from Sweden with <3
    -->
    <copy file="linux/install.sh" todir="linux/work" />
    <chmod perm="ugo+x" file="linux/work/install.sh" />

    <copy file="linux/uninstall.sh" todir="linux/work" />
    <chmod perm="ugo+x" file="linux/work/uninstall.sh" />

    <copy file="linux/processing-pde.xml" todir="linux/work/lib" />
    <copy file="linux/appdata.xml" todir="linux/work/lib" />
    <copy file="linux/desktop.template" todir="linux/work/lib" />

<!--
    Cannot use ant version of tar because it doesn't preserve properties.
    <untar compression="gzip"
           dest="linux/work"
           src="linux/jre.tgz"
           overwrite="false"/>
-->

<!--
    http://www.gnu.org/software/tar/manual/html_section/transform.html
-->
    <exec executable="true">
      <!-- Change directory -->
      <!--
      <arg value="-C" />
      <arg value="linux/work" />
      <arg value="-xzpf" />
      -->
      <arg value="xfz" />
      <arg value="../${jre.tgz.path}"/>
    </exec>

    <!-- use the jre subfolder when having downloaded a JDK file -->
    <condition property="jre.dir" value="jdk${jdk.esoteric}/jre">
      <!-- property might not be set, but it is for arm -->
      <equals arg1="${jre.download.jdk}" arg2="true" />
    </condition>
    <condition property="jre.dir" value="jre${jdk.esoteric}">
      <not>
        <equals arg1="${jre.download.jdk}" arg2="true" />
      </not>
    </condition>

    <exec executable="true" dir="linux">
      <arg value="-a" />
      <arg value="--delete" />
      <arg value="${jre.dir}/" />
      <arg value="work/java/" />
    </exec>

    <delete dir="linux/jre${jdk.esoteric}" failonerror="false" />
    <delete dir="linux/jdk${jdk.esoteric}" failonerror="false" />

    <!-- Remove unused JRE bloat. -->
    <delete failonerror="true">
      <!--
      <fileset refid="javafx-basics" />
      <fileset refid="javafx-linux-${sun.arch.data.model}" />
      -->
      <fileset refid="jre-optional-linux" />
    </delete>
  </target>

  <target name="linux-run" depends="linux-build"
          description="Run Linux version">
    <exec executable="./processing" dir="linux/work" spawn="true"/>
  </target>

  <target name="linux-dist" depends="linux-build"
          description="Build .tar.gz of linux version">

<!--
    <tar compression="gzip" destfile="linux/processing-${version}.tgz">
      <tarfileset dir="linux/work" prefix="processing-${version}" />
    </tar>
-->

   <!-- rename the work folder temporarily -->
   <move file="linux/work" tofile="linux/processing-${version}" />

   <property name="linux.dist" value="linux/processing-${version}-linux${sun.arch.data.model}.tgz" />

   <exec executable="tar">
     <arg value="--directory=linux" />
     <arg value="--file=${linux.dist}" />
     <arg value="-cpz" />
     <arg value="processing-${version}" />
   </exec>

   <!-- put... the candle... back -->
   <!-- (rename the work processing-NNNN version to work) -->
   <move file="linux/processing-${version}" tofile="linux/work" />

    <echo>
      =======================================================
      Processing for Linux was built. Grab the archive from

      ${linux.dist}
      =======================================================
    </echo>
  </target>

  <!-- Target to create the icons... putting this in here rather than docs.
       For OS X (though Linux might work), not intended for general use,
       because it requires things like iconutil (on OS X) or ImageMagick's
       convert tool (primarily in *nix environments). -->
  <target name="icons">
    <!-- Create .ico for exported Java applications -->
    <exec executable="convert" dir="../core/src/icon">
      <arg line="icon-16.png icon-32.png icon-48.png icon-64.png icon-256.png ../../../java/application/sketch.ico" />
    </exec>
  </target>

  <!-- - - - - - - - - -->
  <!-- Developer Docs -->
  <!-- - - - - - - - - -->

  <target name="doc">

    <mkdir dir="javadoc" />

    <!-- Core is in the classpath, so we must build it. -->
    <subant buildpath="../core" target="build" failonerror="false" />

    <!-- build doc for core -->
    <exec executable="find" dir="javadoc" errorproperty="ignored">
      <arg line="core -type f -exec rm -rf {} ';'" />
    </exec>

    <javadoc access="public" author="false" classpath="../core/library/jogl-all.jar:../core/bin:../core/library/gluegen-rt.jar" destdir="javadoc/core" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.8" splitindex="false" use="false" version="false">

      <!-- provide links for java.* classes.
           also suppresses the java.lang prefix in the text.  -->
      <link href="http://docs.oracle.com/javase/7/docs/api/" />

      <!-- prevent files from always appearing to have changed -->
      <arg value="-notimestamp" />

      <arg value="-quiet" />

      <!-- Suppress errors and display some information. -->
      <tag name="webref" enabled="false" />
      <tag name="nowebref" enabled="false" />
      <tag name="generate" enabled="false" />
      <tag name="instanceName" enabled="false" />
      <tag name="see_external" enabled="false" />
      <tag name="brief" description="In brief:" />
      <tag name="usage" />
      <arg value="-Xdoclint:reference,accessibility" />

      <packageset dir="../core/src">
        <include name="processing/**" />
      </packageset>

    </javadoc>

    <!-- build everything else -->
    <exec executable="find" dir="javadoc" errorproperty="ignored">
      <arg line="everything -type f -exec rm -rf {} ';'" />
    </exec>

    <javadoc access="public" author="false" classpath="../app/lib/ant.jar:../app/lib/ant-launcher.jar:../app/lib/antlr.jar:../app/lib/apple.jar:../app/lib/jna.jar:../app/lib/jna-platform.jar:../core/bin:../core/library/gluegen-rt.jar:../core/library/jogl-all.jar:../java/libraries/svg:../java/libraries/pdf/library/itext.jar:../java/libraries/dxf:../java/libraries/serial/library:${java.home}/lib/tools.jar" destdir="javadoc/everything" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.8" splitindex="false" use="false" version="false" noqualifier="all">

      <arg value="-notimestamp" />

      <arg value="-quiet" />

      <link href="http://docs.oracle.com/javase/7/docs/api/" />

      <packageset dir="../app/src">
        <include name="antlr/**" />
        <include name="processing/**" />
      </packageset>


      <tag name="webref" enabled="false" />
      <tag name="nowebref" enabled="false" />
      <tag name="generate" enabled="false" />
      <tag name="instanceName" enabled="false" />
      <tag name="see_external" enabled="false" />
      <tag name="brief" description="In brief:" />
      <tag name="usage" />
      <arg value="-Xdoclint:reference,accessibility" />

      <!--<packageset dir="../app/generated">
        <include name="processing/**" />
      </packageset>-->

      <packageset dir="../core/src">
        <include name="processing/**" />
        <!--
        <include name="japplemenubar/**" />
        -->
      </packageset>
    </javadoc>


    <!-- do libraries -->
    <exec executable="find" dir="javadoc" errorproperty="ignored">
      <arg line="libraries -type f -exec rm -rf {} ';'" />
    </exec>

    <javadoc access="public" author="false" classpath="../app/lib/ant.jar:../app/lib/ant-launcher.jar:../app/lib/antlr.jar:../app/lib/apple.jar:../app/lib/jna.jar:../app/lib/jna-platform.jar:../core/bin:../core/library/gluegen-rt.jar:../core/library/jogl-all.jar:../java/libraries/svg/library/batik-dom-1.8.jar:../java/libraries/svg/library/batik-svggen-1.8.jar:../java/libraries/pdf/library/itext.jar:../java/libraries/dxf:../java/libraries/serial/library/jssc.jar:${java.home}/lib/tools.jar" destdir="javadoc/libraries" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.8" splitindex="false" use="false" version="false" noqualifier="all">

      <arg value="-notimestamp" />

      <arg value="-quiet" />

      <link href="http://docs.oracle.com/javase/7/docs/api/" />
      <link href="../../javadoc/core/" />

      <tag name="webref" enabled="false" />
      <tag name="nowebref" enabled="false" />
      <tag name="generate" enabled="false" />
      <tag name="instanceName" enabled="false" />
      <tag name="see_external" enabled="false" />
      <tag name="brief" description="In brief:" />
      <tag name="usage" />
      <arg value="-Xdoclint:reference,accessibility" />


      <packageset dir="../java/libraries/dxf/src">
        <include name="antlr/**" />
        <include name="processing/**" />
      </packageset>
      <packageset dir="../java/libraries/io/src">
        <include name="antlr/**" />
        <include name="processing/**" />
      </packageset>
      <packageset dir="../java/libraries/net/src">
        <include name="antlr/**" />
        <include name="processing/**" />
      </packageset>
      <packageset dir="../java/libraries/pdf/src">
        <include name="antlr/**" />
        <include name="processing/**" />
      </packageset>
      <packageset dir="../java/libraries/serial/src">
        <include name="antlr/**" />
        <include name="processing/**" />
      </packageset>
      <packageset dir="../java/libraries/svg/src">
        <include name="antlr/**" />
        <include name="processing/**" />
      </packageset>
    </javadoc>

  </target>

</project>