|
|
@@ -55,6 +55,7 @@ |
|
|
|
package org.apache.tools.ant.taskdefs; |
|
|
|
|
|
|
|
import org.apache.tools.ant.*; |
|
|
|
import org.apache.tools.ant.types.Reference; |
|
|
|
import java.io.*; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
@@ -72,6 +73,7 @@ public class Property extends Task { |
|
|
|
String value; |
|
|
|
File file; |
|
|
|
String resource; |
|
|
|
private Reference ref = null; |
|
|
|
|
|
|
|
boolean userProperty=false; // set read-only properties |
|
|
|
|
|
|
@@ -99,6 +101,14 @@ public class Property extends Task { |
|
|
|
return file; |
|
|
|
} |
|
|
|
|
|
|
|
public void setRefid(Reference ref) { |
|
|
|
this.ref = ref; |
|
|
|
} |
|
|
|
|
|
|
|
public Reference getRefid() { |
|
|
|
return ref; |
|
|
|
} |
|
|
|
|
|
|
|
public void setResource(String resource) { |
|
|
|
this.resource = resource; |
|
|
|
} |
|
|
@@ -107,6 +117,10 @@ public class Property extends Task { |
|
|
|
return resource; |
|
|
|
} |
|
|
|
|
|
|
|
public String toString() { |
|
|
|
return value == null ? "" : value; |
|
|
|
} |
|
|
|
|
|
|
|
public void execute() throws BuildException { |
|
|
|
try { |
|
|
|
if ((name != null) && (value != null)) { |
|
|
@@ -117,6 +131,13 @@ public class Property extends Task { |
|
|
|
|
|
|
|
if (resource != null) loadResource(resource); |
|
|
|
|
|
|
|
if ((name != null) && (ref != null)) { |
|
|
|
Object obj = ref.getReferencedObject(getProject()); |
|
|
|
if (obj != null) { |
|
|
|
addProperty(name, obj.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
throw new BuildException(e, location); |
|
|
|
} |
|
|
|