aboutsummaryrefslogtreecommitdiffstats
path: root/anttasks/src/com/android/ant/AaptExecLoopTask.java
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-02-14 15:52:12 -0800
committerXavier Ducrohet <xav@android.com>2011-08-17 16:09:14 -0700
commitbabf25ca7162849f0145f75be1b6c09b359b122c (patch)
treec03538b2c6bc29e507b42d35cfe4642a804fed93 /anttasks/src/com/android/ant/AaptExecLoopTask.java
parent168e27a3d37e983726a82e66950f03926e7ea52f (diff)
downloadsdk-babf25ca7162849f0145f75be1b6c09b359b122c.zip
sdk-babf25ca7162849f0145f75be1b6c09b359b122c.tar.gz
sdk-babf25ca7162849f0145f75be1b6c09b359b122c.tar.bz2
New library project mechanism.
Libraries now generate a jar file that is used by the projects referencing them, instead of having the main projects compile the library source code themselves. This means we can remove the link mechanism that created linked folder in ADT and instead use a container that is lazily initalized to be all the jar files of the libraries. Also merged all 3 Ant build files (main_rules, lib_rules, test_rules) into a single build.xml that can build any kind of projects. Lot's of improvement in there too. Much cleaner. Change-Id: I98307e25cd76722e8595938528e6ef57a7e226ad
Diffstat (limited to 'anttasks/src/com/android/ant/AaptExecLoopTask.java')
-rw-r--r--anttasks/src/com/android/ant/AaptExecLoopTask.java30
1 files changed, 26 insertions, 4 deletions
diff --git a/anttasks/src/com/android/ant/AaptExecLoopTask.java b/anttasks/src/com/android/ant/AaptExecLoopTask.java
index ebefde5..6b438bb 100644
--- a/anttasks/src/com/android/ant/AaptExecLoopTask.java
+++ b/anttasks/src/com/android/ant/AaptExecLoopTask.java
@@ -88,6 +88,8 @@ public final class AaptExecLoopTask extends BaseTask {
private String mResourceFilter;
private String mRFolder;
private final ArrayList<NoCompress> mNoCompressList = new ArrayList<NoCompress>();
+ private String mProjectLibrariesResName;
+ private String mProjectLibrariesPackageName;
/**
* Sets the value of the "executable" attribute.
@@ -235,6 +237,15 @@ public final class AaptExecLoopTask extends BaseTask {
}
}
+ public void setProjectLibrariesResName(String projectLibrariesResName) {
+ mProjectLibrariesResName = projectLibrariesResName;
+ }
+
+ public void setProjectLibrariesPackageName(String projectLibrariesPackageName) {
+ mProjectLibrariesPackageName = projectLibrariesPackageName;
+ }
+
+
/**
* Returns an object representing a nested <var>nocompress</var> element.
*/
@@ -268,6 +279,13 @@ public final class AaptExecLoopTask extends BaseTask {
*/
@Override
public void execute() throws BuildException {
+ if (mProjectLibrariesResName == null) {
+ throw new BuildException("Missing attribute projectLibrariesResName");
+ }
+ if (mProjectLibrariesPackageName == null) {
+ throw new BuildException("Missing attribute projectLibrariesPackageName");
+ }
+
Project taskProject = getProject();
String libPkgProp = null;
@@ -275,7 +293,7 @@ public final class AaptExecLoopTask extends BaseTask {
// if the parameters indicate generation of the R class, check if
// more R classes need to be created for libraries.
if (mRFolder != null && new File(mRFolder).isDirectory()) {
- libPkgProp = taskProject.getProperty(AntConstants.PROP_PROJECT_LIBS_PKG);
+ libPkgProp = taskProject.getProperty(mProjectLibrariesPackageName);
if (libPkgProp != null) {
// Replace ";" with ":" since that's what aapt expects
libPkgProp = libPkgProp.replace(';', ':');
@@ -285,6 +303,11 @@ public final class AaptExecLoopTask extends BaseTask {
callAapt(libPkgProp);
}
+ @Override
+ protected String getExecTaskName() {
+ return "aapt";
+ }
+
/**
* Calls aapt with the given parameters.
* @param resourceFilter the resource configuration filter to pass to aapt (if configName is
@@ -298,7 +321,7 @@ public final class AaptExecLoopTask extends BaseTask {
final boolean generateRClass = mRFolder != null && new File(mRFolder).isDirectory();
// Get whether we have libraries
- Object libResRef = taskProject.getReference(AntConstants.PROP_PROJECT_LIBS_RES_REF);
+ Object libResRef = taskProject.getReference(mProjectLibrariesResName);
// Set up our folders to check for changed files
ArrayList<File> watchPaths = new ArrayList<File>();
@@ -358,8 +381,7 @@ public final class AaptExecLoopTask extends BaseTask {
task.setExecutable(mExecutable);
task.setFailonerror(true);
- File exe = new File(mExecutable);
- task.setTaskName(exe.getName());
+ task.setTaskName(getExecTaskName());
// aapt command. Only "package" is supported at this time really.
task.createArg().setValue(mCommand);