-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
166 lines (134 loc) · 5.76 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
<?xml version="1.0"?>
<project name="ProcessingPythonMode" default="release" basedir="./">
<!-- Based on mode template http://github.com/martinleopold/TemplateMode -->
<!-- Note: now compiles two separate jars- one for python mode, and one that's a wrapper for the processing core that can run python files -->
<!-- You'll want to change these to compile. -->
<property name="processing.base" location="/home/james/dev/processing-2.1.1" /> <!-- The directory that you unpacked Processing into. -->
<property name="processing.sketchfolder" location="/home/james/dev/sketchbook" /> <!-- Your sketchbook folder. -->
<property name="java.target.bootclasspath" location="/usr/lib/jvm/java-6-oracle/jre/lib/rt.jar" /> <!-- If you're using a newer jdk -->
<!-- Leave these be. -->
<description>Python Mode for Processing 2.0.</description>
<property name="lib.name" value="PythonMode" />
<property name="wrap.name" value="ProcessingJythonWrapper" />
<property name="release" value="0.1" />
<property name="java.target.version" value="1.6" />
<property name="src" value="src" />
<property name="gen" value="generated" />
<property name="build" value="build" />
<property name="dist" value="dist" />
<property name="releasedir" value="release" />
<property name="lib.path" value="info/sansgills/mode/python" />
<property name="wrap.path" value="info/sansgills/mode/python/wrapper" />
<property name="preproc.path" value="info/sansgills/mode/python/preproc" />
<path id="library-classpath">
<fileset dir="${processing.base}/core/library/" > <!-- processing core -->
<include name="*.jar" />
</fileset>
<fileset dir="${processing.base}/lib/" > <!-- pde and ant -->
<include name="*.jar" />
</fileset>
<fileset dir="lib" >
<include name="*.jar" /> <!-- jython and antlr runtime -->
</fileset>
</path>
<condition property="gen.present">
<available file="${gen}" />
</condition>
<!-- - - - - - - - - - - - - - - - - - - - - - -
GET
- - - - - - - - - - - - - - - - - - - - - - - -->
<target name="get">
<mkdir dir="lib" />
<mkdir dir="tool" />
<get
src="http://search.maven.org/remotecontent?filepath=org/python/jython-standalone/2.7-b1/jython-standalone-2.7-b1.jar"
dest="lib/jython-standalone-2.7-b1.jar"
skipexisting="true"
verbose="true" /> <!-- download latest jython (note: update this if jython updates) -->
<get
src="http://www.antlr.org/download/antlr-runtime-4.1.jar"
dest="lib/antlr-runtime-4.1.jar"
skipexisting="true"
verbose="true" /> <!-- download latest ANTLR runtime (to include with the mode) -->
<get
src="http://antlr4.org/download/antlr-4.1-complete.jar"
dest="tool/antlr-4.1-complete.jar"
skipexisting="true"
verbose="true" /> <!-- download latest ANTLR compiler (to compile our grammars; not included) -->
</target>
<target name="generate" depends="get" unless="gen.present">
<mkdir dir="${gen}" />
<java jar="tool/antlr-4.1-complete.jar" fork="true">
<arg value="-lib" />
<arg value="${basedir}/${src}/${preproc.path}" />
<arg value="-o" />
<arg value="${basedir}/${gen}/${preproc.path}" />
<arg value="${basedir}/${src}/${preproc.path}/PyPde.g4" />
</java>
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - -
BUILD
- - - - - - - - - - - - - - - - - - - - - - - -->
<target name="build" depends="get,generate">
<propertyfile file="build.number" /> <!-- create the build.number file if it doesn't exist -->
<buildnumber file="build.number" />
<mkdir dir="${build}" />
<javac destdir="${build}" source="${java.target.version}" target="${java.target.version}" bootclasspath="${java.target.bootclasspath}" includeantruntime="false" debug="true">
<src path="${src}" />
<src path="${gen}" />
<classpath>
<path refid="library-classpath"/>
</classpath>
</javac>
<copy file="${src}/${wrap.path}/prepend.py" tofile="${build}/${wrap.path}/prepend.py" />
<copy file="${src}/${wrap.path}/scrub.py" tofile="${build}/${wrap.path}/scrub.py" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - -
PACKAGE
- - - - - - - - - - - - - - - - - - - - - - - -->
<target name="package" depends="build">
<delete dir="${dist}" />
<property name="bundle" value="${dist}/${lib.name}"/>
<mkdir dir="${bundle}" />
<mkdir dir="${bundle}/mode" />
<!-- make mode jar -->
<jar jarfile="${bundle}/mode/${lib.name}.jar" basedir="build" includes="${lib.path}/*.class ${preproc.path}/*.class"/>
<!-- make wrapper jar -->
<jar jarfile="${bundle}/mode/${wrap.name}.jar" basedir="build" includes="${wrap.path}/*"/> <!-- include *.py -->
<copy todir="${bundle}">
<fileset dir="resources/" />
</copy>
<copy todir="${bundle}/mode">
<fileset dir="lib/" />
</copy>
<replaceregexp file="${bundle}/mode.properties" flags="g"
match="@@version@@" replace="${build.number}" />
<replaceregexp file="${bundle}/mode.properties" flags="g"
match="@@pretty-version@@" replace="${release}" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - -
INSTALL
- - - - - - - - - - - - - - - - - - - - - - - -->
<target name="install" depends="package" >
<delete dir="${processing.sketchfolder}/modes/${lib.name}" />
<copy todir="${processing.sketchfolder}/modes/">
<fileset dir="${dist}" />
</copy>
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - -
RELEASE
- - - - - - - - - - - - - - - - - - - - - - - -->
<target name="release" depends="package" >
<zip destfile="${releasedir}/${lib.name}.zip" basedir="${dist}/${lib.name}" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - -
CLEAN
- - - - - - - - - - - - - - - - - - - - - - - -->
<target name="clean" >
<delete dir="${build}" />
<delete dir="${dist}" />
</target>
<target name="cleangen" depends="clean" >
<delete dir="${gen}" />
</target>
</project>