summaryrefslogtreecommitdiff
path: root/tools/aapt/Command.cpp
diff options
context:
space:
mode:
author Xavier Ducrohet <xav@android.com> 2011-07-20 15:27:39 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2011-07-20 15:27:39 -0700
commit2c311be720341e3249887e592bbc1881008b02bd (patch)
tree42355e81f98af1743af7e0c4a70e50d5af4fcdd4 /tools/aapt/Command.cpp
parentba6c98db8f21016f81ecac35bb0ea3c433044bb7 (diff)
parent3082449508a8c574d0476fdb988f98d9554637ae (diff)
am 30824495: am 1e24ccbd: Merge "Add generation of dependency file for .ap_ package"
* commit '3082449508a8c574d0476fdb988f98d9554637ae': Add generation of dependency file for .ap_ package
Diffstat (limited to 'tools/aapt/Command.cpp')
-rw-r--r--tools/aapt/Command.cpp45
1 files changed, 27 insertions, 18 deletions
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 89f45df1b853..8447d7436d5b 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -1390,10 +1390,13 @@ int doPackage(Bundle* bundle)
// Load the assets.
assets = new AaptAssets();
- // Set up the resource gathering in assets if we're trying to make R.java
+ // Set up the resource gathering in assets if we're going to generate
+ // dependency files
if (bundle->getGenDependencies()) {
- sp<FilePathStore> pathStore = new FilePathStore;
- assets->setFullResPaths(pathStore);
+ sp<FilePathStore> resPathStore = new FilePathStore;
+ assets->setFullResPaths(resPathStore);
+ sp<FilePathStore> assetPathStore = new FilePathStore;
+ assets->setFullAssetPaths(assetPathStore);
}
err = assets->slurpFromArgs(bundle);
@@ -1420,9 +1423,16 @@ int doPackage(Bundle* bundle)
}
if (bundle->getGenDependencies()) {
- dependencyFile = String8(bundle->getRClassDir());
+ if (outputAPKFile) {
+ dependencyFile = String8(outputAPKFile);
+ // Strip the extension and add new one
+ dependencyFile = dependencyFile.getBasePath();
+ dependencyFile.append(".d");
+ } else {
+ dependencyFile = String8(bundle->getRClassDir());
+ dependencyFile.appendPath("R.d");
+ }
// Make sure we have a clean dependency file to start with
- dependencyFile.appendPath("R.d");
fp = fopen(dependencyFile, "w");
fclose(fp);
}
@@ -1460,19 +1470,6 @@ int doPackage(Bundle* bundle)
}
}
- if (bundle->getGenDependencies()) {
- // Now that writeResourceSymbols has taken care of writing the
- // dependency targets to the dependencyFile, we'll write the
- // pre-requisites.
- fp = fopen(dependencyFile, "a+");
- fprintf(fp, " : ");
- err = writeDependencyPreReqs(bundle, assets, fp);
-
- // Also manually add the AndroidManifeset since it's a non-asset
- fprintf(fp, "%s \\\n", bundle->getAndroidManifestFile());
- fclose(fp);
- }
-
// Write out the ProGuard file
err = writeProguardFile(bundle, assets);
if (err < 0) {
@@ -1488,6 +1485,18 @@ int doPackage(Bundle* bundle)
}
}
+ if (bundle->getGenDependencies()) {
+ // Now that writeResourceSymbols or writeAPK has taken care of writing
+ // the targets to our dependency file, we'll write the prereqs
+ fp = fopen(dependencyFile, "a+");
+ fprintf(fp, " : ");
+ bool includeRaw = (outputAPKFile != NULL);
+ err = writeDependencyPreReqs(bundle, assets, fp, includeRaw);
+ // Also manually add the AndroidManifeset since it's a non-asset
+ fprintf(fp, "%s \\\n", bundle->getAndroidManifestFile());
+ fclose(fp);
+ }
+
retVal = 0;
bail:
if (SourcePos::hasErrors()) {