Android static libraries are like APKs but they contain much more debugging
and source information. We need to treat them differently in 3 ways:
1) When building a static library, we skip things like ID assignment and
product/config stripping. Source information is emitted as well.
2) When building a static library and linking against another
static library, we don't want to merge, we want to simply reference.
3) When building an app that uses static libraries, we want to merge
the static library under the same package with or without mangling.
Bug:25958912
Change-Id: I425e032857936a3e83173c1edc2a6cdc6020b842
Previously, a bit was kept to find if the script of a locale was
explicitly "provided" in a resource. This was not backward
compatible, and failed in some edge cases when the package was
created with older versions of AAPT that did not set the bit.
The cases would happen when the old resource had an explicit script
specified in its locale, but since the "provided" bit was not set in
the package, we would assume that the script was computed by us.
This CL replaces the "provided" bit with a "computed" bit, so the
default value of the bit (set to "false" for old packages) would be
correct.
Bug: 27156990
Change-Id: I99e7f1ad8f70c90e25ab3640ed34cc1a6f8d1d64
When a preferred density is supplied, the closest matching densities
will be selected, the rest stripped from the APK.
Split support will be enabled in a later CL. Command line support is still
needed, but the foundation is ready.
Bug:25958912
Change-Id: I56d599806b4ec4ffa24e17aad48d47130ca05c08
This allows us to preserve the various product definitions during the compile
phase, and allows us to select the product in the link phase.
This allows compiled files to remain product-independent, so that they do not need
to be recompiled when switching targets.
Bug:25958912
Change-Id: Iaa7eed25c834b67a39cdc9be43613e8b5ab6cdd7
Without needing to conform to the runtime data format,
it is much easier to add new features such as debugging symbols
and carrying over product data to link time.
This also simplifies the runtime format parser and serializer,
which will change much less frequently than the protobuf intermediate
format.
Change-Id: I209787bbf087db0a58a534cb8511c51d21133e00
Real libraries will be built correctly, but since we are not doing that
yet, support the old way and allow a flag --non-final-ids to remove
the final modifier from R.java.
Change-Id: Iad55fb9140e55dbb0f41d0d55f2e2bd958294c8e
* Add support for determining script from language and region.
* Add support for determining special parents of locales.
* Add support for smart comparison of locales with only a difference
in region, using the locale parentage tree.
* Fix LocaleData.matchScore() to not fallback to old locale matching
behavior if we can't determine a script.
* Allow four-character variant codes. (Previously, only five- to
eight-character variant codes were allowed.)
Bug: 7296673
Bug: 26589793
Change-Id: Ibde0a48c0564ff383b41068095a5cbacfe7b94bc
The libziparchive returns an error on empty zip files.
Work around this by checking for that error condition and
returning an empty ZipFileCollection.
Change-Id: I9edaf2e089456b6ccb4bb099b20ede10331bd352
- Add option to rename package in AndroidManifest.xml
- Support default versionName and versionCode
- Accept True and False as valid booleans
Change-Id: I400e350b9dcd0fd1c197d1929144299c7823617d
This is normally an error, but old AAPT didn't check for it correctly,
so many projects violate this. With --legacy, this becomes a warning.
Change-Id: I23647e029930e11b719591cd38609e1b43247e20
Previously the default product wasn't tried if 'default' wasn't specified on the command line.
Also adds support for multiple products.
Change-Id: I1e4872b34bb8d609b6444841a4e7e4dbb3bbb76b
Pseudolocalization happens at the compile phase. Pseudolocalized
values are weak, such that manually specified values will take precedence.
Change-Id: I5e064ce0d270c9f4f9022f75aecedab9d45bc980
We now default host native tests to build both 32-bit and 64-bit
versions.
The 32-bit version of libaapt2_test was broken because it was comparing
an unsigned int to the result from std::count(std::vector), which is a
signed int. The 64-bit version compiled fine, since
std::count(std::vector) returns a long.
Change-Id: I786fcd8a54d9f78b76b19ef82ab8dda6f5c42197
An <item> is a general tag that can override certain behavior. For
instance, this is allowed:
<item name="foo" type="integer" format="float">0.4</item>
Even though without the format attribute, this would be illegal.
Change-Id: I8133ce59e14719a70d7476a1464c3f564c435289
Supports the <add-resource> tag and mimics old AAPT behavior of
not allowing new resources defined unless <add-resource> was used
or --auto-add-overlay was specified.
Change-Id: I9b461137357617ade37fd7045b418b8e6450b9c4
This allows us to compile an entire directory and output to a single
file. This is important to support generated resources in the make
build, since we may not know what resources get generated.
The link step will accept the zip and read the contents of it as if they
were passed in on the command line.
Change-Id: If1a51b0abe772350c24074353eb4989953c2e0cb
Values like styles or arrays have children which need to have
their source and comments preserved.
Change-Id: I6fc713ba36627e6d66c7930b4080cc1403bac207
Integers are now checked to see if they fall in the range
of min/max for the attribute they are assigned.
Change-Id: I42c435b15fd3f0bd23691c83efccce4ad5973276
When the separator was the last character, the tokenizer would skip
the empty string, which is wrong.
Change-Id: I64ceb4e8d4ac48ee41d40781ab5785a3bc61b24d
The set of files to build was only comparing resource name and
not configuration.
Also support --extra-packages as a colon separated list of packages.
Change-Id: I36b65cd15299cdc722b785a7891a24ca1bc4fb45
The SymbolTable lookup relied on the configuration, which we NEVER
want. Now we rely solely on the symbols defined in the ResTable
and no specific configuration or value of that symbol.
Also added some better source logging.
Change-Id: I983855c283493e924b2e92a9fd8e4cb841769349
Resource types that are typically stored outside of the resource table
(like layout, xml, drawable) can only have aliases (reference to another
resource).
Change-Id: Idb768801f02bb142e5be5e438904f221499bd756
Merging local app resources is slightly different than merging
resources from a static library.
Local app resources may not have a package name set, but we do take interest in the
ID set for the package (should be 0x0 or match the ID of the app we're building).
Static library resources have an explicit package name defined for them, so we
only merge resources from that package.
Change-Id: I95e559ae94cc1df6972e77a347b1b37a93674c4d
Before, the ID assigned to a public resource without an explicitly set id
was more difficult to figure out. It would be the next available ID.
AAPT2 introduces a new way to specify public attributes in progress.
<public-group type="attr" first-id="0x0101047f">
<public name="foo" />
<public name="bar" />
...
</public-group>
The IDs assigned to each resource is auto-incremented starting from `first-id`.
This also keeps resource's with the same type grouped together so that
the auto-incrementing nature is evident.
Also, due to how AAPT2 was implemented, this is required :P
Change-Id: I95ea92ad0405e87ed0b1766879bb2f1d9d0b636e
Comments weren't being copied when merged from the various
resource tables.
Also refactored the JavaClassGenerator to omit a class
if no entries exist for it.
Change-Id: I6eaa89b7b3715bc05403635a2baf0d1db3efd142
Values are closely related to where they were defined, so
this information should live inside the Value.
This also enables comments to be attached to nested Values.
Change-Id: Ic7481b5a5f26d0ef248d638e2e29252f88154581