Skip to content

Commit

Permalink
ImageIO task (a replacement for Image task)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gintas Grigelionis committed Aug 12, 2018
1 parent 86bba86 commit ed567da
Show file tree
Hide file tree
Showing 28 changed files with 3,895 additions and 31 deletions.
17 changes: 16 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,21 @@
<filename name="${optional.package}/ANTLR*"/>
</selector>

<selector id="needs.imageio">
<or>
<filename name="${optional.package}/image/ImageIO*"/>
<filename name="${optional.type.package}/imageio/"/>
</or>
</selector>

<selector id="needs.jmf">
<filename name="${optional.package}/sound/"/>
</selector>

<selector id="needs.jai">
<or>
<filename name="${optional.package}/image/"/>
<filename name="${optional.package}/image/Image.*"/>
<filename name="${optional.package}/image/ImageTest.*"/>
<filename name="${optional.type.package}/image/"/>
</or>
</selector>
Expand Down Expand Up @@ -329,6 +337,7 @@
<selector refid="needs.apache-xalan2"/>
<selector refid="needs.commons-logging"/>
<selector refid="needs.commons-net"/>
<selector refid="needs.imageio"/>
<selector refid="needs.jai"/>
<selector refid="needs.javamail"/>
<selector refid="needs.jdepend"/>
Expand Down Expand Up @@ -444,6 +453,9 @@
<available property="apache.oro.present"
classname="org.apache.oro.text.regex.Perl5Matcher"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="imageio.present"
classname="javax.imageio.ImageIO"
classpathref="classpath"/>
<available property="jmf.present"
classname="javax.sound.sampled.Clip"
classpathref="classpath"/>
Expand Down Expand Up @@ -602,6 +614,7 @@
<selector refid="needs.netrexx" unless="netrexx.present"/>
<selector refid="needs.commons-net" unless="commons.net.present"/>
<selector refid="needs.antlr" unless="antlr.present"/>
<selector refid="needs.imageio" unless="imageio.present"/>
<selector refid="needs.jmf" unless="jmf.present"/>
<selector refid="needs.jai" unless="jai.present"/>
<selector refid="needs.jdepend" unless="jdepend.present"/>
Expand Down Expand Up @@ -770,6 +783,7 @@
<optional-jar dep="netrexx"/>
<optional-jar dep="commons-net"/>
<optional-jar dep="antlr"/>
<optional-jar dep="imageio"/>
<optional-jar dep="jmf"/>
<optional-jar dep="jai"/>
<optional-jar dep="swing"/>
Expand Down Expand Up @@ -864,6 +878,7 @@
<optional-src-jar dep="netrexx"/>
<optional-src-jar dep="commons-net"/>
<optional-src-jar dep="antlr"/>
<optional-src-jar dep="imageio"/>
<optional-src-jar dep="jmf"/>
<optional-src-jar dep="jai"/>
<optional-src-jar dep="swing"/>
Expand Down
501 changes: 501 additions & 0 deletions manual/Tasks/image.graphml

Large diffs are not rendered by default.

372 changes: 356 additions & 16 deletions manual/Tasks/image.html

Large diffs are not rendered by default.

498 changes: 498 additions & 0 deletions manual/Tasks/imageio.graphml

Large diffs are not rendered by default.

