- Add patch to run scripts with python3 if applicable bsc#1082202:
* ant-python3.patch - Update to 1.9.10: * Various fixes for java10 * Small fixes all around - Remove merged patch reproducible.patch - Add patch to run scripts with python3 if applicable bsc#1082202: * ant-python3.patch - Update to 1.9.10: * Various fixes for java10 * Small fixes all around - Remove merged patch reproducible.patch - Add patch to run scripts with python3 if applicable bsc#1082202: * ant-python3.patch - Update to 1.9.10: * Various fixes for java10 * Small fixes all around - Remove merged patch reproducible.patch OBS-URL: https://build.opensuse.org/package/show/Java:packages/ant?expand=0&rev=108
This commit is contained in:
committed by
Git OBS Bridge
parent
0f335cb333
commit
08e1b5f3e1
@@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 22 11:43:31 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
- Add patch to run scripts with python3 if applicable bsc#1082202:
|
||||
* ant-python3.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 22 11:26:23 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
- Update to 1.9.10:
|
||||
* Various fixes for java10
|
||||
* Small fixes all around
|
||||
- Remove merged patch reproducible.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Oct 28 16:17:19 UTC 2017 - jengelh@inai.de
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ant-antlr
|
||||
#
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2000-2009, JPackage Project
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
@@ -24,7 +24,7 @@
|
||||
%bcond_with junit
|
||||
%bcond_without antlr
|
||||
Name: ant-antlr
|
||||
Version: 1.9.9
|
||||
Version: 1.9.10
|
||||
Release: 0
|
||||
Summary: Antlr Task for ant
|
||||
License: Apache-2.0
|
||||
@@ -37,12 +37,11 @@ Source1001: http://www.apache.org/dist/ant/source/apache-ant-%{version}-src.
|
||||
Source1002: ant.keyring
|
||||
Patch0: apache-ant-no-test-jar.patch
|
||||
Patch1: apache-ant-class-path-in-manifest.patch
|
||||
#PATCH-FIX-UPSTREAM -- https://bz.apache.org/bugzilla/show_bug.cgi?id=61079
|
||||
Patch3: reproducible.patch
|
||||
Patch4: apache-ant-1.9.9-sourcetarget.patch
|
||||
Patch5: apache-ant-bootstrap.patch
|
||||
#PATCH-FEATURE-OPENSUSE bmwiedemann -- have fixed build dates
|
||||
Patch6: reproducible-build-date.patch
|
||||
Patch7: ant-python3.patch
|
||||
BuildRequires: antlr-bootstrap
|
||||
BuildRequires: java-devel >= 1.6
|
||||
BuildRequires: javapackages-tools
|
||||
@@ -130,9 +129,9 @@ This package contains optional swing tasks for Apache Ant.
|
||||
Summary: Additional scripts for ant
|
||||
License: Apache-2.0
|
||||
Group: Development/Tools/Building
|
||||
Requires: %{_bindir}/perl
|
||||
Requires: %{_bindir}/python
|
||||
Requires: ant = %{version}
|
||||
Requires: perl
|
||||
Requires: python3-base
|
||||
|
||||
%description -n ant-scripts
|
||||
Apache Ant is a Java-based build tool.
|
||||
@@ -338,10 +337,10 @@ find -name build.xml -o -name pom.xml | xargs sed -i -e s/-SNAPSHOT//
|
||||
%patch0 -p1
|
||||
%endif
|
||||
%patch1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
# clean jar files
|
||||
find . -name "*.jar" -print -delete
|
||||
|
@@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 22 11:43:31 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
- Add patch to run scripts with python3 if applicable bsc#1082202:
|
||||
* ant-python3.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 22 11:26:23 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
- Update to 1.9.10:
|
||||
* Various fixes for java10
|
||||
* Small fixes all around
|
||||
- Remove merged patch reproducible.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Oct 28 16:17:19 UTC 2017 - jengelh@inai.de
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ant-junit
|
||||
#
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2000-2009, JPackage Project
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
@@ -24,7 +24,7 @@
|
||||
%bcond_without junit
|
||||
%bcond_with antlr
|
||||
Name: ant-junit
|
||||
Version: 1.9.9
|
||||
Version: 1.9.10
|
||||
Release: 0
|
||||
Summary: Optional junit tasks for ant
|
||||
License: Apache-2.0
|
||||
@@ -37,12 +37,11 @@ Source1001: http://www.apache.org/dist/ant/source/apache-ant-%{version}-src.
|
||||
Source1002: ant.keyring
|
||||
Patch0: apache-ant-no-test-jar.patch
|
||||
Patch1: apache-ant-class-path-in-manifest.patch
|
||||
#PATCH-FIX-UPSTREAM -- https://bz.apache.org/bugzilla/show_bug.cgi?id=61079
|
||||
Patch3: reproducible.patch
|
||||
Patch4: apache-ant-1.9.9-sourcetarget.patch
|
||||
Patch5: apache-ant-bootstrap.patch
|
||||
#PATCH-FEATURE-OPENSUSE bmwiedemann -- have fixed build dates
|
||||
Patch6: reproducible-build-date.patch
|
||||
Patch7: ant-python3.patch
|
||||
BuildRequires: antlr-bootstrap
|
||||
BuildRequires: java-devel >= 1.6
|
||||
BuildRequires: javapackages-tools
|
||||
@@ -130,9 +129,9 @@ This package contains optional swing tasks for Apache Ant.
|
||||
Summary: Additional scripts for ant
|
||||
License: Apache-2.0
|
||||
Group: Development/Tools/Building
|
||||
Requires: %{_bindir}/perl
|
||||
Requires: %{_bindir}/python
|
||||
Requires: ant = %{version}
|
||||
Requires: perl
|
||||
Requires: python3-base
|
||||
|
||||
%description -n ant-scripts
|
||||
Apache Ant is a Java-based build tool.
|
||||
@@ -338,10 +337,10 @@ find -name build.xml -o -name pom.xml | xargs sed -i -e s/-SNAPSHOT//
|
||||
%patch0 -p1
|
||||
%endif
|
||||
%patch1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
# clean jar files
|
||||
find . -name "*.jar" -print -delete
|
||||
|
86
ant-python3.patch
Normal file
86
ant-python3.patch
Normal file
@@ -0,0 +1,86 @@
|
||||
Index: apache-ant-1.9.10/src/script/runant.py
|
||||
===================================================================
|
||||
--- apache-ant-1.9.10.orig/src/script/runant.py
|
||||
+++ apache-ant-1.9.10/src/script/runant.py
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/python
|
||||
+#!/usr/bin/python3
|
||||
# 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.
|
||||
@@ -36,7 +36,7 @@ debug = 0
|
||||
#######################################################################
|
||||
|
||||
# If ANT_HOME is not set default to script's parent directory
|
||||
-if os.environ.has_key('ANT_HOME'):
|
||||
+if 'ANT_HOME' in os.environ:
|
||||
ANT_HOME = os.environ['ANT_HOME']
|
||||
else:
|
||||
ANT_HOME = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
|
||||
@@ -46,17 +46,17 @@ ANT_LIB = os.path.join(ANT_HOME, 'lib')
|
||||
|
||||
# set JAVACMD (check variables JAVACMD and JAVA_HOME)
|
||||
JAVACMD = None
|
||||
-if not os.environ.has_key('JAVACMD'):
|
||||
- if os.environ.has_key('JAVA_HOME'):
|
||||
+if 'JAVACMD' not in os.environ:
|
||||
+ if 'JAVA_HOME' in os.environ:
|
||||
if not os.path.exists(os.environ['JAVA_HOME']):
|
||||
- print "Warning: JAVA_HOME is not defined correctly."
|
||||
+ print("Warning: JAVA_HOME is not defined correctly.")
|
||||
else:
|
||||
JAVA_HOME = os.environ['JAVA_HOME']
|
||||
while JAVA_HOME[0] == JAVA_HOME[-1] == "\"":
|
||||
JAVA_HOME = JAVA_HOME[1:-1]
|
||||
JAVACMD = os.path.join(JAVA_HOME, 'bin', 'java')
|
||||
else:
|
||||
- print "Warning: JAVA_HOME not set."
|
||||
+ print("Warning: JAVA_HOME not set.")
|
||||
else:
|
||||
JAVACMD = os.environ['JAVACMD']
|
||||
if not JAVACMD:
|
||||
@@ -64,28 +64,28 @@ if not JAVACMD:
|
||||
|
||||
launcher_jar = os.path.join(ANT_LIB, 'ant-launcher.jar')
|
||||
if not os.path.exists(launcher_jar):
|
||||
- print 'Warning: Unable to locate ant-launcher.jar. Expected to find it in %s' % \
|
||||
- ANT_LIB
|
||||
+ print('Warning: Unable to locate ant-launcher.jar. Expected to find it in %s' % \
|
||||
+ ANT_LIB)
|
||||
|
||||
# Build up standard classpath (LOCALCLASSPATH)
|
||||
LOCALCLASSPATH = launcher_jar
|
||||
-if os.environ.has_key('LOCALCLASSPATH'):
|
||||
+if 'LOCALCLASSPATH' in os.environ:
|
||||
LOCALCLASSPATH += os.pathsep + os.environ['LOCALCLASSPATH']
|
||||
|
||||
ANT_OPTS = ""
|
||||
-if os.environ.has_key('ANT_OPTS'):
|
||||
+if 'ANT_OPTS' in os.environ:
|
||||
ANT_OPTS = os.environ['ANT_OPTS']
|
||||
|
||||
OPTS = ""
|
||||
-if os.environ.has_key('JIKESPATH'):
|
||||
+if 'JIKESPATH' in os.environ:
|
||||
OPTS = '-Djikes.class.path=\"%s\"' % os.environ['JIKESPATH']
|
||||
|
||||
ANT_ARGS = ""
|
||||
-if os.environ.has_key('ANT_ARGS'):
|
||||
+if 'ANT_ARGS' in os.environ:
|
||||
ANT_ARGS = os.environ['ANT_ARGS']
|
||||
|
||||
CLASSPATH = ""
|
||||
-if os.environ.has_key('CLASSPATH'):
|
||||
+if 'CLASSPATH' in os.environ:
|
||||
CLASSPATH = "-lib " + os.environ['CLASSPATH']
|
||||
|
||||
while JAVACMD[0] == JAVACMD[-1] == "\"":
|
||||
@@ -98,7 +98,7 @@ cmdline = ('"%s" %s -classpath %s -Dant.
|
||||
CLASSPATH, string.join(sys.argv[1:], ' '))
|
||||
|
||||
if debug:
|
||||
- print '\n%s\n\n' % (cmdline)
|
||||
+ print('\n%s\n\n' % (cmdline))
|
||||
sys.stdout.flush()
|
||||
|
||||
# Run the biniou!
|
14
ant.changes
14
ant.changes
@@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 22 11:43:31 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
- Add patch to run scripts with python3 if applicable bsc#1082202:
|
||||
* ant-python3.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 22 11:26:23 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
- Update to 1.9.10:
|
||||
* Various fixes for java10
|
||||
* Small fixes all around
|
||||
- Remove merged patch reproducible.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Oct 28 16:17:19 UTC 2017 - jengelh@inai.de
|
||||
|
||||
|
13
ant.spec
13
ant.spec
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ant
|
||||
#
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2000-2009, JPackage Project
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
@@ -23,7 +23,7 @@
|
||||
%bcond_with junit
|
||||
%bcond_with antlr
|
||||
Name: ant
|
||||
Version: 1.9.9
|
||||
Version: 1.9.10
|
||||
Release: 0
|
||||
Summary: Java-based build tool
|
||||
License: Apache-2.0
|
||||
@@ -36,12 +36,11 @@ Source1001: http://www.apache.org/dist/ant/source/apache-ant-%{version}-src.
|
||||
Source1002: ant.keyring
|
||||
Patch0: apache-ant-no-test-jar.patch
|
||||
Patch1: apache-ant-class-path-in-manifest.patch
|
||||
#PATCH-FIX-UPSTREAM -- https://bz.apache.org/bugzilla/show_bug.cgi?id=61079
|
||||
Patch3: reproducible.patch
|
||||
Patch4: apache-ant-1.9.9-sourcetarget.patch
|
||||
Patch5: apache-ant-bootstrap.patch
|
||||
#PATCH-FEATURE-OPENSUSE bmwiedemann -- have fixed build dates
|
||||
Patch6: reproducible-build-date.patch
|
||||
Patch7: ant-python3.patch
|
||||
BuildRequires: antlr-bootstrap
|
||||
BuildRequires: java-devel >= 1.6
|
||||
BuildRequires: javapackages-tools
|
||||
@@ -129,9 +128,9 @@ This package contains optional swing tasks for Apache Ant.
|
||||
Summary: Additional scripts for ant
|
||||
License: Apache-2.0
|
||||
Group: Development/Tools/Building
|
||||
Requires: %{_bindir}/perl
|
||||
Requires: %{_bindir}/python
|
||||
Requires: ant = %{version}
|
||||
Requires: perl
|
||||
Requires: python3-base
|
||||
|
||||
%description -n ant-scripts
|
||||
Apache Ant is a Java-based build tool.
|
||||
@@ -337,10 +336,10 @@ find -name build.xml -o -name pom.xml | xargs sed -i -e s/-SNAPSHOT//
|
||||
%patch0 -p1
|
||||
%endif
|
||||
%patch1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
# clean jar files
|
||||
find . -name "*.jar" -print -delete
|
||||
|
3
apache-ant-1.9.10-src.tar.bz2
Normal file
3
apache-ant-1.9.10-src.tar.bz2
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:897b9fddde547f7fa33093cfe2dbfb9cd5b22e9ed22e8b41fab4fb99d3d5cf9d
|
||||
size 3945430
|
6
apache-ant-1.9.10-src.tar.bz2.asc
Normal file
6
apache-ant-1.9.10-src.tar.bz2.asc
Normal file
@@ -0,0 +1,6 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iFoEABECABoFAlp14BETHGJvZGV3aWdAYXBhY2hlLm9yZwAKCRCiEVrhX2uLcoH0
|
||||
AKCM78sM9iRxH3mL3sYStUDYkAxTMACgvcc4r6Om4dqv9Z77nVgO4yec7Fk=
|
||||
=fcdA
|
||||
-----END PGP SIGNATURE-----
|
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:69aa251ffb9f31312c21d67db197843e0b03b3c8cc3e0af6e6e92d98eb0f2ead
|
||||
size 3832876
|
@@ -1,7 +0,0 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1
|
||||
|
||||
iEYEABECAAYFAliTeuMACgkQohFa4V9ri3JKrwCfeUXDKRaGVSVPi8pJJdDnh+mz
|
||||
UkUAn0TPQC0YCk45FrYkWw42dwzkWcIh
|
||||
=veU8
|
||||
-----END PGP SIGNATURE-----
|
@@ -1,12 +1,13 @@
|
||||
--- apache-ant-1.9.9/bootstrap.sh 2017-02-02 18:55:08.000000000 +0100
|
||||
+++ apache-ant-1.9.9/bootstrap.sh 2017-09-14 09:10:47.071433171 +0200
|
||||
@@ -124,8 +124,7 @@
|
||||
mkdir -p bin
|
||||
Index: apache-ant-1.9.10/bootstrap.sh
|
||||
===================================================================
|
||||
--- apache-ant-1.9.10.orig/bootstrap.sh
|
||||
+++ apache-ant-1.9.10/bootstrap.sh
|
||||
@@ -129,7 +129,7 @@ mkdir -p bin
|
||||
|
||||
echo ... Compiling Ant Classes
|
||||
-
|
||||
|
||||
-"${JAVAC}" $BOOTJAVAC_OPTS -d ${CLASSDIR} ${TOOLS}/bzip2/*.java ${TOOLS}/tar/*.java ${TOOLS}/zip/*.java \
|
||||
+"${JAVAC}" $BOOTJAVAC_OPTS -d ${CLASSDIR} -sourcepath src/main ${TOOLS}/bzip2/*.java ${TOOLS}/tar/*.java ${TOOLS}/zip/*.java \
|
||||
${TOOLS}/ant/util/regexp/RegexpMatcher.java \
|
||||
${TOOLS}/ant/util/regexp/RegexpMatcherFactory.java \
|
||||
${TOOLS}/ant/property/*.java \
|
||||
${TOOLS}/ant/util/regexp/RegexpMatcher.java \
|
||||
${TOOLS}/ant/util/regexp/RegexpMatcherFactory.java \
|
||||
${TOOLS}/ant/property/*.java \
|
||||
|
@@ -2,13 +2,13 @@ Index: build.xml
|
||||
===================================================================
|
||||
--- build.xml.orig
|
||||
+++ build.xml
|
||||
@@ -717,10 +717,6 @@
|
||||
@@ -724,10 +724,6 @@
|
||||
<include name="LICENSE.txt"/>
|
||||
<include name="NOTICE.txt"/>
|
||||
</metainf>
|
||||
- <manifest>
|
||||
- <attribute name="Class-Path"
|
||||
- value="ant.jar xalan.jar"/>
|
||||
- value="ant.jar xalan.jar"/>
|
||||
- </manifest>
|
||||
</jar>
|
||||
|
||||
|
@@ -2,16 +2,16 @@
|
||||
build.xml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: apache-ant-1.9.2/build.xml
|
||||
Index: apache-ant-1.9.10/build.xml
|
||||
===================================================================
|
||||
--- apache-ant-1.9.2.orig/build.xml
|
||||
+++ apache-ant-1.9.2/build.xml
|
||||
@@ -873,7 +873,7 @@
|
||||
--- apache-ant-1.9.10.orig/build.xml
|
||||
+++ apache-ant-1.9.10/build.xml
|
||||
@@ -878,7 +878,7 @@
|
||||
Create the essential distribution that can run Apache Ant
|
||||
===================================================================
|
||||
-->
|
||||
<target name="dist-lite"
|
||||
- depends="jars,test-jar"
|
||||
+ depends="jars"
|
||||
description="--> creates a minimum distribution to run Apache Ant">
|
||||
- <target name="dist-lite" depends="jars,test-jar"
|
||||
+ <target name="dist-lite" depends="jars"
|
||||
description="--> creates a minimum distribution to run Apache Ant">
|
||||
|
||||
<mkdir dir="${dist.dir}"/>
|
||||
|
@@ -1,141 +0,0 @@
|
||||
commit 7c6c749c952153170e82b791d97086e99fe2a3cb
|
||||
Author: Stefan Bodewig <bodewig@apache.org>
|
||||
Date: Mon May 8 18:44:07 2017 +0200
|
||||
|
||||
add magic property that override's tstamp's idea of "now"
|
||||
|
||||
https://bz.apache.org/bugzilla/show_bug.cgi?id=61079
|
||||
|
||||
diff --git a/manual/Tasks/tstamp.html b/manual/Tasks/tstamp.html
|
||||
index 82812a579..6baa0c882 100644
|
||||
--- a/manual/Tasks/tstamp.html
|
||||
+++ b/manual/Tasks/tstamp.html
|
||||
@@ -40,6 +40,12 @@
|
||||
to indicate, for example, the release date. The best place for this task is
|
||||
probably in an initialization target.</p>
|
||||
|
||||
+<p><em>Since Ant 1.9.10</em> the magic
|
||||
+ property <code>ant.tstamp.now</code> can be used to specify a fixed
|
||||
+ date value in order to create reproducible builds. Its value must be
|
||||
+ a number and is interpreted as seconds since the epoch (midnight
|
||||
+ 1970-01-01).</p>
|
||||
+
|
||||
<h3>Parameters</h3>
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
diff --git a/manual/running.html b/manual/running.html
|
||||
index 529afc7dc..3bfb500c8 100644
|
||||
--- a/manual/running.html
|
||||
+++ b/manual/running.html
|
||||
@@ -485,6 +485,11 @@
|
||||
<a href="argumentprocessor.html#repository">ArgumentProcessor internal repository</a>.
|
||||
</td>
|
||||
</tr>
|
||||
+<tr>
|
||||
+ <td><code>ant.tstamp.now</code></td>
|
||||
+ <td>number, seconds since the epoch (midnight 1970-01-01)</td>
|
||||
+ <td>The value to use as current time and date for <tstamp></td>
|
||||
+</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
diff --git a/src/main/org/apache/tools/ant/MagicNames.java b/src/main/org/apache/tools/ant/MagicNames.java
|
||||
index bc39a2578..67ab8a810 100644
|
||||
--- a/src/main/org/apache/tools/ant/MagicNames.java
|
||||
+++ b/src/main/org/apache/tools/ant/MagicNames.java
|
||||
@@ -289,5 +289,18 @@ public final class MagicNames {
|
||||
* Value {@value}
|
||||
*/
|
||||
public static final String HTTP_AGENT_PROPERTY = "ant.http.agent";
|
||||
+
|
||||
+ /**
|
||||
+ * Magic property that can be set to contain a value for tstamp's
|
||||
+ * "now" in order to make builds that use the task create
|
||||
+ * reproducible results.
|
||||
+ *
|
||||
+ * <p>The value is expected to be a number representing the date
|
||||
+ * as seconds since the epoch.</p>
|
||||
+ *
|
||||
+ * Value: {@value}
|
||||
+ * @since Ant 1.9.10
|
||||
+ */
|
||||
+ public static final String TSTAMP_NOW = "ant.tstamp.now";
|
||||
}
|
||||
|
||||
diff --git a/src/main/org/apache/tools/ant/taskdefs/Tstamp.java b/src/main/org/apache/tools/ant/taskdefs/Tstamp.java
|
||||
index 805427aba..a6a35d7b4 100644
|
||||
--- a/src/main/org/apache/tools/ant/taskdefs/Tstamp.java
|
||||
+++ b/src/main/org/apache/tools/ant/taskdefs/Tstamp.java
|
||||
@@ -32,6 +32,7 @@ import java.util.Vector;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Location;
|
||||
+import org.apache.tools.ant.MagicNames;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.Task;
|
||||
import org.apache.tools.ant.types.EnumeratedAttribute;
|
||||
@@ -68,7 +69,7 @@ public class Tstamp extends Task {
|
||||
*/
|
||||
public void execute() throws BuildException {
|
||||
try {
|
||||
- Date d = new Date();
|
||||
+ Date d = getNow();
|
||||
|
||||
Enumeration i = customFormats.elements();
|
||||
while (i.hasMoreElements()) {
|
||||
@@ -110,6 +111,22 @@ public class Tstamp extends Task {
|
||||
}
|
||||
|
||||
/**
|
||||
+ * Return the {@link Date} instance to use as base for DSTAMP, TSTAMP and TODAY.
|
||||
+ */
|
||||
+ protected Date getNow() {
|
||||
+ String magicNow = getProject().getProperty(MagicNames.TSTAMP_NOW);
|
||||
+ if (magicNow != null && magicNow.length() > 0) {
|
||||
+ try {
|
||||
+ return new Date(1000 * Long.parseLong(magicNow));
|
||||
+ } catch (NumberFormatException ex) {
|
||||
+ log("magic property " + MagicNames.TSTAMP_NOW + " ignored as "
|
||||
+ + magicNow + " is not a valid number");
|
||||
+ }
|
||||
+ }
|
||||
+ return new Date();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
* This nested element that allows a property to be set
|
||||
* to the current date and time in a given format.
|
||||
* The date/time patterns are as defined in the
|
||||
diff --git a/src/tests/antunit/taskdefs/tstamp-test.xml b/src/tests/antunit/taskdefs/tstamp-test.xml
|
||||
new file mode 100644
|
||||
index 000000000..c9bebf866
|
||||
--- /dev/null
|
||||
+++ b/src/tests/antunit/taskdefs/tstamp-test.xml
|
||||
@@ -0,0 +1,27 @@
|
||||
+<?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 default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
|
||||
+ <import file="../antunit-base.xml" />
|
||||
+
|
||||
+ <target name="testMagicProperty">
|
||||
+ <local name="ant.tstamp.now"/>
|
||||
+ <property name="ant.tstamp.now" value="100000"/>
|
||||
+ <tstamp/>
|
||||
+ <au:assertPropertyEquals name="DSTAMP" value="19700102"/>
|
||||
+ </target>
|
||||
+</project>
|
Reference in New Issue
Block a user