You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2017/04/28 14:34:42 UTC
[1/3] ant git commit: allow for java.nio.file.Path based target
attributes
Repository: ant
Updated Branches:
refs/heads/master cec95817b -> 2ec41afdc
allow for java.nio.file.Path based target attributes
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/c5728b31
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/c5728b31
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/c5728b31
Branch: refs/heads/master
Commit: c5728b3120ddef34721677f2322b53a695a51451
Parents: cec9581
Author: Dave Brosius <db...@mebigfatguy.com>
Authored: Tue Apr 25 21:06:07 2017 -0400
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri Apr 28 16:23:13 2017 +0200
----------------------------------------------------------------------
src/main/org/apache/tools/ant/IntrospectionHelper.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/c5728b31/src/main/org/apache/tools/ant/IntrospectionHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java
index 5368042..c5fc9bf 100644
--- a/src/main/org/apache/tools/ant/IntrospectionHelper.java
+++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java
@@ -1118,6 +1118,16 @@ public final class IntrospectionHelper {
}
};
}
+ // resolve relative nio paths through Project
+ if (java.nio.file.Path.class.equals(reflectedArg)) {
+ return new AttributeSetter(m, arg) {
+ @Override
+ public void set(final Project p, final Object parent, final String value) throws InvocationTargetException, IllegalAccessException {
+ m.invoke(parent, new Object[] { p.resolveFile(value).toPath() });
+ }
+ };
+ }
+
// resolve Resources/FileProviders as FileResources relative to Project:
if (Resource.class.equals(reflectedArg) || FileProvider.class.equals(reflectedArg)) {
return new AttributeSetter(m, arg) {
[2/3] ant git commit: whitespace
Posted by bo...@apache.org.
whitespace
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/9b123a83
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/9b123a83
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/9b123a83
Branch: refs/heads/master
Commit: 9b123a83602eb7baa1a52be374f030ceb3f1657c
Parents: c5728b3
Author: Stefan Bodewig <bo...@apache.org>
Authored: Fri Apr 28 16:30:34 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri Apr 28 16:30:34 2017 +0200
----------------------------------------------------------------------
src/main/org/apache/tools/ant/IntrospectionHelper.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/9b123a83/src/main/org/apache/tools/ant/IntrospectionHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java
index c5fc9bf..59ddbb7 100644
--- a/src/main/org/apache/tools/ant/IntrospectionHelper.java
+++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java
@@ -1127,7 +1127,7 @@ public final class IntrospectionHelper {
}
};
}
-
+
// resolve Resources/FileProviders as FileResources relative to Project:
if (Resource.class.equals(reflectedArg) || FileProvider.class.equals(reflectedArg)) {
return new AttributeSetter(m, arg) {
[3/3] ant git commit: test for
https://bz.apache.org/bugzilla/show_bug.cgi?id=61042
Posted by bo...@apache.org.
test for https://bz.apache.org/bugzilla/show_bug.cgi?id=61042
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/2ec41afd
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/2ec41afd
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/2ec41afd
Branch: refs/heads/master
Commit: 2ec41afdcae5bd5346f0b840a1a3c9e467220915
Parents: 9b123a8
Author: Stefan Bodewig <bo...@apache.org>
Authored: Fri Apr 28 16:34:20 2017 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Fri Apr 28 16:34:20 2017 +0200
----------------------------------------------------------------------
WHATSNEW | 4 ++++
.../apache/tools/ant/IntrospectionHelperTest.java | 17 +++++++++++++++++
2 files changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/2ec41afd/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 93cce38..b552951 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -31,6 +31,10 @@ Other changes:
* reduced GC pressure by replacing all usage of FileInputStream and
FileOutputStream.
+ * Task can now also use attribute setters that expect a
+ java.nio.file.Path argument.
+ Bugzilla Report 61042
+
Changes from Ant 1.10.0 TO Ant 1.10.1
=====================================
http://git-wip-us.apache.org/repos/asf/ant/blob/2ec41afd/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java b/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
index ca4085d..424fb8e 100644
--- a/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
@@ -21,6 +21,8 @@ package org.apache.tools.ant;
import java.io.File;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
@@ -466,6 +468,7 @@ public class IntrospectionHelperTest {
attrMap.put("seventeen", Byte.TYPE);
attrMap.put("eightteen", Short.TYPE);
attrMap.put("nineteen", Double.TYPE);
+ attrMap.put("twenty", Path.class);
/*
* JUnit 3.7 adds a getName method to TestCase - so we now
@@ -546,6 +549,8 @@ public class IntrospectionHelperTest {
new Short((short)18), new Short((short)10));
assertAttrMethod("nineteen", "setNineteen", Double.TYPE,
new Double(19), new Double((short)10));
+ assertAttrMethod("twenty", "setTwenty", Path.class,
+ new File(projectBasedir + 20).toPath(), Paths.get("toto"));
try {
assertAttrMethod("onehundred", null, null, null, null);
@@ -634,6 +639,18 @@ public class IntrospectionHelperTest {
assertTrue("Expected 19, received " + d, diff > -1e-6 && diff < 1e-6);
}
+ public void setTwenty(Path p) {
+ String path = p.toAbsolutePath().toString();
+ if (Os.isFamily("unix") || Os.isFamily("openvms")) {
+ assertEquals(projectBasedir+"20", path);
+ } else if (Os.isFamily("netware")) {
+ assertEquals(projectBasedir+"20", path.toLowerCase(Locale.US));
+ } else {
+ assertEquals(":"+projectBasedir+"20",
+ path.toLowerCase(Locale.US).substring(1));
+ }
+ }
+
@Test
public void testGetExtensionPoints() {
List extensions = ih.getExtensionPoints();