From a6324a21d1912144ed4e468ab5e127169992ab6e Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Mon, 25 Oct 2010 14:24:09 -0700 Subject: Fix external jar support when building with proguard. Change-Id: I3dafb284770f475d70a212cbe22cdae6bff36ff7 --- anttasks/src/com/android/ant/IfElseTask.java | 41 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'anttasks') 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 * - * + * + * + * ... + * * * * @@ -43,6 +45,7 @@ import org.apache.tools.ant.taskdefs.condition.IsSet; * * * both and behave like . + * behaves like an condition. * * The presence of both and is not required, but one of them must be present. * @@ -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 node which is basically a . + */ + public Object createCondition() { if (mConditionIsSet) { - throw new BuildException("Cannot use both condition and isset attribute"); + throw new BuildException("Cannot use both condition attribute and 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. -- cgit v1.1