summaryrefslogtreecommitdiff
path: root/tools/aapt/Main.cpp
AgeCommit message (Collapse)Author
2018-08-29Convert aapt to SoongDan Willemsen
See build/soong/README.md for more information. Test: cd frameworks/base/tools/aapt; mma Test: aapt version Change-Id: Ice97e9b32c53cfed30d68acd5717d8c66712df4c
2017-09-08Don't compile libaapt with the build numberDan Willemsen
Only do that for the aapt binary itself. This will allow libaapt to be converted to Soong. Also remove a few lines that weren't doing anything: aaptCppflags was never set, LOCAL_C_INCLUDES := $(LOCAL_PATH) is implied. Test: m aapt Test: aapt version Change-Id: Ia3bcece14921417e1bfd3406630961c013bd497c
2017-01-24AAPT: Add --no-version-transitions flagYuichi Araki
Add a new flag to disable versioning of Transition related XMLs. Transition support library will use this to handle these XMLs on older API levels. Test: make libaapt_tests AaptTestAppOne Bug: 34427868 Change-Id: I66e81cca049e71ef6704177b2ca21c9cdeaff78f
2016-04-21AAPT: ProGuard config for components in main dex.Rohit Agrawal
Create an analogue of "aapt -G" which outputs a proguard configuration that keeps only components which need to be in the main dex. BUG: 27383099 Change-Id: Ic18c8c563794ff27a5598a214111d1b446a005f1
2015-12-07Specify private resource package in Android.mkAdam Lesinski
Private resource package shouldn't be buried in some resource file. It can now be specified on the command line via the Android.mk file. Change-Id: I9e3cb0bf54830d6b021077af271913306c024701
2015-09-08Load app resource as shared library.Tao Bai
- Added aapt command line flag --app-as-shared-lib to build app resources that could be loaded as shared lib at runtime. - Added new method AssetManager.addAssetPathAsSharedLibrary() to load an app resource as shared library. Bug 22487604 Change-Id: Ib9b33c35f9c2b7129f3ba205de03d4564623ea39
2015-07-30am e528f048: am 84a04d52: Merge "Move frameworks/base/tools/ off ↵Elliott Hughes
AndroidConfig.h." * commit 'e528f048689868a2d4dfdf23b553fe536acd15cd': Move frameworks/base/tools/ off AndroidConfig.h.
2015-07-29Move frameworks/base/tools/ off AndroidConfig.h.Elliott Hughes
Change-Id: Ibc7abb67a56945a9618bc91ccdbebe4c806879a5
2015-06-02aapt: add option for stricter symbol generationAdrian Roos
Adds an option that prevents generating java symbols for string resources that don't have a default localization. Bug: 21537397 Change-Id: Ifafa942b24d5cdbed93651cde363e859be13d395
2015-04-21AAPT: Add flag to disable versioning of vector related XMLAdam Lesinski
AAPT automatically versions XML files according to the SDK level in which their attributes were introduced. Support libraries know how to handle resources built against newer SDKs, so offer the option to disable some of the automatic versioning, namely vectors. Bug:19336994 Change-Id: I9f9d0ae8f2a0c28404f82e27de416f80e38493c9
2015-01-08am c04a21a0: Merge "Fixup aapt usage message" automerge: 64044d0Adam Lesinski
* commit 'c04a21a0ef6cd97a45307e4c1de9088e57719ca2': Fixup aapt usage message
2015-01-07Fixup aapt usage messageJohan Redestig
The --preferred-configurations option was renamed to --preferred-density in fab5087 but only part of the usage message was changed. Change-Id: I89d270990023beca19605901d956d29d0b0b848b
2014-11-03Fix issues that will be present in C++11Adam Lesinski
- char16_t is a distinct type, so stay consistent with it throughout the code base. - char16_t is defined as minimum size of 16 bits. Since we mmap and cast data structures onto raw memory, we need a precise definition (uint16_t), so we cast between that (and static_assert that they are the same size). Change-Id: I869c32637543bbcfb39d2643e7d9df10d33acd3c
2014-10-02Added a daemon mode to aapt to receive streams of commands from gradle.Jerome Dochez
When crunching png, we used to spawn a separate aapt process from java which is slow and resource intensive. Introduced a daemon mode to appt which when invoked with -m parameter will listen from commands on stdin and give report of command execution on stdout. One one command is supported so far : s f1 f2 This command perform a single png crunch, f1 pointing to the input png file to crunch, and f2 pointing to the path for the resulting crunced file. Expected output from the command is "Done" or "Error". Change-Id: Iaf1d865e8d5ee5d36abe39dea6443715865a98d3
2014-08-04AAPT support for feature splitsAdam Lesinski
This change allows the developer to add a base package for which to build a feature split. The generated resource types will begin after the base APK's defined types so as not to collide or override resources. Multiple features can be generated by first choosing an arbitrary order for the features. Then for each feature, the base APK and any preceding features are specified with the --feature-of flags. So with a base APK 'A' and features, 'B', and 'C', 'B' would be built with aapt package [...] --feature-of A [...] and 'C' would be built with aapt package [...] --feature-of A --feature-of B [...] Change-Id: I1be66e3f8df9a737b21c71f8a93685376c7e6780
2014-06-03resolved conflicts for merge of 522c5ce2 to masterAdam Lesinski
Change-Id: I15c7f78e9c81947e33270251d7b50e592fb61583
2014-06-03am 7e547e0d: Merge "Add --pseudo-localize option to generate resources for ↵Adam Lesinski
pseudolocales." * commit '7e547e0d72817032737909952f00acc2e777a35a': Add --pseudo-localize option to generate resources for pseudolocales.
2014-06-03Add --pseudo-localize option to generate resources for pseudolocales.Igor Viarheichyk
Update help output with new option, remove mention of obsolete zz_ZZ pseudolocale. Change-Id: Ie2cfc8d11ef6a57e2b9a2333514a7340a3a8c075
2014-05-11Add support for building split APKsAdam Lesinski
Build multiple APKs, each containing a disjoint subset of configurations. These can then be loaded into the device AssetManager and should operate as if they were never split. Use the idea of building multiple sets of files, where each set represents an APK. An ApkBuilder can place files in a set based on its configuration, but you can actually add directly to a set, in the case of the resources.arsc and generated AndroidManifest.xml for splits. Change-Id: Ic65d3f0ac1bbd290185695b9971d425c85ab1de3
2014-03-25Shared library resource supportAdam Lesinski
Shared libraries can now export resources for applications to use. Exporting resources works the same way the framework exports resources, by defining the public symbols in res/values/public.xml. Building a shared library requires aapt to be invoked with the --shared-lib option. Shared libraries will be assigned a package ID of 0x00 at build-time. At runtime, all loaded shared libraries will be assigned a new package ID. Currently, shared libraries should not import other shared libraries, as those dependencies will not be loaded at runtime. At runtime, reflection is used to update the package ID of resource symbols in the shared library's R class file. The package name of the R class file is assumed to be the same as the shared library's package name declared in its manifest. This will be customizable in a future commit. See /tests/SharedLibrary/ for examples of a shared library and its client. Bug:12724178 Change-Id: I60c0cb8ab87849f8f8a1a13431562fe8603020a7
2014-02-25Add --replace-version flag to aapt.Jeff Davidson
Motivation: we'd like to programmatically specify the version name/code (i.e. to include the build number from the build server). However, this means that we cannot specify version info in the AndroidManifest.xml file, as this takes precedence. Not doing so makes IDE use more difficult, as the IDE gets version code 0 and won't install over an existing non-IDE version unless you first force a downgrade to an IDE build from the command line. This flag allows us to specify a very high version code in the AndroidManifest.xml file, making IDE builds take precedence, while still allowing us to override this info when performing command-line (official) builds. Change-Id: I5d01048698af5c26bdf19066c6cd4eca1115112a
2014-02-04resolved conflicts for merge of 1b5b60d6 to masterAdam Lesinski
Change-Id: I2b713a55fcdf02c01afa99f175bf14248f210460
2014-01-27Add new aapt flag --error-on-missing-config-entryYing Wang
It forces aapt to return an error if aapt fails to find an resource entry for a configuration. Bug: 11259444 Change-Id: Ie5674a29dff5d4455e7d7c94f6b25560fb1305b7
2014-01-27Revert "Move frameworks/base/tools/ to frameworks/tools/"Adam Lesinski
This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
2014-01-23Add support for multiple asset dirs (-A)Adam Lesinski
Bug: 12608034 Change-Id: I02c5a1a73b83498d799570428cca3dd914f8ac11
2013-08-28Move frameworks/base/tools/ to frameworks/tools/Mike Lockwood
Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
2013-08-21Modify 'aapt dump badging' to output <meta-data> tagsMaurice Chu
This enables output of <meta-data> tags within the <application> element of the AndroidManifest.xml if the --include-meta-data command line option is invoked. For example, by aapt dump --include-meta-data badging Foo.apk Bug: 10257318 Change-Id: I88da1a14ab21146b64ac947e0eeb1107816acd4d
2013-04-29Merge commit 'b3f66877' into afdmergeJeff Sharkey
Change-Id: I319863cf23b2e6eacfa4508f7b111fba7b1cbc24
2013-04-29am bd1730de: Merge "Document the \'aapt dump strings\' command"Christopher Tate
* commit 'bd1730dec7356e042ee885ff4a63b40f36733062': Document the 'aapt dump strings' command
2013-04-29Document the 'aapt dump strings' commandMårten Kongstad
Update the usage page for aapt to mention 'strings' as a valid subcommand to 'dump'. Change-Id: Iadb2b8ce36951ff36ffbf6b5ea349ba1e2b12582
2013-01-02Add single crunch command to aapt.Xavier Ducrohet
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. Change-Id: I635ee3e871d035b9db2fb593802d914e48241abf
2012-09-11Add --output-text-symbols option to aapt.Xavier Ducrohet
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-11Add --error-on-failed-insert option to aapt.Xavier Ducrohet
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-05-09Support a new ANDROID_AAPT_IGNORE env var.Raphael Moll
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-02-07Build overlay packages just like regular packages.Mårten Kongstad
Previously, building overlay packages required passing aapt its -o flag. This commit decouples the idmap generation code from the effects of the -o flag. Since this commit renders the -o flag obsolete, support for the flag was removed from aapt as well. Change-Id: Ied2e0ab8cb800e49623f0a2044b06cd4935473d5
2011-10-16New aapt feature to do smarter filtering of configurations.Dianne Hackborn
This adds a --preferred-configurations flag that specifies the specific configurations you would like to have. It is smarter than "-c" because it will avoid stripping a configuration if that would result in there being no value for the resource. It is dumber than "-c" because it can't process as many kinds of resources. It is really only intended for bitmaps and use with density configs. This required re-arranging AaptAssets to group files together by config again, like they used to be. I think this hasn't broken anything. Hopefully. Change-Id: I4e9d12ff6e6dbd1abb8fd4cb1814c6674b19d0e5
2011-07-20Added Caching for PreProcessed PNGsJosiah Gaskin
Added a cache management system for pre-processed PNG files along with unit tests. The cache system will be used if the --no-crunch flag is passed to AAPT during the package phase. The cache can be updated by a call to 'aapt crunch' (see usage statement). Also put in benchmarking code. Change-Id: I58271fb2ee2f5f9075fd74d4ff6f15e7afabd05c
2011-07-18Add generation of dependency file for .ap_ packageJosiah Gaskin
Make Aapt generate a dependency file in the same directory as the output ap_ file if the --generate-dependencies flag is set. This dependency file can then be read by the ant exec loop task to see whether to repackage resources. Change-Id: I763679414daf76369700aa599c26dcf78d4de099
2011-06-27Add dependency generation to Aapt for R.javaJosiah Gaskin
Make Aapt generate a dependency file in the location specified by RClassDir for R.java if the --generate-dependencies flag is set. This dependency file is then read by the ant exec loop task to see whether to recreate R.java. Change-Id: I7152dac86b6ea0e448ef65e3a95694afe233c789
2011-06-27Copy once-created R.java into library projectsJosiah Gaskin
This change adds functionality in Aapt to allow specification of library projects to copy the generated R.java file into rather than regenerating the file for each library project. Change-Id: I05939d1dc875bd875be9298ca47cb639235070c6
2011-04-01Runtime resource overlay, iteration 1.Mårten Kongstad
Runtime resource overlay allows unmodified applications to appear as if they had been compiled with additional resources defined. See libs/utils/README for more information. This commit is the first iteration of runtime resource overlay. It provides the actual overlay modifications and loading of trusted overlay packages (ie residing in /vendor) targeting framework-res.apk. This commit loads exactly one overlay package. The overlay, if present, must target framework-res.apk and be located at /vendor/overlay/framework/framework-res.apk. Change-Id: If26ee7754813004a96c043dba37fbe99fa3919db
2011-02-14Add --non-constant-id to aapt.Xavier Ducrohet
This option enbables creating resource constant in the R class that are not actual constant, but simply static fields. The goal is to build library projects with these types of IDs so that the constant does not get inlined in the library code, since the ID for the library resources only are not the final values. The final resource IDs, generated from the main project and its library(ies), will have proper constant with the final values. This allows us to generate binary library bundle (a jar file and associated resources) that can be distributed. Additionally, this will let us make the library project support in Eclipse much more robust and a better user experience overall. Change-Id: Ibe2f08d68493fde658fc3f7606abf7446f312ad2
2010-09-23Add an aapt option to allow string variations for different devices.Eric Fischer
The --product option to aapt is a comma-separated list of characteristics of the device being built for. For example, --product nosdcard,grayscale for a device with no SD card and a grayscale screen. Strings can specify a product="characteristic" option to cause that version of the string to be used only for that type of device. All such strings should also specify, at the end of the block, product="default", which will be used if none of the variations match. For example: <string name="choose" product="bw">Choose black or white</string> <string name="choose" product="grayscale">Choose a shade of gray</string> <string name="choose" product="default">Choose a color</string> The default characteristic will also be used when no --product option is specified. Change-Id: Ie6c1505599e02e15b7818e8be6ec47bc6ce71aaa
2010-08-31Add a --debug-mode option to aapt.Xavier Ducrohet
When passed (with no needed parameters) to the aapt command line, aapt will insert debuggable=true in the application node of the manifest automatically. This is to be used by the SDK tools to make true "debug" builds that require no code/file change. Change-Id: I6f0a7af7b7d51f26bb0ec012e6f142a6060b8618
2010-08-13Add --max-res-version flag to aapt.Ficus Kirkpatrick
aapt will ignore any versioned resource directories over the specified version (if used). e.g. --max-res-version=6 will cause layout-land-v7 to be ignored. Merged from froyo. Change-Id: Ia4eabae535b95b75d18b0c83135d44ed9a95b9eb
2010-03-18Fix minSdkVersion scanning to not throw warningsKenny Root
For the UTF8/UTF16 switch code, we needed to know what was the minSdkVersion specified as early as possible. Unfortunately, this threw warnings when the SDK was compiling since we always set this field in the Bundle. This splits out the field used by the initial AndroidManifest.xml scan to a separate one that we won't attempt to re-insert into the AndroidManifest.xml This also switches the logic to better reflect the preference of UTF-8 over UTF-16; previously UTF-16 was the default. Change-Id: Ia81f6b21047043ebb711eb24c2c3718534979ef6
2010-03-01Fix issue #2448075: aapt doesn't fix up activity-alias ↵Dianne Hackborn
android:targetActivity links And related: - The aapt tool now sets a resource configurations sdk level to match any configs that have been set (for example if you specify density your sdk level will be at least 4). - New option to modify the targetPackage attribute of instrumentation. - Clean up of aapt options help. - Fix of UI type values to leave 0 for "unspecified". - Make the UI mode config APIs public.
2010-02-04Add --auto-add-overlay option to aapt.Xavier Ducrohet
This option allows resources only present in overlays to be added automatically instead of being declared through <add-resource> Change-Id: Iff782311056f6a045193e57d204f7d3413e11b26
2010-02-01Add the --rename-manifest-package option to aapt.Jeff Hamilton
It allows you to force override the manifest package listed in the AndroidManifest.xml when creating an APK file. Change-Id: I7eac7943c4e56610b65728ae54773a273634fd9d
2009-12-11Revise aapt options for UTF8/16 encodingKenny Root
Remove option to force UTF-8 encoding which could corrupt packages meant for systems before API level 7. Added switch to allow encoding for UTF-16 which will allow API 7 and later to encode resources in UTF-16. Change-Id: I70d0bddb0dfd12dcbd08c95f613dcfe896ae680b