aboutsummaryrefslogtreecommitdiffstats
path: root/build.xml
blob: bd052a5aae92cd0a29276069c1973df832e37eda (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
<project name="JSynProject" default="examples" basedir=".">
    <description>
        Build JSyn Java Synthesizer
    </description>
  <!-- set global properties for this build -->
  <tstamp>
     <format property="dstamp" pattern="yyyyMMdd"/>
  </tstamp>

  <property name="src.dir"    location="src/main/java"/>
  <property name="doc.dir"    location="doc"/>
  <property name="build.dir"  location="buildant"/>
  <property name="dist"       location="dist"/>
  <property name="main-class" value="com.jsyn.apps.AboutJSyn"/>
  <property name="jarfile"    value="${dist}/lib/jsyn-${dstamp}.jar"/>
  <property name="java-version" value="1.8"/>

  <property name="examples.dir"        location="examples/src/main/java"/>
  <property name="build.examples.dir"  location="buildant-examples"/>
  <property name="examples.jarfile"    value="${dist}/lib/jsyn-examples-${dstamp}.jar"/>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the necessary directories. -->
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.examples.dir}"/>
    <mkdir dir="${doc.dir}"/>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac target="${java-version}" source="${java-version}"
        srcdir="${src.dir}" destdir="${build.dir}"
        debug="${javacdebug}" debuglevel="${javacdebuglevel}">
      <classpath>
        <pathelement path="libs/jportaudio.jar"/>
        <pathelement path="libs/gluegen-rt.jar"/>
        <pathelement path="libs/joal.jar"/>
      </classpath>
    </javac>
  </target>

  <target name="dist" depends="compile"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>

    <!-- Put everything in ${build} into the jsyn-${DSTAMP}.jar file -->
    <jar jarfile="${jarfile}" basedir="${build.dir}">
        <manifest>
            <attribute name="Main-Class" value="${main-class}"/>
        </manifest>
    </jar>
  </target>

  <!-- Generate javadocs for current project into ${doc.dir} -->
  <target name="doc" depends="init" description="generate documentation">
    <javadoc
        sourcepath="${src.dir}"
        destdir="${doc.dir}"
        packagenames="com.jsyn.*"
        excludepackagenames="com.portaudio,com.jsyn.devices.jportaudio"
    />
    <echo message = "=================================================================" />
    <echo message = "Javadocs have been generated and placed in the ${doc.dir} folder!" />
    <echo message = "=================================================================" />
  </target>

  <target name="examples" depends="dist"
        description="compile the example source " >
    <javac target="${java-version}" source="${java-version}"
        srcdir="${examples.dir}" destdir="${build.examples.dir}"
        debug="${javacdebug}" debuglevel="${javacdebuglevel}">
      <classpath>
        <pathelement path="${jarfile}"/>
        <pathelement path="libs/jportaudio.jar"/>
        <pathelement path="libs/gluegen-rt.jar"/>
        <pathelement path="libs/joal.jar"/>
      </classpath>
    </javac>
    <jar jarfile="${examples.jarfile}" basedir="${build.examples.dir}">
    </jar>
  </target>

  <target name="clean"
        description="clean up" >
    <!-- Delete the directories created by ant. -->
    <delete dir="${build.dir}"/>
    <delete dir="${build.examples.dir}"/>
    <delete dir="${doc.dir}"/>
    <delete dir="${dist}"/>
  </target>
</project>