aboutsummaryrefslogtreecommitdiffstats
path: root/anttasks/src/com
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2012-11-19 13:59:43 -0800
committerRaphael Moll <ralf@android.com>2012-11-19 14:05:06 -0800
commit9093160c8aa3e3832c4db09f57f640055b964bdb (patch)
tree25555f06a16287c22c3e200cb89613a6296e9e30 /anttasks/src/com
parent4b6971ed181e871d5ec812dbe5c799a7b1c7dc3a (diff)
downloadsdk-9093160c8aa3e3832c4db09f57f640055b964bdb.zip
sdk-9093160c8aa3e3832c4db09f57f640055b964bdb.tar.gz
sdk-9093160c8aa3e3832c4db09f57f640055b964bdb.tar.bz2
TaskHelper: properly parse Pkg.Revision property.
SDK Bug: 36987 Bug was that TaskHelper would fail when parsing a pk revision with an RC value. A quick fix was done in CL 6d266a1bf5992d27fff4400c5d2bd30681c65c3d a while ago. Revisit the fix by using the new FullRevision object to parse the value and create a DeweyDecimal; should avoid us trouble if we later change the format. Change-Id: I5ad1449ebd2606255c27485e60b714b5cf83a308
Diffstat (limited to 'anttasks/src/com')
-rw-r--r--anttasks/src/com/android/ant/TaskHelper.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/anttasks/src/com/android/ant/TaskHelper.java b/anttasks/src/com/android/ant/TaskHelper.java
index fe154cf..43ea33a 100644
--- a/anttasks/src/com/android/ant/TaskHelper.java
+++ b/anttasks/src/com/android/ant/TaskHelper.java
@@ -22,6 +22,8 @@ import com.android.annotations.Nullable;
import com.android.sdklib.internal.project.ProjectProperties;
import com.android.sdklib.internal.project.ProjectProperties.PropertyType;
import com.android.sdklib.internal.project.ProjectPropertiesWorkingCopy;
+import com.android.sdklib.internal.repository.packages.FullRevision;
+import com.android.sdklib.repository.PkgProps;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -91,19 +93,17 @@ final class TaskHelper {
}
}
- String value = p.getProperty("Pkg.Revision"); //$NON-NLS-1$
+ String value = p.getProperty(PkgProps.PKG_REVISION);
if (value != null) {
- value = value.trim();
- int space = value.indexOf(' ');
- if (space != -1) {
- value = value.substring(0, space);
- }
- return new DeweyDecimal(value);
+ FullRevision rev = FullRevision.parseRevision(value);
+ return new DeweyDecimal(rev.toIntArray(false /*includePreview*/));
}
+ } catch (NumberFormatException e) {
+ // couldn't parse the version number.
} catch (FileNotFoundException e) {
- // couldn't find the file? return -1 below.
+ // couldn't find the file.
} catch (IOException e) {
- // couldn't find the file? return -1 below.
+ // couldn't find the file.
}
return null;