mirror of
https://github.com/processing/processing4.git
synced 2026-01-30 11:51:54 +01:00
Moves to Java11 and OpenJDK via AdoptOpenJDK within the processing4 train using a squash of sampottinger processing fork's java11 branch. **Primary required changes:** Some changes directly support OpenJFX / OpenJDK 11: - Response to image loading changes caused by [JEP 320](https://openjdk.java.net/jeps/320) - Use of jmodules as necessitated by [JEP 261](https://openjdk.java.net/jeps/261) - Reponse to largely changed file paths caused by [JEP 220](https://openjdk.java.net/jeps/220). - Modifications in build system related to AdoptOpenJDK and Java 11 which have a different naming structure for downloads. - Allowing use of non-Oracle Java within internal Processing checks. **Secondary required changes:** There were some secondary required changes that impacted the usability of Processing after having moved to OpenJFX / OpenJDK 11: - Removal of com.apple.eawt calls related to [JEP 272](http://openjdk.java.net/jeps/272) - Response to HiDPI support on Windows and Linux in [JEP 263](https://openjdk.java.net/jeps/263) - Removal of `java.ext.dirs`. Would be forced by [JEP 220](http://openjdk.java.net/jeps/220). - Due to bugs on Windows, updated the JNA jars. - Changes in downloader build tasks to support AdoptOpenJDK and OpenJFX. - Updated org.eclipse.* / equinox jars. - Some optimization around size of distribution. - Update of AppBundler. - Some changes in formulation of classpath and modifications in PreprocessingService given [JEP 261](https://openjdk.java.net/jeps/261). **Incidental changes:** This was (ahem) a bit of a larger PR with the above modifications. So, I wanted to introduce automated tests when possible and convenient along with a few changes for platform sustainability in order to support development: - Addition of cross-building capability (!) made possible by AdoptOpenJDK. - Addition of mockito for testing. - Upgrade of junit. - Addition of ant-contrib. - Standardized nomenclature around JRE / JDK in `build/build.xml` - Deduplication of code in `jre/build.xml`. - Addition of JavaDoc in a few places. - Some refactoring of PImage / Shape to support increased testing and readability in image manipulation code.
174 lines
6.4 KiB
XML
174 lines
6.4 KiB
XML
<?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.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 grammar">
|
|
<antlr target="${grammars}/java15.g" outputdirectory="${generated}">
|
|
<classpath path="${antlr_jar}" />
|
|
</antlr>
|
|
<antlr target="${grammars}/pde.g"
|
|
outputdirectory="${generated}"
|
|
glib="${grammars}/java15.g">
|
|
<classpath path="${antlr_jar}" />
|
|
</antlr>
|
|
|
|
<!-- clean up the warning mess caused by this old antlr version -->
|
|
<!--<property name="uuc" value="@SuppressWarnings({ "unused", "unchecked", "cast" })${line.separator}" />-->
|
|
<property name="uucr" value="@SuppressWarnings({ "unused", "unchecked", "cast", "rawtypes" })${line.separator}" />
|
|
<property name="uc" value="@SuppressWarnings({ "unused", "cast" })${line.separator}" />
|
|
|
|
<!-- need to match against the previous line so that we don't re-add -->
|
|
<replaceregexp file="generated/processing/mode/java/preproc/JavaLexer.java"
|
|
match="(\n\n)(public class JavaLexer .*)"
|
|
replace="\1${uucr}\2">
|
|
</replaceregexp>
|
|
|
|
<replaceregexp file="generated/processing/mode/java/preproc/JavaRecognizer.java"
|
|
match="(\*/\n)(public class JavaRecognizer .*)"
|
|
replace="\1${uc}\2">
|
|
</replaceregexp>
|
|
|
|
<replaceregexp file="generated/processing/mode/java/preproc/PdeLexer.java"
|
|
match="(\n\n)(public class PdeLexer .*)"
|
|
replace="\1${uucr}\2">
|
|
</replaceregexp>
|
|
|
|
<replaceregexp file="generated/processing/mode/java/preproc/PdeRecognizer.java"
|
|
match="(\n\n)(public class PdeRecognizer .*)"
|
|
replace="\1${uc}\2">
|
|
</replaceregexp>
|
|
<!-- end of workaround for old antlr -->
|
|
</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.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/jdi.jar" />
|
|
<pathelement location="mode/jdimodel.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.osgi.jar" />
|
|
<pathelement location="mode/org.eclipse.text.jar" />
|
|
</path>
|
|
|
|
<path id="classpath.test">
|
|
<pathelement location="../core/library-test/junit-4.8.1.jar" />
|
|
<pathelement location="../core/library-test/mockito-all-1.10.19.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="1.8"
|
|
target="1.8"
|
|
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" destdir="bin-test" classpath="classpath.test" />
|
|
</target>
|
|
|
|
<target name="test" depends="test-compile">
|
|
<junit haltonfailure="true">
|
|
<classpath refid="classpath.test" />
|
|
<formatter type="brief" usefile="false" />
|
|
<batchtest>
|
|
<fileset dir="test">
|
|
<include name="**/*Test.java" />
|
|
</fileset>
|
|
</batchtest>
|
|
</junit>
|
|
</target>
|
|
|
|
<target name="compile" depends="test" description="Compile sources">
|
|
<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>
|