// 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);
}
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);
}
}
}
- 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) {
}
}
+ 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()) {
}
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;
+}