367 Commits

Author SHA1 Message Date
Xavier Ducrohet
22d7cf239d Add single crunch command to aapt. do not merge.
Previously the crunch command would work on a full res folder
and output a full res folder (with only the drawables). This
was only used in the SDK.

The incremental logic is moved to the SDK build system so we
change the crunch command (or rather add a new one) to only
crunch a single file.

(cherry picked from commit b1f6ad82dd8d1702617a757a88430604b3131fac)

Change-Id: I3653f67ee321eac37cb8a6d228b1ef6d104ff0be
2013-01-02 15:41:52 -08:00
Christopher Tate
67b38c44e8 Cache resource ID lookups in aapt
This speeds up certain workloads considerably, particularly
those involved in buildling apps via the SDK.  Windows-based
use should particularly benefit from the change.

(cherry picked from commit d8dde13a63565dcd72bcf03a5088407b737ba793)

Change-Id: I33835bc64ade77688d41e8bfcd371b0a5f59d8fd
2012-11-28 15:32:46 -08:00
Xavier Ducrohet
0122a3db31 Fix writing text version of styleable IDs. do not merge.
(cherry picked from commit d16047434bca24b2811de7ea9d22de6ee0f87f79)

Change-Id: Ic679080d5157daf77c35516c8f682bd13e2b4d96
2012-09-26 11:14:50 -07:00
Xavier Ducrohet
a41d5db235 am 79c95c3b: am 5de96035: am 31820a35: Merge "Add --output-text-symbols option to aapt."
* commit '79c95c3b50ff332f9c92430fd10a15eb648a0b02':
  Add --output-text-symbols option to aapt.
2012-09-17 12:08:36 -07:00
Xavier Ducrohet
9ff22e41d0 am 8a67598e: am cc9747ed: am d7252571: Merge "Add --error-on-failed-insert option to aapt."
* commit '8a67598eb780560b7efe4e1d9944c7cbcf83bbb1':
  Add --error-on-failed-insert option to aapt.
2012-09-17 12:08:29 -07:00
Xavier Ducrohet
5de9603529 am 31820a35: Merge "Add --output-text-symbols option to aapt."
* commit '31820a35b2cf864a8dcb71d43e6fd21d54f49a2d':
  Add --output-text-symbols option to aapt.
2012-09-17 12:03:19 -07:00
Xavier Ducrohet
cc9747ed45 am d7252571: Merge "Add --error-on-failed-insert option to aapt."
* commit 'd72525718ea7ef3e1f97cf557365b143c8919a5b':
  Add --error-on-failed-insert option to aapt.
2012-09-17 12:03:12 -07:00
Xavier Ducrohet
f5de650ff1 Add --output-text-symbols option to aapt.
Library projects in the SDK are built using --non-constant-id
to generate a temporary R.java class.
When the library is packaged with the application to generate an
apk, the R class is recreated with the proper IDs due to all the
resources coming from the app and all the libraries.

However for large apps with many libraries (each with their own
R class in their package), this means a lot of unnecessary IDs:
all R classes contains all the IDs including for resources from
by projects they don't have access through the dependency graph.

For really large apps (X,000 resources), with lots of libraries
(10+), this can generate tens of thousands of resources, which
can trigger dalvik's limit of 65K fields and methods per dex
files.

This changes lets aapt generate not only the R class but a simple
text file containing the list of all those IDs so that it is
easier to parse back. The SDK build system will not ask aapt
to generate the R class of the libraries (through the
--extra-packages option), instead it will then read this
file to know what IDs are needed for each library and generate
a much smaller R class for each library (using the same text
file output from compiling all the resources to get the final
integer value).

Change-Id: I4db959fec372cf3ead9950e4b2b82fa1ae7eed2d
2012-09-11 18:19:00 -07:00
Xavier Ducrohet
7714a2429b Add --error-on-failed-insert option to aapt.
The new SDK build system give the ability to insert
versionCode/Name and min/targetSdkVersion in the manifest
but aapt won't replace those if they already exist.

The main problem is that aapt doesn't actually fail when
it doesn't replace them, making the output not what the
developer wanted.

This patch set adds an option to aapt to make it return
an error if the insert failed because the attribute
already existed.

Change-Id: I8938ec1238da407a8562c974e9598db39001ffd9
2012-09-11 18:17:22 -07:00
Elliott Hughes
e3e5349874 am 61d09810: am 3150feef: am bfe1ab82: Merge "Fix aapt to get expat header files from the approved location."
* commit '61d09810a7b478810adc15af2495136255377e25':
  Fix aapt to get expat header files from the approved location.
