diff options
author | Xavier Ducrohet <xav@android.com> | 2011-08-18 14:51:43 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-08-18 14:51:43 -0700 |
commit | 1797d6086f9acbea582cac6d484e749abafa1868 (patch) | |
tree | 4b1af23c311a9e261d3494d9b6b0bcb54550c9a6 /tools | |
parent | 6ccadb04a42703f8d6f51db5ada034ed01a48afa (diff) | |
parent | d98e1be20e1cca5c36c7e0344500d4a5574568aa (diff) | |
download | frameworks_base-1797d6086f9acbea582cac6d484e749abafa1868.zip frameworks_base-1797d6086f9acbea582cac6d484e749abafa1868.tar.gz frameworks_base-1797d6086f9acbea582cac6d484e749abafa1868.tar.bz2 |
am d98e1be2: am f4750724: am 9d829f98: am 21e6e2de: Merge "Change generated dependency file names"
* commit 'd98e1be20e1cca5c36c7e0344500d4a5574568aa':
Change generated dependency file names
Diffstat (limited to 'tools')
-rw-r--r-- | tools/aapt/Command.cpp | 29 | ||||
-rw-r--r-- | tools/aapt/Package.cpp | 9 | ||||
-rw-r--r-- | tools/aapt/Resource.cpp | 4 |
3 files changed, 33 insertions, 9 deletions
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index daf53e0..178e7fd 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -1546,7 +1546,9 @@ int doPackage(Bundle* bundle) assets = new AaptAssets(); // Set up the resource gathering in assets if we're going to generate - // dependency files + // dependency files. Every time we encounter a resource while slurping + // the tree, we'll add it to these stores so we have full resource paths + // to write to a dependency file. if (bundle->getGenDependencies()) { sp<FilePathStore> resPathStore = new FilePathStore; assets->setFullResPaths(resPathStore); @@ -1577,15 +1579,20 @@ int doPackage(Bundle* bundle) goto bail; } + // If we've been asked to generate a dependency file, do that here if (bundle->getGenDependencies()) { + // If this is the packaging step, generate the dependency file next to + // the output apk (e.g. bin/resources.ap_.d) if (outputAPKFile) { dependencyFile = String8(outputAPKFile); - // Strip the extension and add new one - dependencyFile = dependencyFile.getBasePath(); + // Add the .d extension to the dependency file. dependencyFile.append(".d"); } else { + // Else if this is the R.java dependency generation step, + // generate the dependency file in the R.java package subdirectory + // e.g. gen/com/foo/app/R.java.d dependencyFile = String8(bundle->getRClassDir()); - dependencyFile.appendPath("R.d"); + dependencyFile.appendPath("R.java.d"); } // Make sure we have a clean dependency file to start with fp = fopen(dependencyFile, "w"); @@ -1595,13 +1602,18 @@ int doPackage(Bundle* bundle) // Write out R.java constants if (assets->getPackage() == assets->getSymbolsPrivatePackage()) { if (bundle->getCustomPackage() == NULL) { + // Write the R.java file into the appropriate class directory + // e.g. gen/com/foo/app/R.java err = writeResourceSymbols(bundle, assets, assets->getPackage(), true); - // Copy R.java for libraries + // If we have library files, we're going to write our R.java file into + // the appropriate class directory for those libraries as well. + // e.g. gen/com/foo/app/lib/R.java if (bundle->getExtraPackages() != NULL) { // Split on colon String8 libs(bundle->getExtraPackages()); char* packageString = strtok(libs.lockBuffer(libs.length()), ":"); while (packageString != NULL) { + // Write the R.java file out with the correct package name err = writeResourceSymbols(bundle, assets, String8(packageString), true); packageString = strtok(NULL, ":"); } @@ -1640,6 +1652,10 @@ int doPackage(Bundle* bundle) } } + // If we've been asked to generate a dependency file, we need to finish up here. + // the writeResourceSymbols and writeAPK functions have already written the target + // half of the dependency file, now we need to write the prerequisites. (files that + // the R.java file or .ap_ file depend on) if (bundle->getGenDependencies()) { // Now that writeResourceSymbols or writeAPK has taken care of writing // the targets to our dependency file, we'll write the prereqs @@ -1647,7 +1663,8 @@ int doPackage(Bundle* bundle) fprintf(fp, " : "); bool includeRaw = (outputAPKFile != NULL); err = writeDependencyPreReqs(bundle, assets, fp, includeRaw); - // Also manually add the AndroidManifeset since it's a non-asset + // Also manually add the AndroidManifeset since it's not under res/ or assets/ + // and therefore was not added to our pathstores during slurping fprintf(fp, "%s \\\n", bundle->getAndroidManifestFile()); fclose(fp); } diff --git a/tools/aapt/Package.cpp b/tools/aapt/Package.cpp index c9f6870..1e3efde 100644 --- a/tools/aapt/Package.cpp +++ b/tools/aapt/Package.cpp @@ -177,12 +177,17 @@ status_t writeAPK(Bundle* bundle, const sp<AaptAssets>& assets, } } + // If we've been asked to generate a dependency file for the .ap_ package, + // do so here if (bundle->getGenDependencies()) { - // Add this file to the dependency file - String8 dependencyFile = outputFile.getBasePath(); + // The dependency file gets output to the same directory + // as the specified output file with an additional .d extension. + // e.g. bin/resources.ap_.d + String8 dependencyFile = outputFile; dependencyFile.append(".d"); FILE* fp = fopen(dependencyFile.string(), "a"); + // Add this file to the dependency file fprintf(fp, "%s \\\n", outputFile.string()); fclose(fp); } diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index cb6484f..2e796a2 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -1958,10 +1958,12 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets, } fclose(fp); + // If we were asked to generate a dependency file, we'll go ahead and add this R.java + // as a target in the dependency file right next to it. if (bundle->getGenDependencies()) { // Add this R.java to the dependency file String8 dependencyFile(bundle->getRClassDir()); - dependencyFile.appendPath("R.d"); + dependencyFile.appendPath("R.java.d"); fp = fopen(dependencyFile.string(), "a"); fprintf(fp,"%s \\\n", dest.string()); |