693 changes: 693 additions & 0 deletions manual/Tasks/imageio.html

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions manual/install.html
Original file line number Diff line number Diff line change
Expand Up @@ -898,10 +898,8 @@ <h2 id="librarydependencies">Library Dependencies</h2>
</tr>
<tr>
<td>activation.jar<br/>
(included in Java 6 to Java 10 but
the <code>java.activation</code> module is deprecated and marked
for removal in Java 9 and needs to be enabled explicitly on Java
10)</td>
(included in Java 6 to Java 10 but the <code>java.activation</code> module is deprecated and marked for removal in
Java 9 and needs to be enabled explicitly on Java 10)</td>
<td><a href="Tasks/mail.html">mail</a> task with MIME encoding,
and <em><u>deprecated</u></em> <a href="Tasks/mimemail.html">mimemail</a> task</td>
<td><a href="https://github.com/javaee/activation"
Expand Down Expand Up @@ -930,6 +928,12 @@ <h2 id="librarydependencies">Library Dependencies</h2>
<td><a href="https://download.java.net/media/jai/builds/release/1_1_3/INSTALL.html"
target="_top">https://download.java.net/media/jai/builds/release/1_1_3/INSTALL.html</a></td>
</tr>
<tr>
<td>jai-imageio-core.jar</td>
<td><a href="Tasks/imageio.html">imageio</a> task for TIFF support on Java 8, as well as PCX, PNM, RAW support</td>
<td><a href="https://github.com/jai-imageio/jai-imageio-core/releases"
target="_top">https://github.com/jai-imageio/jai-imageio-core/releases</a></td>
</tr>
<tr>
<td>XZ&mdash;XZ for Java <strong>1.6 or later</strong></td>
<td><a href="Tasks/pack.html">xz</a> and <a href="Tasks/unpack.html">unxz</a>
Expand Down
3 changes: 2 additions & 1 deletion manual/tasklist.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ <h3>Tasks</h3>
<li><a href="Tasks/unpack.html">GUnzip</a></li>
<li><a href="Tasks/pack.html">GZip</a></li>
<li><a href="Tasks/hostinfo.html">Hostinfo</a></li>
<li><a href="Tasks/image.html">Image</a></li>
<li><a href="Tasks/image.html"><em>Image</em></a></li>
<li><a href="Tasks/imageio.html">ImageIO</a></li>
<li><a href="Tasks/import.html">Import</a></li>
<li><a href="Tasks/include.html">Include</a></li>
<li><a href="Tasks/input.html">Input</a></li>
Expand Down
6 changes: 6 additions & 0 deletions release/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@
<artifact name="ant-commons-net" type="jar.asc" ext="jar.asc"/>
<artifact name="ant-commons-net" type="source" ext="jar" e:classifier="sources"/>
<artifact name="ant-commons-net" type="source.asc" ext="jar.asc" e:classifier="sources"/>
<artifact name="ant-imageio" type="pom" ext="pom"/>
<artifact name="ant-imageio" type="pom.asc" ext="pom.asc"/>
<artifact name="ant-imageio" type="jar" ext="jar"/>
<artifact name="ant-imageio" type="jar.asc" ext="jar.asc"/>
<artifact name="ant-imageio" type="source" ext="jar" e:classifier="sources"/>
<artifact name="ant-imageio" type="source.asc" ext="jar.asc" e:classifier="sources"/>
<artifact name="ant-jai" type="pom" ext="pom"/>
<artifact name="ant-jai" type="pom.asc" ext="pom.asc"/>
<artifact name="ant-jai" type="jar" ext="jar"/>
Expand Down
66 changes: 66 additions & 0 deletions src/etc/poms/ant-imageio/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?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.
-->
<!--
This POM has been created manually by the Ant Development Team.
Please contact us if you are not satisfied with the data contained in this POM.
URL : http://ant.apache.org
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.apache.ant</groupId>
<artifactId>ant-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.10.6-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<url>http://ant.apache.org/</url>
<groupId>org.apache.ant</groupId>
<artifactId>ant-imageio</artifactId>
<version>1.10.6-SNAPSHOT</version>
<name>Apache Ant + ImageIO</name>
<description>imageio task and corresponding types.</description>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.6-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<includes>
<include>org/apache/tools/ant/taskdefs/optional/image/ImageIOTask.java</include>
<include>org/apache/tools/ant/types/optional/imageio/*</include>
</includes>
</configuration>
</plugin>
</plugins>
<sourceDirectory>../../../../src/main</sourceDirectory>
<testSourceDirectory>../../../../src/testcases</testSourceDirectory>
<outputDirectory>../../../../target/${project.artifactId}/classes</outputDirectory>
<testOutputDirectory>../../../../target/${project.artifactId}/testcases</testOutputDirectory>
<directory>../../../../target/${project.artifactId}</directory>
</build>
</project>
2 changes: 1 addition & 1 deletion src/etc/poms/ant-jai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<includes>
<include>org/apache/tools/ant/taskdefs/optional/image/*</include>
<include>org/apache/tools/ant/taskdefs/optional/image/Image.java</include>
<include>org/apache/tools/ant/types/optional/image/*</include>
</includes>
</configuration>
Expand Down
97 changes: 97 additions & 0 deletions src/etc/testcases/taskdefs/optional/image/imageio.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0"?>
<!--
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="image-test" default="main" basedir=".">

<import file="../../../buildfiletest-base.xml"/>

<target name="setUp">
<mkdir dir="${output}"/>
<property name="src.dir" location="${basedir}/src"/>
</target>

<target name="main" depends="testSimpleScale"/>

<!-- this should produce a single file in the dest dir -->
<target name="testSimpleScale" depends="setUp">
<imageio includes="*.jpg" srcdir="${src.dir}" destdir="${output}"
overwrite="no" failonerror="no">
<scale width="300" proportions="width"/>
</imageio>
</target>

<!-- this should put some text in the log -->
<target name="testEchoToLog" depends="setUp">
<imageio includes="*.jpg" srcdir="${src.dir}" destdir="${output}"
overwrite="no" failonerror="no">
<scale width="300" proportions="width"/>
</imageio>
</target>

<!-- this should produce a single file in the dest dir -->
<target name="testFailOnError" depends="setUp">
<imageio includes="*.jpg" srcdir="${src.dir}" destdir="${output}"
overwrite="no" failonerror="yes">
<scale width="300" proportions="width"/>
</imageio>
</target>

<!-- this should produce a single file in the dest dir, overwriting any existing file -->
<target name="testOverwriteTrue" depends="setUp">
<imageio includes="*.jpg" srcdir="${src.dir}" destdir="${output}"
overwrite="yes" failonerror="no">
<scale width="300" proportions="width"/>
</imageio>
</target>

<!-- this should produce a single file in the dest dir, overwriting any existing file -->
<target name="testDrawOverwriteTrue" depends="setUp">
<imageio includes="*.jpg" srcdir="${src.dir}" destdir="${output}"
overwrite="yes" failonerror="no">
<scale width="300" proportions="width"/>
<draw xloc="10" yloc="10">
<rectangle height="50" width="50" strokewidth="2"/>
<text string="Test"/>
</draw>
</imageio>
</target>

<!-- this should not overwrite the existing file -->
<target name="testOverwriteFalse" depends="setUp">
<imageio includes="*.jpg" srcdir="${src.dir}" destdir="${output}"
overwrite="no" failonerror="no">
<scale width="300" proportions="width"/>
</imageio>
</target>

<!-- this tests a special case of rotation -->
<target name="testFlip" depends="setUp">
<imageio includes="*.jpg" srcdir="${src.dir}" destdir="${output}"
overwrite="no" failonerror="no">
<rotate angle="-180"/>
</imageio>
</target>

<target name="testSimpleScaleWithMapper" depends="setUp">
<imageio includes="*.jpg" srcdir="${src.dir}" destdir="${output}"
overwrite="no" failonerror="no">
<scale width="300" proportions="width"/>
<globmapper from="*" to="scaled-*"/>
</imageio>
</target>
</project>
2 changes: 1 addition & 1 deletion src/main/org/apache/tools/ant/taskdefs/defaults.properties
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ depend=org.apache.tools.ant.taskdefs.optional.depend.Depend
ejbjar=org.apache.tools.ant.taskdefs.optional.ejb.EjbJar
ftp=org.apache.tools.ant.taskdefs.optional.net.FTP
image=org.apache.tools.ant.taskdefs.optional.image.Image
imageio=org.apache.tools.ant.taskdefs.optional.image.ImageIOTask
iplanet-ejbc=org.apache.tools.ant.taskdefs.optional.ejb.IPlanetEjbcTask
jarlib-available=org.apache.tools.ant.taskdefs.optional.extension.JarLibAvailableTask
jarlib-display=org.apache.tools.ant.taskdefs.optional.extension.JarLibDisplayTask
Expand Down Expand Up @@ -197,7 +198,6 @@ vsslabel=org.apache.tools.ant.taskdefs.optional.vss.MSVSSLABEL
wljspc=org.apache.tools.ant.taskdefs.optional.jsp.WLJspc
xmlvalidate=org.apache.tools.ant.taskdefs.optional.XMLValidateTask


# deprecated ant tasks (kept for back compatibility)
copydir=org.apache.tools.ant.taskdefs.Copydir
copyfile=org.apache.tools.ant.taskdefs.Copyfile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ public void execute() throws BuildException {
}
// deal with the filesets
for (FileSet fs : filesets) {
writeCount += processDir(fs.getDir(getProject()),
fs.getDirectoryScanner(getProject()).getIncludedFiles(),
writeCount += processDir(fs.getDir(),
fs.getDirectoryScanner().getIncludedFiles(),
dest, mapper);
}

Expand Down
Loading

0 comments on commit ed567da

Please sign in to comment.