2012-09-09 16:13:11 -07:00
Elliott Hughes
3150feef0b am bfe1ab82: Merge "Fix aapt to get expat header files from the approved location."
* commit 'bfe1ab825731d365fef169deab646d7ceeafc998':
  Fix aapt to get expat header files from the approved location.
2012-09-09 16:09:15 -07:00
Elliott Hughes
ee15e15475 Fix aapt to get expat header files from the approved location.
Change-Id: Ic7c796e048cfe98ee355c18b3708fee5ea716e2e
2012-09-09 14:45:32 -07:00
Fabrice Di Meglio
8a802dbdab Use "ldrtl" and "ldltr" config qualifiers for RTL / LTR resources
- we cannot use "rtl" / "ltr" qualifiers as they can conflict with ISO-639 Alpha-3
codespace which uses 3 letters for identifying a language code (and could use either
"rtl" or "ltr" strings for defining a language in the future).

- we are using instead "ldrtl" for RTL and "ldltr" for LTR resources. Those qualifiers
are defined by more than 3 chars and outside of what is defined into ISO-639. They
are also more understandable as "ld" prefix is for "layoutdirection"

Change-Id: Id43e948103707e09bef63ebd54ac1779dde58e72
2012-09-06 11:13:24 -07:00
Fabrice Di Meglio
5f79799939 Add support for "-rtl" in resources
- fix bug #7035019 Need to have "-rtl" support for Resource

Change-Id: Ic82145c2ac672729d8a6c695a5f343276a1a0a2c
2012-08-23 14:55:33 -07:00
Jean-Baptiste Queru
c1c55afb47 am e67f8c8c: Merge "Normalize output from aapt d xmltree"
* commit 'e67f8c8c279e20fff5f426eccd062b709e6280ed':
  Normalize output from aapt d xmltree
2012-08-08 12:01:35 -07:00
Jean-Baptiste Queru
e67f8c8c27 Merge "Normalize output from aapt d xmltree" 2012-08-08 11:21:29 -07:00
Xavier Ducrohet
be92501720 am b71393bd: Merge "Fix aapt -G to properly support class attr in fragment." into jb-dev
* commit 'b71393bd34a48eeb622292e78f43b99e374a5e3a':
  Fix aapt -G to properly support class attr in fragment.
2012-07-19 14:30:39 -07:00
Xavier Ducrohet
095cd2e2d1 Fix aapt -G to properly support class attr in fragment.
The code added attributes android:name and class to a
KeyedVector under the same key (fragment) so the 2nd
add (android:name) removed class with was never checked.

This replace the value type in the KeyedVector to be
Vector<NamespaceAttributePair> instead of just
NamespaceAttributePair.

Change-Id: I009b8a8cca878191661c2a63bb14c967d230498d
2012-07-19 09:06:03 -07:00
Shachar Shemesh
429dad687b Normalize output from aapt d xmltree
When using aapt dump xmltree to dump an XML which has a content element with newlines, the output contains a
newline. This makes it very difficult, sometimes impossible, to understand what is part of the content, and
what is the meta-data.

We now pass XML content through the same normalizer used for other tags.

Change-Id: I327321520fac563eb32aecaf796f2473866697fc
2012-07-08 06:37:48 +03:00
Jean-Baptiste Queru
cc6cf51b80 am 8c71784e: Merge "Initialize mJunkPath to false"
* commit '8c71784e9e83e914135e996591aa7903edd2fd96':
  Initialize mJunkPath to false
2012-06-22 14:34:54 -07:00
Haitao Feng
dbcfed9e2c Initialize mJunkPath to false
Change-Id: Ib48bb1d91736d27f055528c3ba275237ff5ada07
2012-06-22 09:20:26 +08:00
Dianne Hackborn
6892f1ec96 am 0f6471ac: Merge "Fix issue #6641368: can\'t launch gallery" into jb-dev
* commit '0f6471ace77387560988964ed0679f843bba6f1f':
  Fix issue #6641368: can't launch gallery
2012-06-12 12:41:36 -07:00
Dianne Hackborn
2bd8d0403b Fix issue #6641368: can't launch gallery
This is a revert of 1db36528b12395b9ed9bf8a1005a6d4ace737627,
but with comments added so I don't make this mistake again. :)

