MCPcopy Create free account
hub / github.com/CyanogenMod/android_frameworks_base / doPackage

Function doPackage

tools/aapt/Command.cpp:1877–2110  ·  view source on GitHub ↗

* Package up an asset directory and associated application files. */

Source from the content-addressed store, hash-verified

1875 * Package up an asset directory and associated application files.
1876 */
1877int doPackage(Bundle* bundle)
1878{
1879 const char* outputAPKFile;
1880 int retVal = 1;
1881 status_t err;
1882 sp<AaptAssets> assets;
1883 int N;
1884 FILE* fp;
1885 String8 dependencyFile;
1886
1887 // -c zz_ZZ means do pseudolocalization
1888 ResourceFilter filter;
1889 err = filter.parse(bundle->getConfigurations());
1890 if (err != NO_ERROR) {
1891 goto bail;
1892 }
1893 if (filter.containsPseudo()) {
1894 bundle->setPseudolocalize(true);
1895 }
1896
1897 N = bundle->getFileSpecCount();
1898 if (N < 1 && bundle->getResourceSourceDirs().size() == 0 && bundle->getJarFiles().size() == 0
1899 && bundle->getAndroidManifestFile() == NULL && bundle->getAssetSourceDir() == NULL) {
1900 fprintf(stderr, "ERROR: no input files\n");
1901 goto bail;
1902 }
1903
1904 outputAPKFile = bundle->getOutputAPKFile();
1905
1906 // Make sure the filenames provided exist and are of the appropriate type.
1907 if (outputAPKFile) {
1908 FileType type;
1909 type = getFileType(outputAPKFile);
1910 if (type != kFileTypeNonexistent && type != kFileTypeRegular) {
1911 fprintf(stderr,
1912 "ERROR: output file '%s' exists but is not regular file\n",
1913 outputAPKFile);
1914 goto bail;
1915 }
1916 }
1917
1918 // Load the assets.
1919 assets = new AaptAssets();
1920
1921 // Set up the resource gathering in assets if we're going to generate
1922 // dependency files. Every time we encounter a resource while slurping
1923 // the tree, we'll add it to these stores so we have full resource paths
1924 // to write to a dependency file.
1925 if (bundle->getGenDependencies()) {
1926 sp<FilePathStore> resPathStore = new FilePathStore;
1927 assets->setFullResPaths(resPathStore);
1928 sp<FilePathStore> assetPathStore = new FilePathStore;
1929 assets->setFullAssetPaths(assetPathStore);
1930 }
1931
1932 err = assets->slurpFromArgs(bundle);
1933 if (err < 0) {
1934 goto bail;

Callers 1

handleCommandFunction · 0.85

Calls 15

buildResourcesFunction · 0.85
writeResourceSymbolsFunction · 0.85
writeProguardFileFunction · 0.85
writeResFileFDFunction · 0.85
writeResFileFunction · 0.85
writeAPKFunction · 0.85
writeDependencyPreReqsFunction · 0.85
containsPseudoMethod · 0.80
setPseudolocalizeMethod · 0.80
getFileSpecCountMethod · 0.80
getAssetSourceDirMethod · 0.80

Tested by

no test coverage detected