-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
build.xml
196 lines (169 loc) · 7.44 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
<?xml version="1.0"?>
<project name="Processing Sound Library" default="jar">
<property file="build.properties"/>
<path id="classpath">
<pathelement location="${lib}/jsyn-17.1.0.jar" />
<pathelement location="${lib}/processing-core.zip" />
<pathelement location="${lib}/android.jar" />
</path>
<path id="classpath.testing">
<pathelement location="${lib}/junit-4.13.2.jar" />
<pathelement location="${lib}/hamcrest-core-1.3.jar" />
<!-- junit needs to come before android.jar: https://stackoverflow.com/a/18256532 -->
<pathelement location="${lib}/sound.jar" />
<path refid="classpath" />
</path>
<target name="clean" description="Clean the build directories">
<delete dir="bin" />
<delete dir="library/sound.jar" />
</target>
<target name="checkprocessingdeps">
<available file="${lib}/processing-core.zip" property="hasprocessingcore" />
<available file="${lib}/android.jar" property="hasandroid" />
</target>
<!-- as of version 2.2, the sound library is compiled against the -->
<!-- processing-core.zip provided by Processing for Android mode -->
<!-- we can automatically retrieve the latest version from GitHub -->
<target name="processing-deps" depends="checkprocessingdeps" unless="hasprocessingcore" description="Download Android mode's processing-core">
<get src="https://github.com/processing/processing-android/releases/download/latest/AndroidMode.zip" dest="${lib}" usetimestamp="true" />
<unzip src="${lib}/AndroidMode.zip" dest="${lib}">
<patternset>
<include name="AndroidMode/processing-core.zip" />
</patternset>
<mapper type="flatten"/>
</unzip>
<!-- no real need to keep parent zip -->
<delete file="${lib}/AndroidMode.zip" />
</target>
<target name="android-deps" depends="checkprocessingdeps" unless="hasandroid" description="Download an android.jar">
<!-- this part of the Android SDK is required to build JSynAndroidAudioDeviceManager -->
<!-- preferrably you should soft-link or copy the android.jar of your locally
installed SDK into this project's library/ directory -->
<get src="https://raw.githubusercontent.com/mardangelo/android-platforms/master/android-26/android.jar" dest="${lib}" usetimestamp="true" />
</target>
<target name="bundled-deps" description="Download JSyn and (J)PortAudio">
<get src="https://github.com/philburk/jsyn/releases/download/v17.1.0/jsyn-17.1.0.jar" dest="${lib}" skipexisting="true" />
<get src="https://www.softsynth.com/jsyn/developers/archives/jportaudio_mac_20120904.zip" dest="${lib}" skipexisting="true" />
<unzip src="${lib}/jportaudio_mac_20120904.zip" dest="${lib}">
<patternset>
<include name="**/*.jar" />
</patternset>
<mapper type="flatten"/>
</unzip>
<unzip src="${lib}/jportaudio_mac_20120904.zip" dest="${lib}/macos-x86_64/">
<patternset>
<include name="**/*.jnilib" />
</patternset>
<mapper type="flatten"/>
</unzip>
</target>
<target name="deps" description="Get library dependencies">
<antcall target="processing-deps" />
<antcall target="android-deps" />
<antcall target="bundled-deps" />
</target>
<target name="compile" depends="deps" description="Compile sources">
<mkdir dir="bin" />
<javac source="1.8" target="1.8" srcdir="src" destdir="bin" encoding="UTF-8" includeAntRuntime="false" nowarn="true">
<classpath refid="classpath" />
</javac>
</target>
<target name="jar" depends="compile" description="Build Sound library jar">
<jar destfile="library/sound.jar">
<fileset dir="bin" />
</jar>
</target>
<target name="javadoc">
<javadoc bottom="Processing Sound" destdir="reference" verbose="false" doctitle="Javadocs: Processing Sound" public="true" windowtitle="Javadocs: Processing Sound" additionalparam="-notimestamp -Xdoclint:all,-missing,-syntax -quiet">
<link href="https://processing.github.io/processing-javadocs/core/" />
<link href="https://www.softsynth.com/jsyn/docs/javadocs/" />
<fileset dir="src" defaultexcludes="yes">
<include name="**/*" />
</fileset>
<classpath refid="classpath" />
</javadoc>
</target>
<!-- see bottom of https://github.com/processing/processing4/wiki/Supported-Platforms#native-libraries -->
<target name="prepare-dist" depends="clean,maven-deps,jar">
<apply executable="mkdir" ignoremissing="false">
<filelist dir="${lib}" files="${native-lib-dirs}" />
</apply>
</target>
<patternset id="dist.files">
<include name="CONTRIBUTING.md" />
<include name="LICENSE" />
<include name="README.md" />
<include name="examples/**" />
<include name="library.properties" />
<include name="${lib}/*.jar" />
<include name="${lib}/*.jnilib" />
<!-- all files inside per-architecture native library directories -->
<include name="${lib}/*-*/*" />
<exclude name="library/android.jar" />
<exclude name="${lib}/junit-*" />
<exclude name="${lib}/hamcrest-*" />
</patternset>
<target name="dist" depends="prepare-dist,javadoc" description="Build clean Sound library zip">
<zip destfile="../sound.zip">
<zipfileset dir="." prefix="sound">
<patternset refid="dist.files" />
<include name="reference/**" />
</zipfileset>
<!-- explicitly add empty native directories -->
<zipfileset dir="${lib}" prefix="sound/${lib}" includes="${native-lib-dirs}" />
</zip>
<copy file="library.properties" toFile="../sound.txt" />
</target>
<target name="dist-android" depends="prepare-dist" description="Build a Sound library zip for Android mode">
<zip destfile="../sound-android.zip">
<zipfileset dir="." prefix="sound">
<patternset refid="dist.files" />
<!-- don't add any native library directories, see https://github.com/processing/processing-android/issues/738 -->
<exclude name="${lib}/*-*/*" />
<!-- also drop unnecessary jars to avoid duplicate class errors -->
<exclude name="${lib}/*spi*" />
<exclude name="${lib}/jportaudio.jar" />
</zipfileset>
</zip>
</target>
<target name="dist-slim" depends="prepare-dist" description="Build a reduced size Sound library zip (omitting javadoc documentation and examples with audio files)">
<zip destfile="../sound-slim.zip">
<zipfileset dir="." prefix="sound">
<patternset refid="dist.files" />
<exclude name="examples/**/data/*" />
</zipfileset>
<!-- explicitly add empty native directories -->
<zipfileset dir="${lib}" prefix="sound/${lib}" includes="${native-lib-dirs}" />
</zip>
</target>
<!-- local development targets -->
<target name="install" depends="dist" description="Local installation of library zip for testing/developing">
<unzip src="../sound.zip" dest="${local-processing-libraries}" />
</target>
<target name="quickinstall" depends="jar" description="Build and copy sound.jar for testing/developing">
<copy file="${lib}/sound.jar" toDir="${local-processing-libraries}/sound/library/" />
</target>
<!-- test targets -->
<target name="maven-deps">
<exec executable="mvn" discardOutput="true">
<arg line="dependency:copy-dependencies -DoutputDirectory=${lib}" />
</exec>
</target>
<target name="compile-tests" depends="compile,maven-deps">
<javac source="1.8" target="1.8" srcdir="test" destdir="test" encoding="UTF-8" includeAntRuntime="false" nowarn="true">
<classpath refid="classpath.testing" />
</javac>
</target>
<target name="test" depends="compile-tests">
<junit>
<classpath>
<path refid="classpath.testing" />
<pathelement location="test" />
</classpath>
<formatter type="xml" />
<batchtest>
<fileset dir="test/" includes="**/*Test.class" />
</batchtest>
</junit>
</target>
</project>