blob: 1cf4783a8de99f24e6b8ee95cfbdced09ddfa867 [file] [log] [blame]
Adam Lesinski282e1812014-01-23 18:17:42 -08001//
2// Copyright 2006 The Android Open Source Project
3//
4// Android Asset Packaging Tool main entry point.
5//
6#include "Main.h"
7#include "Bundle.h"
8
9#include <utils/Log.h>
10#include <utils/threads.h>
11#include <utils/List.h>
12#include <utils/Errors.h>
13
14#include <stdlib.h>
15#include <getopt.h>
16#include <assert.h>
17
18using namespace android;
19
20static const char* gProgName = "aapt";
21
22/*
23 * When running under Cygwin on Windows, this will convert slash-based
24 * paths into back-slash-based ones. Otherwise the ApptAssets file comparisons
25 * fail later as they use back-slash separators under Windows.
26 *
27 * This operates in-place on the path string.
28 */
29void convertPath(char *path) {
30 if (path != NULL && OS_PATH_SEPARATOR != '/') {
31 for (; *path; path++) {
32 if (*path == '/') {
33 *path = OS_PATH_SEPARATOR;
34 }
35 }
36 }
37}
38
39/*
40 * Print usage info.
41 */
42void usage(void)
43{
44 fprintf(stderr, "Android Asset Packaging Tool\n\n");
45 fprintf(stderr, "Usage:\n");
46 fprintf(stderr,
47 " %s l[ist] [-v] [-a] file.{zip,jar,apk}\n"
48 " List contents of Zip-compatible archive.\n\n", gProgName);
49 fprintf(stderr,
50 " %s d[ump] [--values] [--include-meta-data] WHAT file.{apk} [asset [asset ...]]\n"
51 " strings Print the contents of the resource table string pool in the APK.\n"
52 " badging Print the label and icon for the app declared in APK.\n"
53 " permissions Print the permissions from the APK.\n"
54 " resources Print the resource table from the APK.\n"
55 " configurations Print the configurations in the APK.\n"
56 " xmltree Print the compiled xmls in the given assets.\n"
57 " xmlstrings Print the strings of the given compiled xml assets.\n\n", gProgName);
58 fprintf(stderr,
59 " %s p[ackage] [-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] \\\n"
60 " [-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \\\n"
61 " [--debug-mode] [--min-sdk-version VAL] [--target-sdk-version VAL] \\\n"
62 " [--app-version VAL] [--app-version-name TEXT] [--custom-package VAL] \\\n"
63 " [--rename-manifest-package PACKAGE] \\\n"
64 " [--rename-instrumentation-target-package PACKAGE] \\\n"
65 " [--utf16] [--auto-add-overlay] \\\n"
66 " [--max-res-version VAL] \\\n"
67 " [-I base-package [-I base-package ...]] \\\n"
68 " [-A asset-source-dir] [-G class-list-file] [-P public-definitions-file] \\\n"
69 " [-S resource-sources [-S resource-sources ...]] \\\n"
70 " [-F apk-file] [-J R-file-dir] \\\n"
71 " [--product product1,product2,...] \\\n"
72 " [-c CONFIGS] [--preferred-configurations CONFIGS] \\\n"
73 " [raw-files-dir [raw-files-dir] ...] \\\n"
74 " [--output-text-symbols DIR]\n"
75 "\n"
76 " Package the android resources. It will read assets and resources that are\n"
77 " supplied with the -M -A -S or raw-files-dir arguments. The -J -P -F and -R\n"
78 " options control which files are output.\n\n"
79 , gProgName);
80 fprintf(stderr,
81 " %s r[emove] [-v] file.{zip,jar,apk} file1 [file2 ...]\n"
82 " Delete specified files from Zip-compatible archive.\n\n",
83 gProgName);
84 fprintf(stderr,
85 " %s a[dd] [-v] file.{zip,jar,apk} file1 [file2 ...]\n"
86 " Add specified files to Zip-compatible archive.\n\n", gProgName);
87 fprintf(stderr,
88 " %s c[runch] [-v] -S resource-sources ... -C output-folder ...\n"
89 " Do PNG preprocessing on one or several resource folders\n"
90 " and store the results in the output folder.\n\n", gProgName);
91 fprintf(stderr,
92 " %s s[ingleCrunch] [-v] -i input-file -o outputfile\n"
93 " Do PNG preprocessing on a single file.\n\n", gProgName);
94 fprintf(stderr,
95 " %s v[ersion]\n"
96 " Print program version.\n\n", gProgName);
97 fprintf(stderr,
98 " Modifiers:\n"
99 " -a print Android-specific data (resources, manifest) when listing\n"
100 " -c specify which configurations to include. The default is all\n"
101 " configurations. The value of the parameter should be a comma\n"
102 " separated list of configuration values. Locales should be specified\n"
103 " as either a language or language-region pair. Some examples:\n"
104 " en\n"
105 " port,en\n"
106 " port,land,en_US\n"
107 " If you put the special locale, zz_ZZ on the list, it will perform\n"
108 " pseudolocalization on the default locale, modifying all of the\n"
109 " strings so you can look for strings that missed the\n"
110 " internationalization process. For example:\n"
111 " port,land,zz_ZZ\n"
112 " -d one or more device assets to include, separated by commas\n"
113 " -f force overwrite of existing files\n"
114 " -g specify a pixel tolerance to force images to grayscale, default 0\n"
115 " -j specify a jar or zip file containing classes to include\n"
116 " -k junk path of file(s) added\n"
117 " -m make package directories under location specified by -J\n"
118#if 0
119 " -p pseudolocalize the default configuration\n"
120#endif
121 " -u update existing packages (add new, replace older, remove deleted files)\n"
122 " -v verbose output\n"
123 " -x create extending (non-application) resource IDs\n"
124 " -z require localization of resource attributes marked with\n"
125 " localization=\"suggested\"\n"
126 " -A additional directory in which to find raw asset files\n"
127 " -G A file to output proguard options into.\n"
128 " -F specify the apk file to output\n"
129 " -I add an existing package to base include set\n"
130 " -J specify where to output R.java resource constant definitions\n"
131 " -M specify full path to AndroidManifest.xml to include in zip\n"
132 " -P specify where to output public resource definitions\n"
133 " -S directory in which to find resources. Multiple directories will be scanned\n"
134 " and the first match found (left to right) will take precedence.\n"
135 " -0 specifies an additional extension for which such files will not\n"
136 " be stored compressed in the .apk. An empty string means to not\n"
137 " compress any files at all.\n"
138 " --debug-mode\n"
139 " inserts android:debuggable=\"true\" in to the application node of the\n"
140 " manifest, making the application debuggable even on production devices.\n"
141 " --include-meta-data\n"
142 " when used with \"dump badging\" also includes meta-data tags.\n"
143 " --min-sdk-version\n"
144 " inserts android:minSdkVersion in to manifest. If the version is 7 or\n"
145 " higher, the default encoding for resources will be in UTF-8.\n"
146 " --target-sdk-version\n"
147 " inserts android:targetSdkVersion in to manifest.\n"
148 " --max-res-version\n"
149 " ignores versioned resource directories above the given value.\n"
150 " --values\n"
151 " when used with \"dump resources\" also includes resource values.\n"
152 " --version-code\n"
153 " inserts android:versionCode in to manifest.\n"
154 " --version-name\n"
155 " inserts android:versionName in to manifest.\n"
Jeff Davidsondf08d1c2014-02-25 12:28:08 -0800156 " --replace-version\n"
157 " If --version-code and/or --version-name are specified, these\n"
158 " values will replace any value already in the manifest. By\n"
159 " default, nothing is changed if the manifest already defines\n"
160 " these attributes.\n"
Adam Lesinski282e1812014-01-23 18:17:42 -0800161 " --custom-package\n"
162 " generates R.java into a different package.\n"
163 " --extra-packages\n"
164 " generate R.java for libraries. Separate libraries with ':'.\n"
165 " --generate-dependencies\n"
166 " generate dependency files in the same directories for R.java and resource package\n"
167 " --auto-add-overlay\n"
168 " Automatically add resources that are only in overlays.\n"
169 " --preferred-configurations\n"
170 " Like the -c option for filtering out unneeded configurations, but\n"
171 " only expresses a preference. If there is no resource available with\n"
172 " the preferred configuration then it will not be stripped.\n"
173 " --rename-manifest-package\n"
174 " Rewrite the manifest so that its package name is the package name\n"
175 " given here. Relative class names (for example .Foo) will be\n"
176 " changed to absolute names with the old package so that the code\n"
177 " does not need to change.\n"
178 " --rename-instrumentation-target-package\n"
179 " Rewrite the manifest so that all of its instrumentation\n"
180 " components target the given package. Useful when used in\n"
181 " conjunction with --rename-manifest-package to fix tests against\n"
182 " a package that has been renamed.\n"
183 " --product\n"
184 " Specifies which variant to choose for strings that have\n"
185 " product variants\n"
186 " --utf16\n"
187 " changes default encoding for resources to UTF-16. Only useful when API\n"
188 " level is set to 7 or higher where the default encoding is UTF-8.\n"
189 " --non-constant-id\n"
190 " Make the resources ID non constant. This is required to make an R java class\n"
191 " that does not contain the final value but is used to make reusable compiled\n"
192 " libraries that need to access resources.\n"
Adam Lesinskide898ff2014-01-29 18:20:45 -0800193 " --shared-lib\n"
194 " Make a shared library resource package that can be loaded by an application\n"
195 " at runtime to access the libraries resources. Implies --non-constant-id.\n"
Adam Lesinski282e1812014-01-23 18:17:42 -0800196 " --error-on-failed-insert\n"
197 " Forces aapt to return an error if it fails to insert values into the manifest\n"
198 " with --debug-mode, --min-sdk-version, --target-sdk-version --version-code\n"
199 " and --version-name.\n"
200 " Insertion typically fails if the manifest already defines the attribute.\n"
Ying Wangcd28bd32013-11-14 17:12:10 -0800201 " --error-on-missing-config-entry\n"
202 " Forces aapt to return an error if it fails to find an entry for a configuration.\n"
Adam Lesinski282e1812014-01-23 18:17:42 -0800203 " --output-text-symbols\n"
204 " Generates a text file containing the resource symbols of the R class in the\n"
205 " specified folder.\n"
206 " --ignore-assets\n"
207 " Assets to be ignored. Default pattern is:\n"
208 " %s\n",
209 gDefaultIgnoreAssets);
210}
211
212/*
213 * Dispatch the command.
214 */
215int handleCommand(Bundle* bundle)
216{
217 //printf("--- command %d (verbose=%d force=%d):\n",
218 // bundle->getCommand(), bundle->getVerbose(), bundle->getForce());
219 //for (int i = 0; i < bundle->getFileSpecCount(); i++)
220 // printf(" %d: '%s'\n", i, bundle->getFileSpecEntry(i));
221
222 switch (bundle->getCommand()) {
223 case kCommandVersion: return doVersion(bundle);
224 case kCommandList: return doList(bundle);
225 case kCommandDump: return doDump(bundle);
226 case kCommandAdd: return doAdd(bundle);
227 case kCommandRemove: return doRemove(bundle);
228 case kCommandPackage: return doPackage(bundle);
229 case kCommandCrunch: return doCrunch(bundle);
230 case kCommandSingleCrunch: return doSingleCrunch(bundle);
231 default:
232 fprintf(stderr, "%s: requested command not yet supported\n", gProgName);
233 return 1;
234 }
235}
236
237/*
238 * Parse args.
239 */
240int main(int argc, char* const argv[])
241{
242 char *prog = argv[0];
243 Bundle bundle;
244 bool wantUsage = false;
245 int result = 1; // pessimistically assume an error.
246 int tolerance = 0;
247
248 /* default to compression */
249 bundle.setCompressionMethod(ZipEntry::kCompressDeflated);
250
251 if (argc < 2) {
252 wantUsage = true;
253 goto bail;
254 }
255
256 if (argv[1][0] == 'v')
257 bundle.setCommand(kCommandVersion);
258 else if (argv[1][0] == 'd')
259 bundle.setCommand(kCommandDump);
260 else if (argv[1][0] == 'l')
261 bundle.setCommand(kCommandList);
262 else if (argv[1][0] == 'a')
263 bundle.setCommand(kCommandAdd);
264 else if (argv[1][0] == 'r')
265 bundle.setCommand(kCommandRemove);
266 else if (argv[1][0] == 'p')
267 bundle.setCommand(kCommandPackage);
268 else if (argv[1][0] == 'c')
269 bundle.setCommand(kCommandCrunch);
270 else if (argv[1][0] == 's')
271 bundle.setCommand(kCommandSingleCrunch);
272 else {
273 fprintf(stderr, "ERROR: Unknown command '%s'\n", argv[1]);
274 wantUsage = true;
275 goto bail;
276 }
277 argc -= 2;
278 argv += 2;
279
280 /*
281 * Pull out flags. We support "-fv" and "-f -v".
282 */
283 while (argc && argv[0][0] == '-') {
284 /* flag(s) found */
285 const char* cp = argv[0] +1;
286
287 while (*cp != '\0') {
288 switch (*cp) {
289 case 'v':
290 bundle.setVerbose(true);
291 break;
292 case 'a':
293 bundle.setAndroidList(true);
294 break;
295 case 'c':
296 argc--;
297 argv++;
298 if (!argc) {
299 fprintf(stderr, "ERROR: No argument supplied for '-c' option\n");
300 wantUsage = true;
301 goto bail;
302 }
303 bundle.addConfigurations(argv[0]);
304 break;
305 case 'f':
306 bundle.setForce(true);
307 break;
308 case 'g':
309 argc--;
310 argv++;
311 if (!argc) {
312 fprintf(stderr, "ERROR: No argument supplied for '-g' option\n");
313 wantUsage = true;
314 goto bail;
315 }
316 tolerance = atoi(argv[0]);
317 bundle.setGrayscaleTolerance(tolerance);
318 printf("%s: Images with deviation <= %d will be forced to grayscale.\n", prog, tolerance);
319 break;
320 case 'k':
321 bundle.setJunkPath(true);
322 break;
323 case 'm':
324 bundle.setMakePackageDirs(true);
325 break;
326#if 0
327 case 'p':
328 bundle.setPseudolocalize(true);
329 break;
330#endif
331 case 'u':
332 bundle.setUpdate(true);
333 break;
334 case 'x':
335 bundle.setExtending(true);
336 break;
337 case 'z':
338 bundle.setRequireLocalization(true);
339 break;
340 case 'j':
341 argc--;
342 argv++;
343 if (!argc) {
344 fprintf(stderr, "ERROR: No argument supplied for '-j' option\n");
345 wantUsage = true;
346 goto bail;
347 }
348 convertPath(argv[0]);
349 bundle.addJarFile(argv[0]);
350 break;
351 case 'A':
352 argc--;
353 argv++;
354 if (!argc) {
355 fprintf(stderr, "ERROR: No argument supplied for '-A' option\n");
356 wantUsage = true;
357 goto bail;
358 }
359 convertPath(argv[0]);
Adam Lesinski09384302014-01-22 16:07:42 -0800360 bundle.addAssetSourceDir(argv[0]);
Adam Lesinski282e1812014-01-23 18:17:42 -0800361 break;
362 case 'G':
363 argc--;
364 argv++;
365 if (!argc) {
366 fprintf(stderr, "ERROR: No argument supplied for '-G' option\n");
367 wantUsage = true;
368 goto bail;
369 }
370 convertPath(argv[0]);
371 bundle.setProguardFile(argv[0]);
372 break;
373 case 'I':
374 argc--;
375 argv++;
376 if (!argc) {
377 fprintf(stderr, "ERROR: No argument supplied for '-I' option\n");
378 wantUsage = true;
379 goto bail;
380 }
381 convertPath(argv[0]);
382 bundle.addPackageInclude(argv[0]);
383 break;
384 case 'F':
385 argc--;
386 argv++;
387 if (!argc) {
388 fprintf(stderr, "ERROR: No argument supplied for '-F' option\n");
389 wantUsage = true;
390 goto bail;
391 }
392 convertPath(argv[0]);
393 bundle.setOutputAPKFile(argv[0]);
394 break;
395 case 'J':
396 argc--;
397 argv++;
398 if (!argc) {
399 fprintf(stderr, "ERROR: No argument supplied for '-J' option\n");
400 wantUsage = true;
401 goto bail;
402 }
403 convertPath(argv[0]);
404 bundle.setRClassDir(argv[0]);
405 break;
406 case 'M':
407 argc--;
408 argv++;
409 if (!argc) {
410 fprintf(stderr, "ERROR: No argument supplied for '-M' option\n");
411 wantUsage = true;
412 goto bail;
413 }
414 convertPath(argv[0]);
415 bundle.setAndroidManifestFile(argv[0]);
416 break;
417 case 'P':
418 argc--;
419 argv++;
420 if (!argc) {
421 fprintf(stderr, "ERROR: No argument supplied for '-P' option\n");
422 wantUsage = true;
423 goto bail;
424 }
425 convertPath(argv[0]);
426 bundle.setPublicOutputFile(argv[0]);
427 break;
428 case 'S':
429 argc--;
430 argv++;
431 if (!argc) {
432 fprintf(stderr, "ERROR: No argument supplied for '-S' option\n");
433 wantUsage = true;
434 goto bail;
435 }
436 convertPath(argv[0]);
437 bundle.addResourceSourceDir(argv[0]);
438 break;
439 case 'C':
440 argc--;
441 argv++;
442 if (!argc) {
443 fprintf(stderr, "ERROR: No argument supplied for '-C' option\n");
444 wantUsage = true;
445 goto bail;
446 }
447 convertPath(argv[0]);
448 bundle.setCrunchedOutputDir(argv[0]);
449 break;
450 case 'i':
451 argc--;
452 argv++;
453 if (!argc) {
454 fprintf(stderr, "ERROR: No argument supplied for '-i' option\n");
455 wantUsage = true;
456 goto bail;
457 }
458 convertPath(argv[0]);
459 bundle.setSingleCrunchInputFile(argv[0]);
460 break;
461 case 'o':
462 argc--;
463 argv++;
464 if (!argc) {
465 fprintf(stderr, "ERROR: No argument supplied for '-o' option\n");
466 wantUsage = true;
467 goto bail;
468 }
469 convertPath(argv[0]);
470 bundle.setSingleCrunchOutputFile(argv[0]);
471 break;
472 case '0':
473 argc--;
474 argv++;
475 if (!argc) {
476 fprintf(stderr, "ERROR: No argument supplied for '-e' option\n");
477 wantUsage = true;
478 goto bail;
479 }
480 if (argv[0][0] != 0) {
481 bundle.addNoCompressExtension(argv[0]);
482 } else {
483 bundle.setCompressionMethod(ZipEntry::kCompressStored);
484 }
485 break;
486 case '-':
487 if (strcmp(cp, "-debug-mode") == 0) {
488 bundle.setDebugMode(true);
489 } else if (strcmp(cp, "-min-sdk-version") == 0) {
490 argc--;
491 argv++;
492 if (!argc) {
493 fprintf(stderr, "ERROR: No argument supplied for '--min-sdk-version' option\n");
494 wantUsage = true;
495 goto bail;
496 }
497 bundle.setMinSdkVersion(argv[0]);
498 } else if (strcmp(cp, "-target-sdk-version") == 0) {
499 argc--;
500 argv++;
501 if (!argc) {
502 fprintf(stderr, "ERROR: No argument supplied for '--target-sdk-version' option\n");
503 wantUsage = true;
504 goto bail;
505 }
506 bundle.setTargetSdkVersion(argv[0]);
507 } else if (strcmp(cp, "-max-sdk-version") == 0) {
508 argc--;
509 argv++;
510 if (!argc) {
511 fprintf(stderr, "ERROR: No argument supplied for '--max-sdk-version' option\n");
512 wantUsage = true;
513 goto bail;
514 }
515 bundle.setMaxSdkVersion(argv[0]);
516 } else if (strcmp(cp, "-max-res-version") == 0) {
517 argc--;
518 argv++;
519 if (!argc) {
520 fprintf(stderr, "ERROR: No argument supplied for '--max-res-version' option\n");
521 wantUsage = true;
522 goto bail;
523 }
524 bundle.setMaxResVersion(argv[0]);
525 } else if (strcmp(cp, "-version-code") == 0) {
526 argc--;
527 argv++;
528 if (!argc) {
529 fprintf(stderr, "ERROR: No argument supplied for '--version-code' option\n");
530 wantUsage = true;
531 goto bail;
532 }
533 bundle.setVersionCode(argv[0]);
534 } else if (strcmp(cp, "-version-name") == 0) {
535 argc--;
536 argv++;
537 if (!argc) {
538 fprintf(stderr, "ERROR: No argument supplied for '--version-name' option\n");
539 wantUsage = true;
540 goto bail;
541 }
542 bundle.setVersionName(argv[0]);
Jeff Davidsondf08d1c2014-02-25 12:28:08 -0800543 } else if (strcmp(cp, "-replace-version") == 0) {
544 bundle.setReplaceVersion(true);
Adam Lesinski282e1812014-01-23 18:17:42 -0800545 } else if (strcmp(cp, "-values") == 0) {
546 bundle.setValues(true);
547 } else if (strcmp(cp, "-include-meta-data") == 0) {
548 bundle.setIncludeMetaData(true);
549 } else if (strcmp(cp, "-custom-package") == 0) {
550 argc--;
551 argv++;
552 if (!argc) {
553 fprintf(stderr, "ERROR: No argument supplied for '--custom-package' option\n");
554 wantUsage = true;
555 goto bail;
556 }
557 bundle.setCustomPackage(argv[0]);
558 } else if (strcmp(cp, "-extra-packages") == 0) {
559 argc--;
560 argv++;
561 if (!argc) {
562 fprintf(stderr, "ERROR: No argument supplied for '--extra-packages' option\n");
563 wantUsage = true;
564 goto bail;
565 }
566 bundle.setExtraPackages(argv[0]);
567 } else if (strcmp(cp, "-generate-dependencies") == 0) {
568 bundle.setGenDependencies(true);
569 } else if (strcmp(cp, "-utf16") == 0) {
570 bundle.setWantUTF16(true);
571 } else if (strcmp(cp, "-preferred-configurations") == 0) {
572 argc--;
573 argv++;
574 if (!argc) {
575 fprintf(stderr, "ERROR: No argument supplied for '--preferred-configurations' option\n");
576 wantUsage = true;
577 goto bail;
578 }
579 bundle.addPreferredConfigurations(argv[0]);
580 } else if (strcmp(cp, "-rename-manifest-package") == 0) {
581 argc--;
582 argv++;
583 if (!argc) {
584 fprintf(stderr, "ERROR: No argument supplied for '--rename-manifest-package' option\n");
585 wantUsage = true;
586 goto bail;
587 }
588 bundle.setManifestPackageNameOverride(argv[0]);
589 } else if (strcmp(cp, "-rename-instrumentation-target-package") == 0) {
590 argc--;
591 argv++;
592 if (!argc) {
593 fprintf(stderr, "ERROR: No argument supplied for '--rename-instrumentation-target-package' option\n");
594 wantUsage = true;
595 goto bail;
596 }
597 bundle.setInstrumentationPackageNameOverride(argv[0]);
598 } else if (strcmp(cp, "-auto-add-overlay") == 0) {
599 bundle.setAutoAddOverlay(true);
600 } else if (strcmp(cp, "-error-on-failed-insert") == 0) {
601 bundle.setErrorOnFailedInsert(true);
Ying Wangcd28bd32013-11-14 17:12:10 -0800602 } else if (strcmp(cp, "-error-on-missing-config-entry") == 0) {
603 bundle.setErrorOnMissingConfigEntry(true);
Adam Lesinski282e1812014-01-23 18:17:42 -0800604 } else if (strcmp(cp, "-output-text-symbols") == 0) {
605 argc--;
606 argv++;
607 if (!argc) {
608 fprintf(stderr, "ERROR: No argument supplied for '-output-text-symbols' option\n");
609 wantUsage = true;
610 goto bail;
611 }
612 bundle.setOutputTextSymbols(argv[0]);
613 } else if (strcmp(cp, "-product") == 0) {
614 argc--;
615 argv++;
616 if (!argc) {
617 fprintf(stderr, "ERROR: No argument supplied for '--product' option\n");
618 wantUsage = true;
619 goto bail;
620 }
621 bundle.setProduct(argv[0]);
622 } else if (strcmp(cp, "-non-constant-id") == 0) {
623 bundle.setNonConstantId(true);
Adam Lesinskide898ff2014-01-29 18:20:45 -0800624 } else if (strcmp(cp, "-shared-lib") == 0) {
625 bundle.setNonConstantId(true);
626 bundle.setBuildSharedLibrary(true);
Adam Lesinski282e1812014-01-23 18:17:42 -0800627 } else if (strcmp(cp, "-no-crunch") == 0) {
628 bundle.setUseCrunchCache(true);
629 } else if (strcmp(cp, "-ignore-assets") == 0) {
630 argc--;
631 argv++;
632 if (!argc) {
633 fprintf(stderr, "ERROR: No argument supplied for '--ignore-assets' option\n");
634 wantUsage = true;
635 goto bail;
636 }
637 gUserIgnoreAssets = argv[0];
638 } else {
639 fprintf(stderr, "ERROR: Unknown option '-%s'\n", cp);
640 wantUsage = true;
641 goto bail;
642 }
643 cp += strlen(cp) - 1;
644 break;
645 default:
646 fprintf(stderr, "ERROR: Unknown flag '-%c'\n", *cp);
647 wantUsage = true;
648 goto bail;
649 }
650
651 cp++;
652 }
653 argc--;
654 argv++;
655 }
656
657 /*
658 * We're past the flags. The rest all goes straight in.
659 */
660 bundle.setFileSpec(argv, argc);
661
662 result = handleCommand(&bundle);
663
664bail:
665 if (wantUsage) {
666 usage();
667 result = 2;
668 }
669
670 //printf("--> returning %d\n", result);
671 return result;
672}