aboutsummaryrefslogtreecommitdiffstats
path: root/anttasks
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-10-25 14:24:09 -0700
committerXavier Ducrohet <xav@android.com>2010-10-25 14:55:32 -0700
commita6324a21d1912144ed4e468ab5e127169992ab6e (patch)
tree4c4f64eb46203d9f1965b3b2611968bb78cbdd80 /anttasks
parent76e0b61e01de334ec13a48b5c2ce6d81707e743d (diff)
downloadsdk-a6324a21d1912144ed4e468ab5e127169992ab6e.zip
sdk-a6324a21d1912144ed4e468ab5e127169992ab6e.tar.gz
sdk-a6324a21d1912144ed4e468ab5e127169992ab6e.tar.bz2
Fix external jar support when building with proguard.
Change-Id: I3dafb284770f475d70a212cbe22cdae6bff36ff7
Diffstat (limited to 'anttasks')
-rw-r--r--anttasks/src/com/android/ant/IfElseTask.java41
1 files changed, 21 insertions, 20 deletions
diff --git a/anttasks/src/com/android/ant/IfElseTask.java b/anttasks/src/com/android/ant/IfElseTask.java
index 0a59466..f34e486 100644
--- a/anttasks/src/com/android/ant/IfElseTask.java
+++ b/anttasks/src/com/android/ant/IfElseTask.java
@@ -17,10 +17,9 @@
package com.android.ant;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Sequential;
-import org.apache.tools.ant.taskdefs.condition.IsSet;
+import org.apache.tools.ant.taskdefs.condition.And;
/**
* If (condition) then: {@link Sequential} else: {@link Sequential}.
@@ -35,7 +34,10 @@ import org.apache.tools.ant.taskdefs.condition.IsSet;
*
* or
*
- * <if isset="propertyname">
+ * <if>
+ * <condition>
+ * ...
+ * </condition>
* <then>
* </then>
* <else>
@@ -43,6 +45,7 @@ import org.apache.tools.ant.taskdefs.condition.IsSet;
* </if>
*
* both <then> and <else> behave like <sequential>.
+ * <condition> behaves like an <and> condition.
*
* The presence of both <then> and <else> is not required, but one of them must be present.
* <if condition="${some.condition}">
@@ -56,6 +59,7 @@ public class IfElseTask extends Task {
private boolean mCondition;
private boolean mConditionIsSet = false;
+ private And mAnd;
private Sequential mThen;
private Sequential mElse;
@@ -63,28 +67,21 @@ public class IfElseTask extends Task {
* Sets the condition value
*/
public void setCondition(boolean condition) {
- if (mConditionIsSet) {
- throw new BuildException("Cannot use both condition and isset attribute");
- }
-
mCondition = condition;
mConditionIsSet = true;
}
- public void setIsset(String name) {
+ /**
+ * Creates and returns the <condition> node which is basically a <and>.
+ */
+ public Object createCondition() {
if (mConditionIsSet) {
- throw new BuildException("Cannot use both condition and isset attribute");
+ throw new BuildException("Cannot use both condition attribute and <condition> element");
}
- Project antProject = getProject();
-
- // use Isset to ensure the implementation is correct
- IsSet isSet = new IsSet();
- isSet.setProject(antProject);
- isSet.setProperty(name);
-
- mCondition = isSet.eval();
- mConditionIsSet = true;
+ mAnd = new And();
+ mAnd.setProject(getProject());
+ return mAnd;
}
/**
@@ -105,8 +102,12 @@ public class IfElseTask extends Task {
@Override
public void execute() throws BuildException {
- if (mConditionIsSet == false) {
- throw new BuildException("condition or isset attribute is missing");
+ if (mConditionIsSet == false && mAnd == null) {
+ throw new BuildException("condition attribute or element must be set.");
+ }
+
+ if (mAnd != null) {
+ mCondition = mAnd.eval();
}
// need at least one.