X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/4bb85b9ff958cc4bcd44f1a0c15cfda652109b80..deaaa0a632a1fccb8e09ec25b1227fc5f965c0c9:/Command.cpp?ds=inline diff --git a/Command.cpp b/Command.cpp index 903c62c..daf53e0 100644 --- a/Command.cpp +++ b/Command.cpp @@ -1545,10 +1545,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 pathStore = new FilePathStore; - assets->setFullResPaths(pathStore); + sp resPathStore = new FilePathStore; + assets->setFullResPaths(resPathStore); + sp assetPathStore = new FilePathStore; + assets->setFullAssetPaths(assetPathStore); } err = assets->slurpFromArgs(bundle); @@ -1575,9 +1578,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); } @@ -1615,19 +1625,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) { @@ -1643,6 +1640,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()) { @@ -1650,3 +1659,25 @@ bail: } return retVal; } + +/* + * Do PNG Crunching + * PRECONDITIONS + * -S flag points to a source directory containing drawable* folders + * -C flag points to destination directory. The folder structure in the + * source directory will be mirrored to the destination (cache) directory + * + * POSTCONDITIONS + * Destination directory will be updated to match the PNG files in + * the source directory. + */ +int doCrunch(Bundle* bundle) +{ + fprintf(stdout, "Crunching PNG Files in "); + fprintf(stdout, "source dir: %s\n", bundle->getResourceSourceDirs()[0]); + fprintf(stdout, "To destination dir: %s\n", bundle->getCrunchedOutputDir()); + + updatePreProcessedCache(bundle); + + return NO_ERROR; +}