blob: 7b73bf2df17a3a589eb77f8b4a645444b5b544ce [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="ImageIO Build" default="build" basedir=".">
<description>Build for ImageIO component</description>
<property name="hy.component" value="classlib" />
<property name="hy.module" value="imageio" />
<property name="hy.target" location="${basedir}/../../target" />
<import file="${hy.target}/hdk/build/ant/properties.xml" />
<import file="${hy.hdk}/build/ant/depends.xml" />
<property file="../../make/depends.properties" />
<target name="build" depends="check-depends,-build-no-check"/>
<target name="-build-no-check"
depends="-build-jar,-build-native,-test-jar" />
<target name="clean" depends="-clean-java,-clean-native,-clean-test" />
<target name="check-depends"
depends="-check-win-depends,-check-unix-depends" />
<target name="-check-win-depends" if="is.windows"
depends="-really-check-win-depends,-ext-props,-ext-jpeg,-ext-png" />
<target name="-really-check-win-depends" if="is.windows">
<check-one-file src="${jpeg.url}" dest="${jpeg.tar}" />
<check-one-file src="${png.url}" dest="${png.tar}" />
</target>
<target name="-check-unix-depends" if="is.unix">
<property name="jpeg.msg"
value="libjpeg development package not installed
${line.separator}For Debian/Ubuntu try: apt-get install libjpeg62-dev
${line.separator}For Fedora try: yum install libjpeg-devel" />
<check-os-file src="${jpeg.home}/include/jconfig.h"
message="${jpeg.msg}" />
<property name="png.msg"
value="libpng development package not installed
${line.separator}For Debian/Ubuntu try: apt-get install libpng12-dev
${line.separator}For Fedora try: yum install libpng-devel" />
<check-os-file src="${png.home}/include/png.h"
message="${png.msg}" />
</target>
<target name="-ext-props" if="is.windows">
<uptodate property="jpeg.uptodate"
srcfile="${jpeg.tar}"
targetfile="${jpeg.testfile}" />
<uptodate property="png.uptodate"
srcfile="${png.tar}"
targetfile="${png.testfile}" />
</target>
<target name="-ext-jpeg" if="is.windows" unless="jpeg.uptodate">
<echo>Extracting jpeg dependencies</echo>
<untar src="${jpeg.tar}" dest="${depends.lib.dir}" compression="gzip" />
<touch file="${jpeg.testfile}" />
</target>
<target name="-ext-png" if="is.windows" unless="png.uptodate">
<echo>Extracting png dependencies</echo>
<untar src="${png.tar}" dest="${depends.lib.dir}" compression="gzip" />
<touch file="${png.testfile}" />
</target>
<target name="fetch-depends" if="is.windows">
<mkdir dir="${jpeg.dir}" />
<download-one-file src="${jpeg.url}"
dest="${jpeg.tar}"
md5="${jpeg.md5}" />
<mkdir dir="${png.dir}" />
<download-one-file src="${png.url}"
dest="${png.tar}"
md5="${png.md5}" />
</target>
<target name="test" depends="-test-module">
<fail message="Some tests failed">
<condition>
<or>
<isset property="test.failures" />
<isset property="test.errors" />
</or>
</condition>
</fail>
</target>
<!-- internal target for local and global test run sequence -->
<target name="-test-module" depends="build,-run-tests" />
<target name="-clean-java" unless="skip.java.build"
depends="-class-patternset">
<delete file="${hy.jdk}/jre/lib/boot/${hy.module}.jar" />
<delete file="${hy.jdk}/jre/lib/boot/${hy.module}-src.jar" />
<delete failonerror="false">
<fileset refid="classes" />
</delete>
<delete-patternset module="${hy.module}" />
</target>
<target name="-clean-native" unless="skip.native.build">
<make dir="src/main/native/jpegencoder/${hy.os.family}" target="clean"/>
<make dir="src/main/native/pngencoder/${hy.os.family}" target="clean" />
</target>
<target name="-clean-test" unless="skip.test.build">
<delete dir="${tests.hdk.dir}" failonerror="false" />
<delete failonerror="false" dir="${hy.build.mod}/test"/>
</target>
<target name="-compile-java" unless="skip.java.build">
<compile-classes description="${hy.module} classes">
<javac-elements>
<src path="src/main/java" />
</javac-elements>
</compile-classes>
</target>
<target name="-build-native" unless="skip.native.build">
<pathconvert targetos="windows" property="jpeg.dir.win">
<path location="${jpeg.dir}" />
</pathconvert>
<make dir="src/main/native/jpegencoder/${hy.os.family}">
<make-elements>
<env key="HY_JPEG_DIR" value="${jpeg.dir.win}" />
</make-elements>
</make>
<make dir="src/main/native/pngencoder/${hy.os.family}">
<make-elements>
<env key="HY_PNG_DIR" value="${png.dir}" />
</make-elements>
</make>
</target>
<target name="findbugs" depends="-build-jar">
<run-findBugs
jarFile="${hy.jdk}/jre/lib/boot/${hy.module}.jar"
excludeFilter="make/findbugs-exclude-filter.xml"
outputFile="${findBugs.report}/${hy.module}.xml"/>
</target>
<target name="-build-jar" unless="skip.java.build"
depends="-svn-info,-compile-java,-class-patternset">
<hy.jar.bin destfile="${hy.jdk}/jre/lib/boot/${hy.module}.jar"
manifest="META-INF/MANIFEST.MF">
<fileset refid="classes" />
<fileset refid="resources" />
</hy.jar.bin>
<hy.jar.src destfile="${hy.jdk}/jre/lib/boot/${hy.module}-src.jar">
<fileset dir="src/main/java" />
</hy.jar.src>
</target>
<target name="-test-jar" unless="skip.test.build"
depends="-svn-info,-compile-tests">
<mkdir dir="${tests.hdk.dir}" />
<copy file="make/run-test.xml" tofile="${tests.hdk.dir}/build.xml" />
<hy.jar.bin destfile="${tests.hdk.dir}/${hy.module}_tests.jar">
<metainf dir="src/test/java/META-INF" />
<fileset dir="${hy.build.mod}/test/api" />
</hy.jar.bin>
<mkdir dir="${tests.excludes.hdk.dir}"/>
<copy todir="${tests.excludes.hdk.dir}">
<fileset dir="make" includes="exclude*"/>
<filterchain>
<tokenfilter>
<replaceregex pattern="\.java" replace="\.class" flags="g"/>
</tokenfilter>
</filterchain>
</copy>
<copy todir="${tests.resources.hdk.dir}">
<fileset dir="src/test/resources" />
</copy>
</target>
<target name="-compile-tests" unless="skip.test.build">
<compile-tests description="${hy.module} tests">
<javac-elements>
<src>
<pathelement location="src/test/java" />
</src>
</javac-elements>
</compile-tests>
</target>
<target name="-run-tests" depends="-test-jar">
<ant dir="${tests.hdk.dir}" target="test-module" />
</target>
<target name="-class-patternset" unless="skip.java.build">
<make-patternset module="${hy.module}" />
</target>
</project>