Change-Id: I053216279e3721f08f32f561bb989736ef619f82
2012-06-11 12:27:05 -07:00
Jean-Baptiste Queru
f22eb96301 am c9fe6568: am 9e22d9c5: Merge "Fix "Too many open files" error for aapt built with Mac OS X SDK 10.6."
* commit 'c9fe6568f3e7e4d9dc6da072afc929b9a81001ed':
  Fix "Too many open files" error for aapt built with Mac OS X SDK 10.6.
2012-06-05 18:48:00 -07:00
Jean-Baptiste Queru
c9fe6568f3 am 9e22d9c5: Merge "Fix "Too many open files" error for aapt built with Mac OS X SDK 10.6."
* commit '9e22d9c514457c4b163d03b9241e4e28b1698368':
  Fix "Too many open files" error for aapt built with Mac OS X SDK 10.6.
2012-06-05 18:43:49 -07:00
Ying Wang
41bdb03ffb Fix "Too many open files" error for aapt built with Mac OS X SDK 10.6.
With SDK 10.6 without _DARWIN_UNLIMITED_STREAMS aapt sometimes fails
right away with the error "Too many open files" when calling fopen().

Change-Id: Ifa7bd8a9530d706aa47f98be8186f1aefe943d76
2012-06-05 14:30:39 -07:00
Tor Norbye
9f374b9de5 am 44ff9b8f: am 36ac43ba: Merge "Tweak default ignore-assets path"
* commit '44ff9b8f9294e015031fc9293974604771e5efdd':
  Tweak default ignore-assets path
2012-06-05 08:45:20 -07:00
Tor Norbye
44ff9b8f92 am 36ac43ba: Merge "Tweak default ignore-assets path"
* commit '36ac43ba9982a78b4a047c8970776505a3fab4da':
  Tweak default ignore-assets path
2012-06-05 08:41:16 -07:00
Tor Norbye
e0219c8baa Tweak default ignore-assets path
Add .DS_Store to the list of ignored files that are silently
ignored (other dot-files are ignored but aapt emits a "(skipping <x>)"
message.)

Also, add a "!" prefix to the *~ pattern for Emacs/Vim/Gedit backup
files.

Finally, move the !*.scc pattern up in front of the .* pattern, such
that it doesn't match the earlier .* pattern (which is verbose, unlike
!*.scc).

Change-Id: Id3e96490f1802486aea8c58366d43e9d413971b8
2012-06-04 10:41:38 -07:00
Jean-Baptiste Queru
3df4e1a2f1 am 0748a569: Merge "aapt: Remove terminal pointer incrementaion"
* commit '0748a5698776d1a9693a5449ffc983af26cc533b':
  aapt: Remove terminal pointer incrementaion
2012-06-02 09:56:45 -07:00
Jean-Baptiste Queru
0748a56987 Merge "aapt: Remove terminal pointer incrementaion" 2012-06-02 09:21:37 -07:00
Ying Wang
98a0607a31 Merge "Fix length of pattern." DO NOT MERGE.
After skipping * with "token++", the length should decrease by 1 as
well.

(merged from 996b073e813ba1a22a13282ccdebb664f14ba898)

Change-Id: Ie6232ef603bb31e25e03b926e6c1bb92ac34902d
2012-05-24 11:07:14 -07:00
Ying Wang
ac9f50573d am 996b073e: Fix length of pattern.
* commit '996b073e813ba1a22a13282ccdebb664f14ba898':
  Fix length of pattern.
2012-05-22 11:43:14 -07:00
Ying Wang
996b073e81 Fix length of pattern.
After skipping * with "token++", the length should decrease by 1 as
well.

Change-Id: I132eb7d12bb756f2f713c607e92741ca834aef81
2012-05-22 11:35:22 -07:00
Raphael Moll
9c06ac09c3 Merge "Merge "AAPT: support a new --ignore-assets flag."" into jb-dev 2012-05-21 13:09:29 -07:00
Raphael Moll
6c255a3a37 Merge "AAPT: support a new --ignore-assets flag."
AAPT has a fixed built-in list of files and directories
to ignore when parsing resource files. Over the years we
always had developers requiring specific patterns.

Added a command-line option for it:
  aapt di --ignore-assets "foo*:*.blah"

If the env var ANDROID_AAPT_IGNORE is set, it is parsed
to find which file/directory patterns to ignore.

Otherwise a default is used that matches the current behavior.

SDK Bug: 5343 24067

(cherry-pick from AOSP 90897ed87bce639bf6bb2ccf15fbabb59b131bab)

