aboutsummaryrefslogtreecommitdiffstats
path: root/anttasks/src/com/android/ant/NewSetupTask.java
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2012-01-27 17:22:11 -0800
committerXavier Ducrohet <xav@android.com>2012-01-27 18:09:10 -0800
commitec17a292857ccc0f458de06d055485e4eb8765be (patch)
treef333040dcb3c99dc1225550df31758a7742f1880 /anttasks/src/com/android/ant/NewSetupTask.java
parentd3ddd843a71f966ed256ea4c21f4b50c6fd735d2 (diff)
downloadsdk-ec17a292857ccc0f458de06d055485e4eb8765be.zip
sdk-ec17a292857ccc0f458de06d055485e4eb8765be.tar.gz
sdk-ec17a292857ccc0f458de06d055485e4eb8765be.tar.bz2
Automatically add annotations.jar on the classpath for API<=15
This is to provide app some annotations used by the tools. Those annotations will be part of the API later. Change-Id: I32b31a3039e4fbb331682a84192252bd43c0f54a
Diffstat (limited to 'anttasks/src/com/android/ant/NewSetupTask.java')
-rw-r--r--anttasks/src/com/android/ant/NewSetupTask.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/anttasks/src/com/android/ant/NewSetupTask.java b/anttasks/src/com/android/ant/NewSetupTask.java
index 46f5b14..29caf6e 100644
--- a/anttasks/src/com/android/ant/NewSetupTask.java
+++ b/anttasks/src/com/android/ant/NewSetupTask.java
@@ -20,10 +20,10 @@ import com.android.io.FileWrapper;
import com.android.io.FolderWrapper;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
+import com.android.sdklib.IAndroidTarget.IOptionalLibrary;
import com.android.sdklib.ISdkLog;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
-import com.android.sdklib.IAndroidTarget.IOptionalLibrary;
import com.android.sdklib.internal.project.ProjectProperties;
import com.android.sdklib.internal.project.ProjectProperties.PropertyType;
import com.android.sdklib.xml.AndroidManifest;
@@ -282,7 +282,7 @@ public class NewSetupTask extends Task {
}
// look for referenced libraries.
- processReferencedLibraries(antProject, androidTarget);
+ processReferencedLibraries(antProject, androidTarget, sdkOsPath);
// always check the manifest minSdkVersion.
checkManifest(antProject, androidTarget.getVersion());
@@ -436,7 +436,8 @@ public class NewSetupTask extends Task {
}
}
- private void processReferencedLibraries(Project antProject, IAndroidTarget androidTarget) {
+ private void processReferencedLibraries(Project antProject, IAndroidTarget androidTarget,
+ String sdkLocation) {
// prepare several paths for future tasks
Path rootPath = new Path(antProject);
Path resPath = new Path(antProject);
@@ -523,6 +524,17 @@ public class NewSetupTask extends Task {
System.out.println("------------------\n");
+ if (androidTarget.getVersion().getApiLevel() <= 15) {
+ System.out.println("API<=15: Adding annotations.jar to the classpath.\n");
+
+ PathElement element = jarsPath.createPathElement();
+ element.setPath(sdkLocation + "/" + SdkConstants.FD_TOOLS +
+ "/" + SdkConstants.FD_SUPPORT +
+ "/" + SdkConstants.FN_ANNOTATIONS_JAR);
+
+ System.out.println("------------------\n");
+ }
+
// even with no libraries, always setup these so that various tasks in Ant don't complain
// (the task themselves can handle a ref to an empty Path)
antProject.addReference(mProjectLibrariesJarsOut, jarsPath);