Files
processing4/app/build.xml
2021-07-03 10:30:45 -04:00

189 lines
6.5 KiB
XML

<?xml version="1.0"?>
<project name="Processing PDE" default="build">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- VAqua library (not sure if we'll be including this in the final 4.0) -->
<property name="vaqua.version" value="9" />
<property name="vaqua.jar" value="VAqua${vaqua.version}.jar" />
<available file="lib/${vaqua.jar}" property="vaqua.present"/>
<property name="vaqua.url"
value="https://violetlib.org/release/vaqua/${vaqua.version}" />
<target name="download-vaqua" unless="vaqua.present">
<get dest="lib" usetimestamp="true">
<url url="${vaqua.url}/${vaqua.jar}" />
</get>
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Current version of Ant that works with Processing -->
<!-- (Can't use ant.version because that conflicts w/ the built-in variable) -->
<!-- <property name="ant.version" value="1.8.2" /> -->
<!-- <echoproperties /> -->
<property name="ant.version.num" value="1.10.10" />
<!-- the .zip file to be downloaded -->
<property name="ant.zip" value="apache-ant-${ant.version.num}-bin.zip" />
<!-- TODO implement a fallback URL that points to a location
on download.processing.org so it's available forever. -->
<property name="ant.url"
value="https://archive.apache.org/dist/ant/binaries/${ant.zip}" />
<fileset id="ant.files" dir="lib">
<include name="ant.jar" />
<include name="ant-launcher.jar" />
</fileset>
<condition property="ant.present">
<resourcecount refid="ant.files" when="eq" count="2" />
</condition>
<!-- ok to ignore failed downloads if we at least have a version that's local -->
<condition property="ant.ignorable" value="false" else="true">
<isset property="ant.present" />
</condition>
<target name="download-ant" unless="ant.present">
<get src="${ant.url}" dest="${ant.zip}"
ignoreerrors="${ant.ignorable}"
usetimestamp="true" />
<property name="ant.zip.prefix" value="apache-ant-${ant.version.num}/lib" />
<unzip src="${ant.zip}" dest="lib">
<patternset>
<!-- unzip a single jar from the ant.zip.prefix subdirectory in the .zip -->
<include name="${ant.zip.prefix}/ant.jar" />
<include name="${ant.zip.prefix}/ant-launcher.jar" />
</patternset>
<mapper>
<!-- remove the ant.zip.prefix from the path when saving the .jar -->
<globmapper from="${ant.zip.prefix}/*" to="*" />
</mapper>
</unzip>
<delete file="${ant.zip}" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Current version of JNA that works with Processing -->
<property name="jna.version" value="5.8.0" />
<!-- the .zip file to be downloaded -->
<property name="jna.zip" value="${jna.version}.zip" />
<!-- the .jar file that's the actual dependency -->
<!-- <property name="batik.jar" value="batik-all-${batik.version}.jar" /> -->
<!-- TODO implement a fallback URL that points to a location
on download.processing.org so it's available forever. -->
<property name="jna.url"
value="https://github.com/java-native-access/jna/archive/${jna.zip}" />
<fileset id="jna.files" dir="lib">
<include name="jna.jar" />
<include name="jna-platform.jar" />
</fileset>
<condition property="jna.present">
<resourcecount refid="jna.files" when="eq" count="2" />
</condition>
<!-- <available file="lib/jna.jar" property="jna.present" /> -->
<!-- ok to ignore failed downloads if we at least have a version that's local -->
<condition property="jna.ignorable" value="false" else="true">
<isset property="jna.present" />
</condition>
<target name="download-jna" unless="jna.present">
<get src="${jna.url}" dest="."
ignoreerrors="${jna.ignorable}"
usetimestamp="true" />
<property name="jna.zip.prefix" value="jna-${jna.version}/dist" />
<unzip src="${jna.zip}" dest="lib">
<patternset>
<!-- unzip a single jar from the jna.zip.prefix subdirectory in the .zip -->
<include name="${jna.zip.prefix}/jna.jar" />
<include name="${jna.zip.prefix}/jna-platform.jar" />
</patternset>
<mapper>
<!-- remove the jna.zip.prefix from the path when saving the .jar -->
<globmapper from="${jna.zip.prefix}/*" to="*" />
</mapper>
</unzip>
<delete file="${jna.zip}" />
</target>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<target name="compile" description="Compile sources"
depends="download-vaqua, download-ant, download-jna">
<condition property="core-built">
<available file="../core/library/core.jar" />
</condition>
<fail unless="core-built" message="Please build the core library first and make sure it is located at ../core/library/core.jar" />
<mkdir dir="bin" />
<!-- copy languages files -->
<copy todir="bin">
<fileset dir="src">
<include name="processing/app/languages/*.properties" />
</fileset>
</copy>
<!-- in some cases, pde.jar was not getting built
https://github.com/processing/processing/issues/1792 -->
<delete file="pde.jar" />
<!-- env used to set classpath below -->
<property environment="env" />
<javac source="11"
target="11"
destdir="bin"
excludes="**/tools/format/**"
encoding="UTF-8"
includeAntRuntime="false"
classpath="../core/library/core.jar;
../core/apple.jar;
lib/ant.jar;
lib/ant-launcher.jar;
lib/jna.jar;
lib/jna-platform.jar;
lib/VAqua9.jar"
debug="on"
nowarn="true">
<compilerarg value="-Xlint:deprecation" />
<src path="src" />
</javac>
</target>
<target name="build" depends="compile" description="Build PDE">
<jar basedir="bin" destfile="pde.jar" />
</target>
<target name="update" description="Update the downloaded libraries">
<delete>
<fileset refid="jna.files" />
<fileset refid="ant.files" />
<fileset dir="lib">
<include name="VAqua*.jar" />
</fileset>
</delete>
<antcall target="download-ant" />
<antcall target="download-jna" />
<antcall target="download-vaqua" />
</target>
<target name="clean" description="Clean the build directories">
<delete dir="bin" />
<delete file="pde.jar" />
</target>
</project>