diff options
author | Xavier Ducrohet <xav@android.com> | 2011-09-18 15:00:17 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2011-09-19 14:41:15 -0700 |
commit | 749cfb6604f4e0510e23811f5947df61ed93f6ac (patch) | |
tree | c2914b74d5d0837a2bf6d0e6888aeca3cc8f2843 /anttasks | |
parent | 9b634c7d1d288d97c25d5d38355139da5f46e0d4 (diff) | |
download | sdk-749cfb6604f4e0510e23811f5947df61ed93f6ac.zip sdk-749cfb6604f4e0510e23811f5947df61ed93f6ac.tar.gz sdk-749cfb6604f4e0510e23811f5947df61ed93f6ac.tar.bz2 |
Make sure renderscript's -target-api receives 11+
Change-Id: Id4012b8c86212b3874c0820ba9c71136083cd5f2
Diffstat (limited to 'anttasks')
-rw-r--r-- | anttasks/src/com/android/ant/RenderScriptTask.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/anttasks/src/com/android/ant/RenderScriptTask.java b/anttasks/src/com/android/ant/RenderScriptTask.java index 50284fd..8264aac 100644 --- a/anttasks/src/com/android/ant/RenderScriptTask.java +++ b/anttasks/src/com/android/ant/RenderScriptTask.java @@ -50,7 +50,7 @@ public class RenderScriptTask extends Task { private String mGenFolder; private String mResFolder; private final List<Path> mPaths = new ArrayList<Path>(); - private String mTargetApi; + private int mTargetApi = 0; /** * Sets the value of the "executable" attribute. @@ -73,7 +73,14 @@ public class RenderScriptTask extends Task { } public void setTargetApi(String targetApi) { - mTargetApi = targetApi; + try { + mTargetApi = Integer.parseInt(targetApi); + if (mTargetApi <= 0) { + throw new BuildException("targetApi attribute value must be >= 1"); + } + } catch (NumberFormatException e) { + throw new BuildException("targetApi attribute value must be an integer", e); + } } public Path createSource() { @@ -96,7 +103,7 @@ public class RenderScriptTask extends Task { if (mResFolder == null) { throw new BuildException("RenderScriptTask's 'resFolder' is required."); } - if (mTargetApi == null) { + if (mTargetApi == 0) { throw new BuildException("RenderScriptTask's 'targetApi' is required."); } @@ -116,6 +123,9 @@ public class RenderScriptTask extends Task { int count = 0; + // get the target api value. Must be 11+ or llvm-rs-cc complains. + String targetApiStr = Integer.toString(mTargetApi < 11 ? 11 : mTargetApi); + // now loop on all the source folders to find all the renderscript to compile // and compile them for (String sourceFolder : sourceFolders) { @@ -147,7 +157,7 @@ public class RenderScriptTask extends Task { } task.createArg().setValue("-target-api"); - task.createArg().setValue(mTargetApi); + task.createArg().setValue(targetApiStr); task.createArg().setValue("-p"); task.createArg().setValue(mGenFolder); |