forked from processing/processing4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
196 lines (164 loc) · 7.07 KB
/
build.xml
File metadata and controls
196 lines (164 loc) · 7.07 KB
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="Java Mode" default="build">
<property name="generated"
value="${basedir}/generated/processing/mode/java/preproc" />
<mkdir dir="${generated}" />
<property name="grammars"
value="${basedir}/src/processing/mode/java/preproc" />
<property name="antlr_jar"
value="${basedir}/mode/antlr-4.7.2-complete.jar" />
<property name="mode_jar"
value="${basedir}/mode/JavaMode.jar" />
<classloader taskname="antlr">
<classpath path="${antlr_jar}" />
</classloader>
<target name="clean" description="Clean the build directories">
<delete dir="bin" />
<delete dir="bin-test" />
<delete file="${mode_jar}" />
<delete>
<fileset dir="${generated}">
<include name="*.java" />
<include name="*.tokens" />
<include name="*.txt" />
<include name="*.g" />
<include name="*.smap" />
<include name="*.properties" />
</fileset>
</delete>
</target>
<target name="preproc" description="Compile ANTLR 4 grammar">
<java classname="org.antlr.v4.Tool"
failonerror="true">
<classpath path="${antlr_jar}" />
<arg value="-o" />
<arg value="${generated}" />
<arg value="-package" />
<arg value="processing.mode.java.preproc" />
<arg value="${grammars}/Processing.g4" />
</java>
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<property name="lsp4j.version" value="0.19.0" />
<fileset id="lsp4j.files" dir="mode">
<include name="org.eclipse.lsp4j.jar" />
<include name="org.eclipse.lsp4j.jsonrpc.jar" />
<include name="gson.jar" />
</fileset>
<condition property="lsp4j.present">
<resourcecount refid="lsp4j.files" when="eq" count="3" />
</condition>
<!-- ok to ignore failed downloads if we at least have a version that's local -->
<condition property="lsp4j.ignorable" value="false" else="true">
<isset property="lsp4j.present" />
</condition>
<target name="download-lsp4j" unless="lsp4j.present">
<!-- TODO implement a fallback URL that points to a location
on download.processing.org so it's available forever. -->
<property name="lsp4j.prefix"
value="https://repo1.maven.org/maven2/org/eclipse/lsp4j" />
<get src="${lsp4j.prefix}/org.eclipse.lsp4j/${lsp4j.version}/org.eclipse.lsp4j-${lsp4j.version}.jar"
dest="mode/org.eclipse.lsp4j.jar"
ignoreerrors="${lsp4j.ignorable}"
usetimestamp="true" />
<get src="${lsp4j.prefix}/org.eclipse.lsp4j.jsonrpc/${lsp4j.version}/org.eclipse.lsp4j.jsonrpc-${lsp4j.version}.jar"
dest="mode/org.eclipse.lsp4j.jsonrpc.jar"
ignoreerrors="${lsp4j.ignorable}"
usetimestamp="true" />
<get src="https://repo1.maven.org/maven2/com/google/code/gson/gson/2.9.1/gson-2.9.1.jar"
dest="mode/gson.jar"
ignoreerrors="${lsp4j.ignorable}"
usetimestamp="true" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<path id="classpath.base">
<pathelement location="../core/library/core.jar" />
<pathelement location="../app/pde.jar" />
<pathelement location="../app/lib/ant.jar" />
<pathelement location="../app/lib/ant-launcher.jar" />
<pathelement location="../app/lib/apple.jar" />
<pathelement location="../app/lib/jna.jar" />
<pathelement location="../app/lib/jna-platform.jar" />
<pathelement location="mode/antlr-4.7.2-complete.jar" />
<pathelement location="mode/classpath-explorer-1.0.jar" />
<pathelement location="mode/jsoup-1.7.1.jar" />
<pathelement location="mode/org.netbeans.swing.outline.jar" />
<pathelement location="mode/com.ibm.icu.jar" />
<pathelement location="mode/org.eclipse.core.contenttype.jar" />
<pathelement location="mode/org.eclipse.core.jobs.jar" />
<pathelement location="mode/org.eclipse.core.resources.jar" />
<pathelement location="mode/org.eclipse.core.runtime.jar" />
<pathelement location="mode/org.eclipse.equinox.common.jar" />
<pathelement location="mode/org.eclipse.equinox.preferences.jar" />
<pathelement location="mode/org.eclipse.jdt.compiler.apt.jar" />
<pathelement location="mode/org.eclipse.jdt.core.jar" />
<pathelement location="mode/org.eclipse.lsp4j.jar" />
<pathelement location="mode/org.eclipse.lsp4j.jsonrpc.jar" />
<pathelement location="mode/org.eclipse.osgi.jar" />
<pathelement location="mode/org.eclipse.text.jar" />
</path>
<path id="classpath.test">
<pathelement location="../core/library-test/junit-4.13.2.jar" />
<pathelement location="../core/library-test/hamcrest-core-1.3.jar" />
<pathelement location="../core/library-test/byte-buddy-1.11.19.jar" />
<pathelement location="../core/library-test/objenesis-3.2.jar" />
<pathelement location="../core/library-test/mockito-core-4.0.0.jar" />
<pathelement location = "bin-test" />
<path refid="classpath.base" />
</path>
<macrodef name="compilecommon">
<attribute name="destdir"/>
<attribute name="srcdir"/>
<attribute name="classpath"/>
<sequential>
<condition property="core-built">
<available file="../core/library/core.jar" />
</condition>
<fail unless="core-built" message="Please first build the core library and make sure it is located at ../core/library/core.jar" />
<condition property="app-built">
<available file="../app/pde.jar" />
</condition>
<fail unless="app-built" message="Please build app first and make sure it is located at ../app/pde.jar" />
<mkdir dir="@{destdir}" />
<!-- in some cases, pde.jar was not getting built
https://github.com/processing/processing/issues/1792 -->
<delete file="${mode_jar}" />
<!-- env used to set classpath below -->
<property environment="env" />
<javac source="17"
target="17"
destdir="@{destdir}"
excludes="**/tools/format/**"
encoding="UTF-8"
includeAntRuntime="false"
debug="on"
nowarn="true"
compiler="modern">
<src path="@{srcdir}" />
<src path="generated" />
<classpath refid="@{classpath}"/>
</javac>
</sequential>
</macrodef>
<target name="test-compile" depends="preproc">
<compilecommon srcdir="src; test/processing" destdir="bin-test" classpath="classpath.test" />
</target>
<target name="test" depends="build, test-compile">
<junit haltonfailure="true">
<classpath refid="classpath.test" />
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="test">
<include name="**/*Test.java" />
<include name="**/*Tests.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="compile" description="Compile sources" depends="preproc,download-lsp4j">
<compilecommon srcdir="src" destdir="bin" classpath="classpath.base" />
</target>
<target name="build" depends="compile" description="Build PDE">
<jar basedir="bin" destfile="${mode_jar}" />
</target>
</project>