aboutsummaryrefslogtreecommitdiffstats
path: root/anttasks/src
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-02-16 17:55:41 -0800
committerXavier Ducrohet <xav@android.com>2010-02-16 18:16:47 -0800
commitf1c91b975dd94f5ee77100d5695c2e2243d65b31 (patch)
treec0caf0788a8d9f675d32eedec242e255ddf5ece3 /anttasks/src
parent3e4e3d908df5f90d2249a5855a73160fcb65e043 (diff)
downloadsdk-f1c91b975dd94f5ee77100d5695c2e2243d65b31.zip
sdk-f1c91b975dd94f5ee77100d5695c2e2243d65b31.tar.gz
sdk-f1c91b975dd94f5ee77100d5695c2e2243d65b31.tar.bz2
Check whether the project's target supports libraries.
Check is done when: - a library is added to a project through "android update project" - a project is compiled through Ant Change-Id: I09993b9aac5ad32a84335647429fc52fa2babaf9
Diffstat (limited to 'anttasks/src')
-rw-r--r--anttasks/src/com/android/ant/SetupTask.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/anttasks/src/com/android/ant/SetupTask.java b/anttasks/src/com/android/ant/SetupTask.java
index bf6a162..790c068 100644
--- a/anttasks/src/com/android/ant/SetupTask.java
+++ b/anttasks/src/com/android/ant/SetupTask.java
@@ -167,7 +167,7 @@ public final class SetupTask extends ImportTask {
}
// look for referenced libraries.
- processReferencedLibraries(antProject);
+ processReferencedLibraries(antProject, androidTarget);
// display it
System.out.println("Project Target: " + androidTarget.getName());
@@ -354,7 +354,7 @@ public final class SetupTask extends ImportTask {
}
}
- private void processReferencedLibraries(Project antProject) {
+ private void processReferencedLibraries(Project antProject, IAndroidTarget androidTarget) {
// prepare several paths for future tasks
Path sourcePath = new Path(antProject);
Path resPath = new Path(antProject);
@@ -368,6 +368,10 @@ public final class SetupTask extends ImportTask {
}
};
+ // get the build version for the current target. It'll be tested if there's at least
+ // one library.
+ int antBuildVersion = androidTarget.getAntBuildRevision();
+
int index = 1;
while (true) {
String propName = ProjectProperties.PROPERTY_LIB_REF + Integer.toString(index++);
@@ -377,6 +381,12 @@ public final class SetupTask extends ImportTask {
break;
}
+ if (antBuildVersion < SdkConstants.ANT_REV_LIBRARY) {
+ throw new BuildException(String.format(
+ "The build system for this project target (%1$s) does not support libraries",
+ androidTarget.getFullName()));
+ }
+
// get the source path. default is src but can be overriden by the property
// "source.dir" in build.properties.
PathElement element = sourcePath.createPathElement();