Compare commits

...

No commits in common. 'c9' and 'i8c-stream-201801' have entirely different histories.

@ -1 +1 @@
7760da2f3f5708ee0975caf634df16d5567fffe5 SOURCES/apache-ant-1.10.9-src.tar.bz2
ee74a29a62cf43d6ba5f6b125c3f0c65f14d6336 SOURCES/apache-ant-1.10.5-src.tar.bz2

2
.gitignore vendored

@ -1 +1 @@
SOURCES/apache-ant-1.10.9-src.tar.bz2
SOURCES/apache-ant-1.10.5-src.tar.bz2

@ -1,596 +0,0 @@
From e00b30674254bb4fc31ad2114eec808791b0d1dc Mon Sep 17 00:00:00 2001
From: Marián Konček <mkoncek@redhat.com>
Date: Wed, 16 Oct 2024 13:06:34 +0200
Subject: [PATCH] Disable SecurityManager for Java 18+
Upstream:
* https://github.com/apache/ant/commit/689b6ea90ee1fbad580a437137d80609c9336f12
* https://github.com/apache/ant/commit/e2c68c4931dee7141385af671c4358e511f7c4d7
* https://github.com/apache/ant/commit/2821ba0d14f932df056e89afa7217e09d5eab270
* https://github.com/apache/ant/commit/3c03f542411614a07bce7f5cc86ca4da0af39624
---
apache-ant-1.10.9/manual/Tasks/java.html | 10 +++-
apache-ant-1.10.9/manual/Tasks/junit.html | 8 +++
.../manual/Types/permissions.html | 12 ++++
.../main/org/apache/tools/ant/MagicNames.java | 11 ++++
.../tools/ant/taskdefs/ExecuteJava.java | 4 +-
.../org/apache/tools/ant/taskdefs/Java.java | 3 +-
.../ant/taskdefs/condition/JavaVersion.java | 40 +++++++++++--
.../apache/tools/ant/types/Permissions.java | 43 +++++++++++++-
.../tools/ant/util/SecurityManagerUtil.java | 57 +++++++++++++++++++
.../util/optional/NoExitSecurityManager.java | 2 +
.../apache/tools/ant/taskdefs/JavaTest.java | 19 ++++++-
.../taskdefs/optional/TraXLiaisonTest.java | 10 ++++
.../junit/XMLResultAggregatorTest.java | 7 +++
.../tools/ant/types/PermissionsTest.java | 12 +++-
14 files changed, 226 insertions(+), 12 deletions(-)
create mode 100644 apache-ant-1.10.9/src/main/org/apache/tools/ant/util/SecurityManagerUtil.java
diff --git a/manual/Tasks/java.html b/manual/Tasks/java.html
index 98c4bd3..58e5933 100644
--- a/manual/Tasks/java.html
+++ b/manual/Tasks/java.html
@@ -28,7 +28,9 @@
<h3>Description</h3>
<p>Executes a Java class within the running (Apache Ant) JVM or forks another JVM if specified.</p>
<p>If odd things go wrong when you run this task, set <var>fork</var>=<q>true</q> to use a new
-JVM.</p>
+JVM. It is necessary to set <var>fork</var>=<q>true</q>, if the class being launched by
+ this task or any libraries being used by that class, call APIs like
+ <code>java.lang.System.exit()</code> or <code>java.lang.Runtime.exit()</code>.</p>
<p><em>Since Ant 1.6.3</em>, you can interact with a forked JVM, as well as sending input to it via
the <var>input</var> and <var>inputstring</var> attributes.</p>
@@ -259,13 +261,17 @@ about <a href="exec.html#env">exec</a></p>
<p><em>Since Ant 1.6</em>.</p>
+<p><strong>Note</strong>:<br/> This element is no longer supported when running on Java 18 and
+ higher versions. See <a href="../Types/permissions.html">permissions</a> for details</p>
+
<p>Security permissions can be revoked and granted during the execution of the class via a
nested <code>permissions</code> element. For more information please
see <a href="../Types/permissions.html">permissions</a>.</p>
<p>When the permission <code>RuntimePermission exitVM</code> has not been granted (or has been
revoked) the <code>System.exit()</code> call will be intercepted and treated like indicated
in <var>failonerror</var>.</p>
-<p><strong>Note</strong>:<br/> If you do not specify permissions, a set of default permissions will
+<p><strong>Note</strong>:<br/> When running on Java runtime versions lesser than 18,
+ if you do not specify permissions, a set of default permissions will
be added to your Java invocation to make sure that the Ant run will continue or terminated as
indicated by <var>failonerror</var>. All permissions not granted per default will be checked by
whatever security manager was already in place. <code>exitVM</code> will be disallowed.</p>
diff --git a/manual/Tasks/junit.html b/manual/Tasks/junit.html
index f0e5c95..7a34680 100644
--- a/manual/Tasks/junit.html
+++ b/manual/Tasks/junit.html
@@ -33,6 +33,11 @@ no <code>JUnit4TestAdapter</code>.</p>
<p><strong>Note</strong>: This task depends on external libraries not included
in the Apache Ant distribution. See <a href="../install.html#librarydependencies">
Library Dependencies</a> for more information.</p>
+
+<p><strong>Note: </strong>It is necessary to set <var>fork</var>=<q>true</q>, if the test(s)
+ being launched by this task or any libraries being used by the test(s), call APIs like
+<code>java.lang.System.exit()</code> or <code>java.lang.Runtime.exit()</code>.</p>
+
<p><strong>Note</strong>: You must have <samp>junit.jar</samp> available. You can do one of:</p>
<ol>
<li>Put both <samp>junit.jar</samp> and <samp>ant-junit.jar</samp>
@@ -294,6 +299,9 @@ is <q>false</q> or the target JVM doesn't support it (i.e. Java 1.1).</p>
<p><em>Since Ant 1.6</em>.</p>
+<p><strong>Note</strong>:<br/> This element is no longer supported when running on Java 18 and
+ higher versions. See <a href="../Types/permissions.html">permissions</a> for details</p>
+
<p>Security permissions can be revoked and granted during the execution of the class via a
nested <code>permissions</code> element. For more information please
see <a href="../Types/permissions.html">permissions</a></p>
diff --git a/manual/Types/permissions.html b/manual/Types/permissions.html
index 6118ab5..b0c7e89 100644
--- a/manual/Types/permissions.html
+++ b/manual/Types/permissions.html
@@ -25,6 +25,18 @@
<body>
<h2 id="permissions">Permissions</h2>
+<p><b>Note:</b> <code>Permissions</code> requires the use of Java SecurityManager.
+ Java version 17 deprecated SecurityManager for removal and Java 18 and higher versions, by
+ default, disallow setting SecurityManager at runtime. <code>Permissions</code> is thus no longer
+ supported when used in Java 18 or higher versions. Using it in those Java runtime versions
+ will throw a <code>org.apache.tools.ant.BuildException</code>. Throwing of
+ <code>BuildException</code> can be relaxed by setting the
+ <code>ant.securitymanager.usage.warn</code> system or Ant property to <code>true</code>,
+ which will then cause a warning to be logged instead of the exception being thrown. Even when
+ <code>ant.securitymanager.usage.warn</code> is set to <code>true</code>,
+ SecurityManager usage will still be disabled and no security checks will be performed.
+ It is recommended to no longer use <code>&lt;permissions&gt;</code></p>
+
<p>Permissions represents a set of security permissions granted or revoked to a specific part
code executed in the JVM where Apache Ant is running in. The actual Permissions are specified
via a set of nested permission items either <code>&lt;grant&gt;</code>ed
diff --git a/src/main/org/apache/tools/ant/MagicNames.java b/src/main/org/apache/tools/ant/MagicNames.java
index 12fbcf7..4e3b873 100644
--- a/src/main/org/apache/tools/ant/MagicNames.java
+++ b/src/main/org/apache/tools/ant/MagicNames.java
@@ -359,5 +359,16 @@ public final class MagicNames {
*/
public static final String DISABLE_NASHORN_COMPAT = "ant.disable.graal.nashorn.compat";
+ /**
+ * When running on Java 18 or higher runtime, Ant will throw a {@link BuildException}
+ * if the {@linkplain org.apache.tools.ant.types.Permissions <permissions>} type is used.
+ * Set this property to {@code true} to disable throwing an exception and instead just log a
+ * warning message.
+ *
+ * Value: {@value}
+ * @since Ant 1.10.14
+ */
+ public static final String WARN_SECURITY_MANAGER_USAGE = "ant.securitymanager.usage.warn";
+
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
index 0964c91..cb0d125 100644
--- a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
+++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
@@ -211,9 +211,11 @@ public class ExecuteJava implements Runnable, TimeoutObserver {
@Override
public void run() {
final Object[] argument = {javaCommand.getArguments()};
+ boolean restoreSecMgr = false;
try {
if (perm != null) {
perm.setSecurityManager();
+ restoreSecMgr = true;
}
main.invoke(null, argument);
} catch (InvocationTargetException e) {
@@ -224,7 +226,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver {
} catch (Throwable t) {
caught = t;
} finally {
- if (perm != null) {
+ if (perm != null && restoreSecMgr) {
perm.restoreSecurityManager();
}
synchronized (this) {
diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java b/src/main/org/apache/tools/ant/taskdefs/Java.java
index 7acdad4..d92fbf6 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Java.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Java.java
@@ -38,6 +38,7 @@ import org.apache.tools.ant.types.PropertySet;
import org.apache.tools.ant.types.RedirectorElement;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.util.KeepAliveInputStream;
+import org.apache.tools.ant.util.SecurityManagerUtil;
import org.apache.tools.ant.util.StringUtils;
/**
@@ -202,7 +203,7 @@ public class Java extends Task {
log("bootclasspath ignored when same JVM is used.",
Project.MSG_WARN);
}
- if (perm == null) {
+ if (perm == null && SecurityManagerUtil.isSetSecurityManagerAllowed()) {
perm = new Permissions(true);
log("running " + this.getCommandLine().getClassname()
+ " with default permissions (exit forbidden)", Project.MSG_VERBOSE);
diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/JavaVersion.java b/src/main/org/apache/tools/ant/taskdefs/condition/JavaVersion.java
index e121c30..831d53b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/condition/JavaVersion.java
+++ b/src/main/org/apache/tools/ant/taskdefs/condition/JavaVersion.java
@@ -27,6 +27,7 @@ import org.apache.tools.ant.util.JavaEnvUtils;
*/
public class JavaVersion implements Condition {
+ private String atMost = null;
private String atLeast = null;
private String exactly = null;
@@ -44,16 +45,19 @@ public class JavaVersion implements Condition {
if (null != exactly) {
return actual.isEqual(new DeweyDecimal(exactly));
}
+ if (atMost != null) {
+ return actual.isLessThanOrEqual(new DeweyDecimal(atMost));
+ }
//default
return false;
}
private void validate() throws BuildException {
- if (atLeast != null && exactly != null) {
- throw new BuildException("Only one of atleast or exactly may be set.");
+ if (atLeast != null && exactly != null && atMost != null) {
+ throw new BuildException("Only one of atleast or atmost or exactly may be set.");
}
- if (null == atLeast && null == exactly) {
- throw new BuildException("One of atleast or exactly must be set.");
+ if (null == atLeast && null == exactly && atMost == null) {
+ throw new BuildException("One of atleast or atmost or exactly must be set.");
}
if (atLeast != null) {
try {
@@ -64,6 +68,14 @@ public class JavaVersion implements Condition {
"The 'atleast' attribute is not a Dewey Decimal eg 1.1.0 : "
+ atLeast);
}
+ } else if (atMost != null) {
+ try {
+ new DeweyDecimal(atMost); //NOSONAR
+ } catch (NumberFormatException e) {
+ throw new BuildException(
+ "The 'atmost' attribute is not a Dewey Decimal eg 1.1.0 : "
+ + atMost);
+ }
} else {
try {
// only created for side effect
@@ -94,6 +106,26 @@ public class JavaVersion implements Condition {
this.atLeast = atLeast;
}
+ /**
+ * Get the atmost attribute.
+ * @return the atmost attribute.
+ * @since Ant 1.10.10
+ */
+ public String getAtMost() {
+ return atMost;
+ }
+
+ /**
+ * Set the atmost attribute.
+ * This is of the form major.minor.point.
+ * For example 11.0.2
+ * @param atMost the version to set
+ * @since Ant 1.10.10
+ */
+ public void setAtMost(String atMost) {
+ this.atMost = atMost;
+ }
+
/**
* Get the exactly attribute.
* @return the exactly attribute.
diff --git a/src/main/org/apache/tools/ant/types/Permissions.java b/src/main/org/apache/tools/ant/types/Permissions.java
index 1d94388..eabd490 100644
--- a/src/main/org/apache/tools/ant/types/Permissions.java
+++ b/src/main/org/apache/tools/ant/types/Permissions.java
@@ -30,11 +30,15 @@ import java.util.StringTokenizer;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.ExitException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectComponent;
+import org.apache.tools.ant.util.SecurityManagerUtil;
/**
* This class implements a security manager meant for usage by tasks that run inside the
* Ant VM. An examples are the Java Task and JUnitTask.
*
+ * <p>
* The basic functionality is that nothing (except for a base set of permissions) is allowed, unless
* the permission is granted either explicitly or implicitly.
* If a permission is granted this can be overruled by explicitly revoking the permission.
@@ -42,9 +46,13 @@ import org.apache.tools.ant.ExitException;
* It is not permissible to add permissions (either granted or revoked) while the Security Manager
* is active (after calling setSecurityManager() but before calling restoreSecurityManager()).
*
+ * <p>
+ * Note: This class isn't supported in Java 18 and higher where {@link SecurityManager} has been
+ * deprecated for removal.
+ *
* @since Ant 1.6
*/
-public class Permissions {
+public class Permissions extends ProjectComponent {
private final List<Permission> grantedPermissions = new LinkedList<>();
private final List<Permission> revokedPermissions = new LinkedList<>();
@@ -95,9 +103,25 @@ public class Permissions {
* subject to these Permissions. Note that setting the SecurityManager too early may
* prevent your part from starting, as for instance changing classloaders may be prohibited.
* The classloader for the new situation is supposed to be present.
+ * <p>
+ * This method is no longer supported in Java 18 and higher versions and throws a
+ * {@link BuildException}. {@link org.apache.tools.ant.MagicNames#WARN_SECURITY_MANAGER_USAGE}
+ * property can be set to {@code true} to log a warning message instead of throwing the exception.
+ *
* @throws BuildException on error
*/
public synchronized void setSecurityManager() throws BuildException {
+ if (!SecurityManagerUtil.isSetSecurityManagerAllowed()) {
+ final String msg = "Use of <permissions> or " + Permissions.class.getName()
+ + " is disallowed in current Java runtime version";
+ if (SecurityManagerUtil.warnOnSecurityManagerUsage(getProject())) {
+ // just log a warning
+ log("Security checks are disabled - " + msg, Project.MSG_WARN);
+ return;
+ } else {
+ throw new BuildException(msg);
+ }
+ }
origSm = System.getSecurityManager();
init();
System.setSecurityManager(new MySM());
@@ -167,8 +191,23 @@ public class Permissions {
/**
* To be used by tasks that just finished executing the parts subject to these permissions.
+ * <p>
+ * This method is no longer supported in Java 18 and higher versions and throws a
+ * {@link BuildException}. {@link org.apache.tools.ant.MagicNames#WARN_SECURITY_MANAGER_USAGE}
+ * property can be set to {@code true} to log a warning message instead of throwing the exception.
*/
- public synchronized void restoreSecurityManager() {
+ public synchronized void restoreSecurityManager() throws BuildException {
+ if (!SecurityManagerUtil.isSetSecurityManagerAllowed()) {
+ final String msg = "Use of <permissions> or " + Permissions.class.getName()
+ + " is disallowed in current Java runtime version";
+ if (SecurityManagerUtil.warnOnSecurityManagerUsage(getProject())) {
+ // just log a warning
+ log("Security checks are disabled - " + msg, Project.MSG_WARN);
+ return;
+ } else {
+ throw new BuildException(msg);
+ }
+ }
active = false;
System.setSecurityManager(origSm);
}
diff --git a/src/main/org/apache/tools/ant/util/SecurityManagerUtil.java b/src/main/org/apache/tools/ant/util/SecurityManagerUtil.java
new file mode 100644
index 0000000..836a7b8
--- /dev/null
+++ b/src/main/org/apache/tools/ant/util/SecurityManagerUtil.java
@@ -0,0 +1,57 @@
+/*
+ * 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
+ *
+ * https://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.
+ *
+ */
+package org.apache.tools.ant.util;
+
+import org.apache.tools.ant.MagicNames;
+import org.apache.tools.ant.Project;
+
+/**
+ * @since Ant 1.10.14
+ */
+public final class SecurityManagerUtil {
+
+ private static final boolean isJava18OrHigher = JavaEnvUtils.isAtLeastJavaVersion("18");
+ private static final boolean sysPropWarnOnSecMgrUsage =
+ Boolean.getBoolean(MagicNames.WARN_SECURITY_MANAGER_USAGE);
+
+ /**
+ * {@return true if {@code SecurityManager} usage is allowed in current Java runtime. false
+ * otherwise}
+ */
+ public static boolean isSetSecurityManagerAllowed() {
+ if (isJava18OrHigher) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * {@return true if {@code SecurityManager} usage should only be logged as a warning. false
+ * otherwise}
+ */
+ public static boolean warnOnSecurityManagerUsage(final Project project) {
+ if (project == null) {
+ return sysPropWarnOnSecMgrUsage;
+ }
+ final String val = project.getProperty(MagicNames.WARN_SECURITY_MANAGER_USAGE);
+ if (val == null) {
+ return sysPropWarnOnSecMgrUsage;
+ }
+ return Boolean.parseBoolean(val);
+ }
+}
diff --git a/src/main/org/apache/tools/ant/util/optional/NoExitSecurityManager.java b/src/main/org/apache/tools/ant/util/optional/NoExitSecurityManager.java
index 4df8ef0..f1559e9 100644
--- a/src/main/org/apache/tools/ant/util/optional/NoExitSecurityManager.java
+++ b/src/main/org/apache/tools/ant/util/optional/NoExitSecurityManager.java
@@ -26,6 +26,8 @@ import org.apache.tools.ant.ExitException;
* The goal is to intercept System.exit calls and make it throw an
* exception instead so that a System.exit in a task does not
* fully terminate Ant.
+ * <p>
+ * This class is no longer supported in Java runtime versions 18 and higher.
*
* @see ExitException
*/
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
index 1265461..3faf3a6 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
@@ -35,6 +35,7 @@ import org.apache.tools.ant.MagicNames;
import org.apache.tools.ant.input.DefaultInputHandler;
import org.apache.tools.ant.taskdefs.condition.JavaVersion;
import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.JavaEnvUtils;
import org.apache.tools.ant.util.TeeOutputStream;
import org.junit.Assume;
import org.junit.AssumptionViolatedException;
@@ -72,6 +73,18 @@ public class JavaTest {
private boolean runFatalTests = false;
+ private static final boolean allowedToIssueSystemExit;
+ private static final String SKIP_MSG_CAUSE_SYSTEM_EXIT_USE =
+ "Skipping test on current Java version " + JavaEnvUtils.getJavaVersion()
+ + " because test calls System.exit() in non-forked VM";
+ static {
+ final JavaVersion javaVersion = new JavaVersion();
+ javaVersion.setAtMost("17");
+ // don't run tests which call System.exit() on a non-forked VM because
+ // Ant no longer sets a custom SecurityManager to prevent the VM exit
+ // for Java versions >= 18
+ allowedToIssueSystemExit = javaVersion.eval();
+ }
/**
* configure the project.
@@ -209,12 +222,14 @@ public class JavaTest {
@Test
public void testRunFail() {
assumeTrue("Fatal tests have not been set to run", runFatalTests);
+ assumeTrue(SKIP_MSG_CAUSE_SYSTEM_EXIT_USE, allowedToIssueSystemExit);
buildRule.executeTarget("testRunFail");
}
@Test
public void testRunFailFoe() {
assumeTrue("Fatal tests have not been set to run", runFatalTests);
+ assumeTrue(SKIP_MSG_CAUSE_SYSTEM_EXIT_USE, allowedToIssueSystemExit);
thrown.expect(BuildException.class);
thrown.expectMessage("Java returned:");
buildRule.executeTarget("testRunFailFoe");
@@ -273,12 +288,14 @@ public class JavaTest {
@Test
public void testResultPropertyNonZeroNoFork() {
+ assumeTrue(SKIP_MSG_CAUSE_SYSTEM_EXIT_USE, allowedToIssueSystemExit);
buildRule.executeTarget("testResultPropertyNonZeroNoFork");
- assertEquals("-1", buildRule.getProject().getProperty("exitcode"));
+ assertEquals("-1", buildRule.getProject().getProperty("exitcode"));
}
@Test
public void testRunFailWithFailOnError() {
+ assumeTrue(SKIP_MSG_CAUSE_SYSTEM_EXIT_USE, allowedToIssueSystemExit);
thrown.expect(BuildException.class);
thrown.expectMessage("Java returned:");
buildRule.executeTarget("testRunFailWithFailOnError");
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java
index 9ea6089..4d69126 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java
@@ -35,7 +35,9 @@ import javax.xml.transform.TransformerFactoryConfigurationError;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.XSLTLiaison;
import org.apache.tools.ant.taskdefs.XSLTLogger;
+import org.apache.tools.ant.taskdefs.condition.JavaVersion;
import org.apache.tools.ant.util.JAXPUtils;
+import org.apache.tools.ant.util.JavaEnvUtils;
import org.junit.After;
import org.junit.Test;
@@ -60,6 +62,10 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest implements XSLTLogg
@Test
public void testXalan2RedirectViaJDKFactory() throws Exception {
+ final JavaVersion javaVersion = new JavaVersion();
+ javaVersion.setAtMost("17");
+ assumeTrue("Test sets SecurityManager at runtime which is no longer supported" +
+ " on Java version: " + JavaEnvUtils.getJavaVersion(), javaVersion.eval());
try {
getClass().getClassLoader().loadClass("org.apache.xalan.lib.Redirect");
} catch (Exception exc) {
@@ -106,6 +112,10 @@ public class TraXLiaisonTest extends AbstractXSLTLiaisonTest implements XSLTLogg
@Test
public void testXalan2RedirectViaXalan() throws Exception {
+ final JavaVersion javaVersion = new JavaVersion();
+ javaVersion.setAtMost("17");
+ assumeTrue("Test sets SecurityManager at runtime which is no longer supported" +
+ " on Java version: " + JavaEnvUtils.getJavaVersion(), javaVersion.eval());
try {
getClass().getClassLoader().loadClass("org.apache.xalan.lib.Redirect");
} catch (Exception exc) {
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
index 802f572..301c339 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs.optional.junit;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeNoException;
+import static org.junit.Assume.assumeTrue;
import java.io.File;
import java.io.FileOutputStream;
@@ -29,13 +30,19 @@ import java.security.Permission;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Delete;
+import org.apache.tools.ant.taskdefs.condition.JavaVersion;
import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.util.JavaEnvUtils;
import org.junit.Test;
public class XMLResultAggregatorTest {
@Test
public void testFrames() throws Exception {
+ final JavaVersion javaVersion = new JavaVersion();
+ javaVersion.setAtMost("17");
+ assumeTrue("Test sets SecurityManager at runtime which is no longer supported" +
+ " on Java version: " + JavaEnvUtils.getJavaVersion(), javaVersion.eval());
// For now, skip this test on JDK 6 (and below); see below for why:
try {
Class.forName("java.nio.file.Files");
diff --git a/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java b/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
index bbc7f1f..7578a25 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PermissionsTest.java
@@ -19,6 +19,8 @@
package org.apache.tools.ant.types;
import org.apache.tools.ant.ExitException;
+import org.apache.tools.ant.taskdefs.condition.JavaVersion;
+import org.apache.tools.ant.util.JavaEnvUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -27,6 +29,7 @@ import org.junit.rules.ExpectedException;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasProperty;
+import static org.junit.Assume.assumeTrue;
/**
* JUnit 4 testcases for org.apache.tools.ant.types.Permissions.
@@ -40,6 +43,11 @@ public class PermissionsTest {
@Before
public void setUp() {
+ final JavaVersion javaVersion = new JavaVersion();
+ javaVersion.setAtMost("17");
+ assumeTrue("org.apache.tools.ant.types.Permissions no longer supported on Java version: "
+ + JavaEnvUtils.getJavaVersion(), javaVersion.eval());
+
perms = new Permissions();
Permissions.Permission perm = new Permissions.Permission();
// Grant extra permissions to read and write the user.* properties and read to the
@@ -87,7 +95,9 @@ public class PermissionsTest {
@After
public void tearDown() {
- perms.restoreSecurityManager();
+ if (perms != null) {
+ perms.restoreSecurityManager();
+ }
}
/** Tests a permission that is granted per default. */
--
2.47.0

@ -1,46 +0,0 @@
--- build.xml~ 2021-05-17 12:32:48.406394876 +0200
+++ build.xml 2021-05-17 12:32:39.990389601 +0200
@@ -145,8 +145,6 @@
-->
<pathelement location="${src.junit}"/>
<pathelement location="${tests.etc.dir}"/>
- <!-- Otherwise many tests fail with "com.sun.tools.javac.Main is not on the classpath.": -->
- <pathelement location="${java.home}/../lib/tools.jar"/>
</path>
<!--
@@ -819,7 +817,6 @@
</metainf>
<manifest>
<attribute name="Main-Class" value="org.apache.tools.ant.Main"/>
- <attribute name="Class-Path" value="ant.jar xalan.jar"/>
</manifest>
</jar>
@@ -1562,7 +1559,25 @@
verbose="${javadoc.verbose}"
additionalparam="${javadoc.doclint.none}">
- <packageset dir="${java.dir}"/>
+ <fileset dir="${java.dir}">
+ <include name="**/*.java"/>
+ <exclude name="org/apache/tools/ant/taskdefs/email/MimeMailer.java"/>
+ <exclude name="org/apache/tools/ant/taskdefs/optional/NetRexxC.java"/>
+ <exclude name="org/apache/tools/ant/taskdefs/optional/image/Image.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/Arc.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/BasicShape.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/Draw.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/DrawOperation.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/Ellipse.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/ImageOperation.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/Rectangle.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/Rotate.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/Scale.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/Text.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/TransformOperation.java"/>
+ <exclude name="org/apache/tools/ant/types/optional/image/ColorMapper.java"/>
+ <exclude name="org/apache/tools/ant/taskdefs/optional/image/ImageIOTask.java"/>
+ </fileset>
<!-- hide some meta information for javadoc -->
<tag name="todo" description="To do:" scope="all"/>

@ -1,29 +0,0 @@
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageIOTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageIOTest.java
index 537a4e8ffaf3af22..bfc8a011ad4b21f8 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageIOTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageIOTest.java
@@ -28,6 +28,7 @@ import org.junit.rules.ExpectedException;
import java.io.File;
+import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
@@ -132,13 +133,13 @@ public class ImageIOTest {
@Test
public void testFailOnError() {
- final String message = "Unsupported Image Type";
thrown.expect(BuildException.class);
- thrown.expectMessage(message);
try {
buildRule.executeTarget("testFailOnError");
} finally {
- assertThat(buildRule.getLog(), containsString(message));
+ assertThat(buildRule.getLog(),
+ anyOf(containsString("Unsupported Image Type"),
+ containsString("Unknown image type")));
}
}

@ -17,8 +17,4 @@ else
# ANT_HOME for rpm layout
ANT_HOME=/usr/share/ant
if [ -z "$JAVA_HOME" ] ; then
. /etc/java/ant.conf
fi
fi

@ -28,13 +28,18 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
%bcond_with bootstrap
%bcond_without tests
%bcond_without javadoc
# Disabled for now, asi it doesn't work (tests fail) and nobody needs it
%bcond_with junit5
%global ant_home %{_datadir}/ant
Name: ant
Version: 1.10.9
Release: 11%{?dist}
Version: 1.10.5
Release: 1%{?dist}
Epoch: 0
Summary: Java build tool
Summary(it): Tool per la compilazione di programmi java
Summary(fr): Outil de compilation pour java
@ -45,21 +50,14 @@ Source2: apache-ant-1.8.ant.conf
# manpage
Source3: ant.asciidoc
Patch0: %{name}-build.xml.patch
Patch1: %{name}-openjdk-jpeg-cmyk.patch
Patch2: 0001-Disable-SecurityManager-for-Java-18.patch
BuildRequires: asciidoc
BuildRequires: xmlto
BuildRequires: javapackages-local
%if %{with bootstrap}
BuildRequires: javapackages-bootstrap
%else
BuildRequires: java-devel >= 1:1.8.0
BuildRequires: ant >= 1.10.2
BuildRequires: ant-junit
BuildRequires: asciidoc
BuildRequires: xmlto
BuildRequires: mvn(antlr:antlr)
BuildRequires: mvn(bcel:bcel)
BuildRequires: mvn(bsf:bsf)
@ -69,6 +67,7 @@ BuildRequires: mvn(commons-net:commons-net)
BuildRequires: mvn(javax.mail:mail)
BuildRequires: mvn(jdepend:jdepend)
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(log4j:log4j:1.2.13)
BuildRequires: mvn(org.tukaani:xz)
BuildRequires: mvn(oro:oro)
BuildRequires: mvn(regexp:regexp)
@ -77,13 +76,15 @@ BuildRequires: mvn(xml-resolver:xml-resolver)
BuildRequires: mvn(org.hamcrest:hamcrest-core)
BuildRequires: mvn(org.hamcrest:hamcrest-library)
%if %{with junit5}
BuildRequires: junit5
%endif
Requires: %{name}-lib = %{version}-%{release}
Requires: %{name}-jdk-binding = %{version}-%{release}
Suggests: %{name}-openjdk17 = %{version}-%{release}
# Theoretically Ant might be usable with just JRE, but typical Ant
# workflow requires full JDK, so we recommend it here.
%{?fedora:Recommends}%{!?fedora:Requires}: java-devel >= 1:1.8.0
Requires: %{name}-lib = %{epoch}:%{version}-%{release}
# Require full javapackages-tools since the ant script uses
# /usr/share/java-utils/java-functions
Requires: javapackages-tools
@ -117,21 +118,9 @@ Summary: Core part of %{name}
%description lib
Core part of Apache Ant that can be used as a library.
%package junit
Summary: Optional junit tasks for %{name}
Requires: %{name} = %{version}-%{release}
%description junit
Optional junit tasks for %{name}.
%description junit -l fr
Taches junit optionelles pour %{name}.
%if %{without bootstrap}
%package jmf
Summary: Optional jmf tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description jmf
Optional jmf tasks for %{name}.
@ -141,7 +130,7 @@ Taches jmf optionelles pour %{name}.
%package swing
Summary: Optional swing tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description swing
Optional swing tasks for %{name}.
@ -151,7 +140,7 @@ Taches swing optionelles pour %{name}.
%package antlr
Summary: Optional antlr tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description antlr
Optional antlr tasks for %{name}.
@ -161,7 +150,7 @@ Taches antlr optionelles pour %{name}.
%package apache-bsf
Summary: Optional apache bsf tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description apache-bsf
Optional apache bsf tasks for %{name}.
@ -171,7 +160,7 @@ Taches apache bsf optionelles pour %{name}.
%package apache-resolver
Summary: Optional apache resolver tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description apache-resolver
Optional apache resolver tasks for %{name}.
@ -181,7 +170,7 @@ Taches apache resolver optionelles pour %{name}.
%package commons-logging
Summary: Optional commons logging tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description commons-logging
Optional commons logging tasks for %{name}.
@ -191,7 +180,7 @@ Taches commons logging optionelles pour %{name}.
%package commons-net
Summary: Optional commons net tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description commons-net
Optional commons net tasks for %{name}.
@ -199,9 +188,22 @@ Optional commons net tasks for %{name}.
%description commons-net -l fr
Taches commons net optionelles pour %{name}.
# Disable because we don't ship the dependencies
%if 0
%package jai
Summary: Optional jai tasks for %{name}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description jai
Optional jai tasks for %{name}.
%description jai -l fr
Taches jai optionelles pour %{name}.
%endif
%package apache-bcel
Summary: Optional apache bcel tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description apache-bcel
Optional apache bcel tasks for %{name}.
@ -209,9 +211,19 @@ Optional apache bcel tasks for %{name}.
%description apache-bcel -l fr
Taches apache bcel optionelles pour %{name}.
%package apache-log4j
Summary: Optional apache log4j tasks for %{name}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description apache-log4j
Optional apache log4j tasks for %{name}.
%description apache-log4j -l fr
Taches apache log4j optionelles pour %{name}.
%package apache-oro
Summary: Optional apache oro tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description apache-oro
Optional apache oro tasks for %{name}.
@ -221,7 +233,7 @@ Taches apache oro optionelles pour %{name}.
%package apache-regexp
Summary: Optional apache regexp tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description apache-regexp
Optional apache regexp tasks for %{name}.
@ -231,7 +243,7 @@ Taches apache regexp optionelles pour %{name}.
%package apache-xalan2
Summary: Optional apache xalan2 tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description apache-xalan2
Optional apache xalan2 tasks for %{name}.
@ -239,16 +251,9 @@ Optional apache xalan2 tasks for %{name}.
%description apache-xalan2 -l fr
Taches apache xalan2 optionelles pour %{name}.
%package imageio
Summary: Optional imageio tasks for %{name}
Requires: %{name} = %{version}-%{release}
%description imageio
Optional imageio tasks for %{name}.
%package javamail
Summary: Optional javamail tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description javamail
Optional javamail tasks for %{name}.
@ -258,7 +263,7 @@ Taches javamail optionelles pour %{name}.
%package jdepend
Summary: Optional jdepend tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description jdepend
Optional jdepend tasks for %{name}.
@ -268,7 +273,7 @@ Taches jdepend optionelles pour %{name}.
%package jsch
Summary: Optional jsch tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description jsch
Optional jsch tasks for %{name}.
@ -276,26 +281,38 @@ Optional jsch tasks for %{name}.
%description jsch -l fr
Taches jsch optionelles pour %{name}.
%package junit
Summary: Optional junit tasks for %{name}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description junit
Optional junit tasks for %{name}.
%description junit -l fr
Taches junit optionelles pour %{name}.
%if %{with junit5}
%package junit5
Summary: Optional junit5 tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description junit5
Optional junit5 tasks for %{name}.
%description junit5 -l fr
Taches junit5 optionelles pour %{name}.
%endif
%package testutil
Summary: Test utility classes for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description testutil
Test utility tasks for %{name}.
%package xz
Summary: Optional xz tasks for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{epoch}:%{version}-%{release}
%description xz
Optional xz tasks for %{name}.
@ -321,63 +338,13 @@ Javadoc for %{name}.
%description javadoc -l fr
Javadoc pour %{name}.
%endif
%package openjdk8
Summary: OpenJDK 8 binding for Ant
RemovePathPostfixes: -openjdk8
Provides: ant-jdk-binding = %{version}-%{release}
Requires: ant = %{version}-%{release}
Requires: java-1.8.0-openjdk-headless
Recommends: java-1.8.0-openjdk-devel
Conflicts: ant-jdk-binding
%description openjdk8
Configures Ant to run with OpenJDK 8.
%package openjdk11
Summary: OpenJDK 11 binding for Ant
RemovePathPostfixes: -openjdk11
Provides: ant-jdk-binding = %{version}-%{release}
Requires: ant = %{version}-%{release}
Requires: java-11-openjdk-headless
Recommends: java-11-openjdk-devel
Conflicts: ant-jdk-binding
%description openjdk11
Configures Ant to run with OpenJDK 11.
%package openjdk17
Summary: OpenJDK 17 binding for Ant
RemovePathPostfixes: -openjdk17
Provides: ant-jdk-binding = %{version}-%{release}
Requires: ant = %{version}-%{release}
Requires: java-17-openjdk-headless
Recommends: java-17-openjdk-devel
Conflicts: ant-jdk-binding
%description openjdk17
Configures Ant to run with OpenJDK 17.
%package openjdk21
Summary: OpenJDK 21 binding for Ant
RemovePathPostfixes: -openjdk21
Provides: ant-jdk-binding = %{version}-%{release}
Requires: ant = %{version}-%{release}
Requires: java-21-openjdk-headless
Recommends: java-21-openjdk-devel
Conflicts: ant-jdk-binding
%description openjdk21
Configures Ant to run with OpenJDK 21.
# -----------------------------------------------------------------------------
%prep
%setup -q -n apache-ant-%{version}
%patch -P 0 -p0
%patch -P 1 -p1
%patch -P 2 -p1
# Fix class-path-in-manifest rpmlint warning
%pom_xpath_remove 'attribute[@name="Class-Path"]' build.xml
# clean jar files
find . -name "*.jar" | xargs -t rm
@ -389,16 +356,10 @@ rm src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java \
src/tests/junit/org/apache/tools/mail/MailMessageTest.java
# Log4jListener is deprecated by upstream: Apache Log4j (1) is not
# developed any more. Last release is 1.2.17 from 26 May 2012 and
# contains vulnerability issues.
rm src/main/org/apache/tools/ant/listener/Log4jListener.java
#install jars
%if %{with bootstrap}
build-jar-repository -s -p lib/optional javapackages-bootstrap/junit javapackages-bootstrap/hamcrest-core
%else
build-jar-repository -s -p lib/optional antlr bcel javamail/mailapi jdepend junit oro regexp bsf commons-logging commons-net jsch xalan-j2 xml-commons-resolver xalan-j2-serializer hamcrest/core hamcrest/library xz-java junit5 opentest4j
build-jar-repository -s -p lib/optional antlr bcel javamail/mailapi jdepend junit log4j-1 oro regexp bsf commons-logging commons-net jsch xalan-j2 xml-commons-resolver xalan-j2-serializer hamcrest/core hamcrest/library xz-java
%if %{with junit5}
build-jar-repository -s -p lib/optional junit5 opentest4j
%endif
# fix hardcoded paths in ant script and conf
@ -414,22 +375,23 @@ sed -e 's:/etc/ant.conf:%{_sysconfdir}/ant.conf:g' \
sed -i 's/jaxp_parser_impl//;s/xml-commons-apis//' src/script/ant
# Fix file-not-utf8 rpmlint warning
iconv KEYS -f iso-8859-1 -t utf-8 >KEYS.utf8
iconv KEYS -f iso-8859-1 -t utf-8 -o KEYS.utf8
mv KEYS.utf8 KEYS
iconv LICENSE -f iso-8859-1 -t utf-8 >LICENSE.utf8
iconv LICENSE -f iso-8859-1 -t utf-8 -o LICENSE.utf8
mv LICENSE.utf8 LICENSE
# We want a hard dep on antlr
%pom_xpath_remove pom:optional src/etc/poms/ant-antlr/pom.xml
# fix javamail dependency coordinates (remove once javamail is updated)
%pom_change_dep -r com.sun.mail:jakarta.mail javax.mail:mail src/etc/poms/ant-javamail/pom.xml
%if %{without junit5}
%pom_xpath_inject 'target[@name="javadocs"]/javadoc/packageset' '<exclude name="**/junitlauncher"/>' build.xml
%endif
%build
%if %{with bootstrap}
%{ant} jars
%else
%{ant} jars test-jar javadocs
%{ant} jars test-jar
%if %with javadoc
%{ant} javadocs
%endif
# typeset the manpage
@ -437,11 +399,12 @@ mkdir man
asciidoc -b docbook -d manpage -o man/%{name}.xml %{SOURCE3}
xmlto man man/%{name}.xml -o man
# remove empty jai and netrexx jars. Due to missing dependencies they contain only manifests.
#remove empty jai and netrexx jars. Due to missing dependencies they contain only manifests.
rm -fr build/lib/ant-jai.jar build/lib/ant-netrexx.jar
# log4j logging is deprecated
rm build/lib/ant-apache-log4j.jar
%if %{without junit5}
rm -f build/lib/ant-junitlauncher.jar
%endif
# -----------------------------------------------------------------------------
%install
# ANT_HOME and subdirs
@ -452,16 +415,6 @@ mkdir -p $RPM_BUILD_ROOT%{ant_home}/{lib,etc,bin}
%mvn_file ':{ant,ant-bootstrap,ant-launcher}' %{name}/@1 @1
%if %{with bootstrap}
mv build/lib build/lib0
mkdir build/lib/
mv build/lib0/ant.jar build/lib/
mv build/lib0/ant-bootstrap.jar build/lib/
mv build/lib0/ant-launcher.jar build/lib/
mv build/lib0/ant-junit.jar build/lib/
mv build/lib0/ant-junit4.jar build/lib/
%endif
for jar in build/lib/*.jar
do
# Make sure that installed JARs are not empty
@ -498,11 +451,6 @@ rm -f src/script/*.bat
rm -f src/script/*.cmd
# XSLs
%if %{with bootstrap}
rm src/etc/jdepend-frames.xsl
rm src/etc/jdepend.xsl
rm src/etc/maudit-frames.xsl
%endif
cp -p src/etc/*.xsl $RPM_BUILD_ROOT%{ant_home}/etc
# install everything else
@ -515,62 +463,49 @@ cp -p src/script/antRun $RPM_BUILD_ROOT%{ant_home}/bin/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
cp -p %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
# JDK bindings for ant.conf
install -d -m 755 $RPM_BUILD_ROOT%{_javaconfdir}/
## For Java 1.8 prefer jvm
echo '
if [ -d %{_jvmlibdir}/java-1.8.0-openjdk ]; then
JAVA_HOME=%{_jvmlibdir}/java-1.8.0-openjdk
else
JAVA_HOME=%{_jvmlibdir}/jre-1.8.0-openjdk
fi
' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk8
echo 'JAVA_HOME=%{_jvmlibdir}/jre-11-openjdk' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk11
echo 'JAVA_HOME=%{_jvmlibdir}/jre-17-openjdk' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk17
echo 'JAVA_HOME=%{_jvmlibdir}/jre-21-openjdk' >$RPM_BUILD_ROOT%{_javaconfdir}/ant.conf-openjdk21
# OPT_JAR_LIST fragments
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d
echo "junit hamcrest/core ant/ant-junit" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit
echo "junit hamcrest/core ant/ant-junit4" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit4
%if %{without bootstrap}
echo "ant/ant-jmf" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/jmf
echo "ant/ant-swing" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/swing
echo "antlr ant/ant-antlr" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/antlr
echo "bsf commons-logging ant/ant-apache-bsf" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-bsf
echo "rhino bsf ant/ant-apache-bsf" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-bsf
echo "xml-commons-resolver ant/ant-apache-resolver" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-resolver
echo "apache-commons-logging ant/ant-commons-logging" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/commons-logging
echo "apache-commons-net ant/ant-commons-net" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/commons-net
#echo "jai ant/ant-jai" > $RPM_BUILD_ROOT%%{_sysconfdir}/%%{name}.d/jai
echo "bcel ant/ant-apache-bcel" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-bcel
echo "log4j12 ant/ant-apache-log4j" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-log4j
echo "oro ant/ant-apache-oro" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-oro
echo "regexp ant/ant-apache-regexp" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-regexp
echo "xalan-j2 xalan-j2-serializer ant/ant-apache-xalan2" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/apache-xalan2
echo "ant/ant-imageio" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/imageio
echo "javamail jaf ant/ant-javamail" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/javamail
echo "jdepend ant/ant-jdepend" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/jdepend
echo "jsch ant/ant-jsch" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/jsch
echo "junit5 hamcrest/core junit opentest4j ant/ant-junitlauncher" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junitlauncher
echo "junit hamcrest/core ant/ant-junit" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit
echo "junit hamcrest/core ant/ant-junit4" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit4
echo "testutil ant/ant-testutil" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/testutil
echo "xz-java ant/ant-xz" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/xz
%if %{with junit5}
echo "junit5 hamcrest/core junit opentest4j ant/ant-junitlauncher" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junitlauncher
%endif
%if %with javadoc
# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -pr build/javadocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%endif
# fix link between manual and javadoc
(cd manual; ln -sf %{_javadocdir}/%{name} api)
%endif
# manpage
install -d -m 755 %{buildroot}%{_mandir}/man1/
install -p -m 644 man/%{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
%if %{without bootstrap}
%if %with tests
%check
LC_ALL=C.UTF-8 %{ant} -Doffline=true test
LC_ALL=en_US.utf8 %{ant} test
%endif
%files
@ -600,19 +535,6 @@ LC_ALL=C.UTF-8 %{ant} -Doffline=true test
%{ant_home}/lib/%{name}-launcher.jar
%{ant_home}/lib/%{name}-bootstrap.jar
%files junit -f .mfiles-junit
%{ant_home}/lib/%{name}-junit.jar
%{ant_home}/lib/%{name}-junit4.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/junit
%config(noreplace) %{_sysconfdir}/%{name}.d/junit4
%{ant_home}/etc/junit-frames.xsl
%{ant_home}/etc/junit-noframes.xsl
%{ant_home}/etc/junit-frames-xalan1.xsl
%{ant_home}/etc/junit-frames-saxon.xsl
%{ant_home}/etc/junit-noframes-saxon.xsl
%if %{without bootstrap}
%files jmf -f .mfiles-jmf
%{ant_home}/lib/%{name}-jmf.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/jmf
@ -641,10 +563,21 @@ LC_ALL=C.UTF-8 %{ant} -Doffline=true test
%{ant_home}/lib/%{name}-commons-net.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/commons-net
# Disable as we dont ship the dependencies
%if 0
%files jai -f .mfiles-jai
%{ant_home}/lib/%{name}-jai.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/jai
%endif
%files apache-bcel -f .mfiles-apache-bcel
%{ant_home}/lib/%{name}-apache-bcel.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/apache-bcel
%files apache-log4j -f .mfiles-apache-log4j
%{ant_home}/lib/%{name}-apache-log4j.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/apache-log4j
%files apache-oro -f .mfiles-apache-oro
%{ant_home}/lib/%{name}-apache-oro.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/apache-oro
@ -658,10 +591,6 @@ LC_ALL=C.UTF-8 %{ant} -Doffline=true test
%{ant_home}/lib/%{name}-apache-xalan2.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/apache-xalan2
%files imageio -f .mfiles-imageio
%{ant_home}/lib/%{name}-imageio.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/imageio
%files javamail -f .mfiles-javamail
%{ant_home}/lib/%{name}-javamail.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/javamail
@ -676,9 +605,22 @@ LC_ALL=C.UTF-8 %{ant} -Doffline=true test
%{ant_home}/lib/%{name}-jsch.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/jsch
%files junit -f .mfiles-junit
%{ant_home}/lib/%{name}-junit.jar
%{ant_home}/lib/%{name}-junit4.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/junit
%config(noreplace) %{_sysconfdir}/%{name}.d/junit4
%{ant_home}/etc/junit-frames.xsl
%{ant_home}/etc/junit-noframes.xsl
%{ant_home}/etc/junit-frames-xalan1.xsl
%{ant_home}/etc/junit-frames-saxon.xsl
%{ant_home}/etc/junit-noframes-saxon.xsl
%if %{with junit5}
%files junit5 -f .mfiles-junitlauncher
%{ant_home}/lib/%{name}-junitlauncher.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/junitlauncher
%endif
%files testutil -f .mfiles-testutil
%{ant_home}/lib/%{name}-testutil.jar
@ -692,111 +634,17 @@ LC_ALL=C.UTF-8 %{ant} -Doffline=true test
%license LICENSE NOTICE
%doc manual/*
%if %with javadoc
%files javadoc
%license LICENSE NOTICE
%{_javadocdir}/%{name}
%endif
%files openjdk8
%config %{_javaconfdir}/%{name}.conf-openjdk8
%files openjdk11
%config %{_javaconfdir}/%{name}.conf-openjdk11
%files openjdk17
%config %{_javaconfdir}/%{name}.conf-openjdk17
%files openjdk21
%config %{_javaconfdir}/%{name}.conf-openjdk21
# -----------------------------------------------------------------------------
%changelog
* Thu Nov 21 2024 Marián Konček <mkoncek@redhat.com> - 1.10.9-11
- Fix the usage ot patch macro
* Fri Nov 08 2024 Marián Konček <mkoncek@redhat.com> - 1.10.9-10
- Add OpenJDK bindings in a separate configuration file
- Resolves: RHEL-62405
* Wed Oct 16 2024 Marián Konček <mkoncek@redhat.com> - 1.10.9-9
- Add OpenJDK bindings
- Resolves: RHEL-62405
* Thu Jun 13 2024 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.10.9-8
- Fix test failures due to JPEG CMYK support in OpenJDK
- Resolves: RHEL-5354
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.10.9-7
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Mon Jun 28 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.10.9-6
- Disable deprecated log4j logging functionality
- Remove support for JavaScript
* Wed Jun 09 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.10.9-5
- Rebuild to workaround DistroBaker issue
* Tue Jun 08 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.10.9-4
- Bootstrap Maven for CentOS Stream 9
* Mon May 17 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.10.9-3
- Bootstrap build
- Non-bootstrap build
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.10.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Fri Oct 16 2020 Fabio Valentini <decathorpe@gmail.com> - 0:1.10.9-1
- Update to version 1.10.9.
- Addresses: CVE-2020-11979
* Wed Sep 16 2020 Fabio Valentini <decathorpe@gmail.com> - 0:1.10.8-6
- Remove workaround for jarsigner issues / RHBZ#1869017.
* Wed Sep 09 2020 Fabio Valentini <decathorpe@gmail.com> - 0:1.10.8-5
- Switch from log4j 1.2 compat package to log4j 1.2 API shim.
* Sun Aug 23 2020 Fabio Valentini <decathorpe@gmail.com> - 0:1.10.8-4
- Temporarily disable some jarsigner tests to work around RHBZ#1869017.
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.10.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jul 10 2020 Jiri Vanek <jvanek@redhat.com> - 0:1.10.8-2
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
- disabled javadoc, as it fails in jdk11, and ant should not be an FTBFS to soon
* Sat May 16 2020 Fabio Valentini <decathorpe@gmail.com> - 0:1.10.8-1
- Update to version 1.10.8.
- Addresses: CVE-2020-1945
* Fri May 08 2020 Fabio Valentini <decathorpe@gmail.com> - 0:1.10.7-1
- Update to version 1.10.7.
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.10.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Jul 29 2019 Fabio Valentini <decathorpe@gmail.com> - 0:1.10.6-1
- Update to version 1.10.6.
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.10.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sat Apr 27 2019 François Cami <fcami@redhat.com> - - 0:1.10.5-5
- Bump to fix FTBFS
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0:1.10.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Nov 19 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0:1.10.5-3
- Use C.UTF-8 locale
See https://fedoraproject.org/wiki/Changes/Remove_glibc-langpacks-all_from_buildroot
* Mon Aug 20 2018 Mat Booth <mat.booth@redhat.com> - 0:1.10.5-2
- Enable building the optional junit5 module
* Tue Dec 12 2023 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 0:1.10.5-1
- Rebuilt for MSVSphere 8.8
* Thu Aug 02 2018 Michael Simacek <msimacek@redhat.com> - 0:1.10.5-1
- Update to upstream version 1.10.5

Loading…
Cancel
Save