Change-Id: Ia4caa2a8188c8c1df143f884e459b8182645995f
2012-05-18 20:34:44 -07:00
Dianne Hackborn
72669b5f46 am 13a0271c: Merge "Add aapt support for generating proguard rules for onClick methods." into jb-dev
* commit '13a0271cb81d497edbf93f3d6ecf4b9b8da4ee69':
  Add aapt support for generating proguard rules for onClick methods.
2012-05-18 19:41:10 -07:00
Dianne Hackborn
9275197d35 Add aapt support for generating proguard rules for onClick methods.
Also fix Activity menu inflater when using the dark on light
theme wrapper to still be able to find onClick listeners.

Change-Id: Ie206db26d1df96041bc477804e476b02ad99dc9d
2012-05-18 19:23:19 -07:00
Raphael Moll
f67f834a9c am 8748399f: am 61394501: Merge "Support a new ANDROID_AAPT_IGNORE env var."
* commit '8748399f6f999d21eef9226baadb20f71dfb61ea':
  Support a new ANDROID_AAPT_IGNORE env var.
2012-05-18 16:33:14 -07:00
Raphael Moll
90897ed87b Support a new ANDROID_AAPT_IGNORE env var.
AAPT has a fixed built-in list of files and directories
to ignore when parsing resource files. Over the years we
always had developers requiring specific patterns.
If the env var ANDROID_AAPT_IGNORE is set, it is parsed
to find which file/directory patterns to ignore.
Otherwise a default is used that matches the current behavior.

Added a command-line option for it:
  aapt di --ignore-assets "foo*:*.blah"

SDK Bug: 5343 24067

Change-Id: Ia4caa2a8188c8c1df143f884e459b8182645995f
2012-05-09 21:16:26 -07:00
Jean-Baptiste Queru
3e2d59146d resolved conflicts for merge of 13c04786 to jb-dev-plus-aosp
Change-Id: Ib7aa5a768f4606beb2a4387811cfed7c00cbc111
2012-05-01 10:02:02 -07:00
Jean-Baptiste Queru
39b58ba2b2 resolved conflicts for merge of bc2fb7b9 to jb-dev-plus-aosp
Change-Id: I5386585e473201268c6ed8b05e0a16569d434ea2
2012-05-01 09:54:38 -07:00
Jean-Baptiste Queru
b2228eb714 Merge "Runtime resource overlay: clean-up." 2012-05-01 09:20:32 -07:00
Jean-Baptiste Queru
9e3bc3f61d Merge "Build overlay packages just like regular packages." 2012-05-01 08:49:38 -07:00
Ying Wang
002f53770a Apply --extra-packages in case --custom-pacakge is also specified.
Cherry-picked from master.

Change-Id: I2d67b8821afdf064f4186ccd8def1b65f9a7dc88
2012-04-26 13:13:08 -07:00
Dianne Hackborn
4aa14b912f Add new aapt dump badging output explaining implicit badging.
New uses-implied-feature and uses-implied-permission tell you
about any features or permissions that aapt is automatically
adding to your app, and why it is doing so.

Change-Id: I45edb055408e1259699c994f956166ce67e8db5d
2012-04-16 11:34:15 -07:00
Dan Morrill
4527a92421 Merge "Adding a line for android-debuggable to 'dump badging' if AndroidManifest.xml is configured as such. This is to be used by e.g. Play Store to warn the developer that they are about to publish a security hole." 2012-04-10 17:13:17 -07:00
Dianne Hackborn
31b0e0e86a Implement call log permission compatibility.
If a pre-JellyBean application requests read/write contacts, it
will implicitly be given read/write call log.

Change-Id: I029db4b09fda737bb8fba4e1611355ebdbbfd34f
2012-04-05 19:33:30 -07:00
Amith Yamasani
ec4a50428d Embed layout padding in nine patch images
- Added a new custom PNG chunk that carries the layout padding ints.
- Extract the padding ticks from .9.png images and store in the chunk.
- Load the padding information at runtime into Bitmap and NinePatchDrawable.

- The new chunk is ordered first so that it doesn't cause a problem in older
  versions of the platform.

Bug: 6087201

Change-Id: I5de46167a1d44b3ec21065b0c165e594b1dc8399
2012-04-04 12:05:59 -07:00
Dan Morrill
b6ec11ef37 Adding a line for android-debuggable to 'dump badging' if AndroidManifest.xml
is configured as such. This is to be used by e.g. Play Store to warn the
developer that they are about to publish a security hole.

Change-Id: Ib6f8537462cbc00ed0504435bdeee2aae0c5b69b
2012-04-03 14:42:05 -07:00