Commit graph

45 commits

Author SHA1 Message Date
Narayan Kamath
59c24c790a am 095c4515: Merge "Remove unused variables."
* commit '095c451541765c7efb9d5a8152f8ef15626ccedb':
  Remove unused variables.
2015-02-27 16:33:23 +00:00
Narayan Kamath
e886392c37 am 37a44faa: Merge "Store native libs aligned to PAGE_SIZE"
* commit '37a44faa7266c8a7e0cc5077a4c028d6f5bfa7f7':
  Store native libs aligned to PAGE_SIZE
2015-02-26 12:45:34 +00:00
Narayan Kamath
bc0d368896 Remove unused variables.
Follow up from 13e5965306.

Change-Id: I370e52acd998ce72b4d7dbf2aba604d4b08bb0cf
2015-02-26 12:40:34 +00:00
Dmitriy Ivanov
13e5965306 Store native libs aligned to PAGE_SIZE
- Add a new flag to zipalign (-p) that page aligns shared
  libraries (zip entries ending with ".so") in the archive.

- Add a new build variable LOCAL_PAGE_ALIGN_SHARED_LIBRARIES
  to turn on this behaviour in zipalign.

- Add a new LOCAL_JNI_SHARED_LIBRARIES_ZIP_OPTIONS to control
  zip behaviour.

Bug: 8076853
Bug: 19330157

Co-Authored-By: Simon Baldwin <simonb@google.com>
Co-Authored-By: Dimitry Ivanov <dimitry@google.com>
Change-Id: I1aa2c039bb2a590ae72f256acc9ba5401c2c59b1
2015-02-26 12:31:40 +00:00
Ying Wang
7c05897b69 am e937ac81: Merge "Add new build flag LOCAL_DONT_DELETE_JAR_DIRS."
* commit 'e937ac814c7f4e1989509f94f7ac8ae5b28a3526':
  Add new build flag LOCAL_DONT_DELETE_JAR_DIRS.
2015-01-29 18:05:13 +00:00
Fredrik Roubert
cc93f0c87c Add new build flag LOCAL_DONT_DELETE_JAR_DIRS.
Normally the build function initialize-package-file will delete all
class files and all directory entries from JAR files, but sometimes
external projects (eg. ICU4J) depend on having directory entries in
their JAR files.

This change adds the flag LOCAL_DONT_DELETE_JAR_DIRS (analogous to the
flag LOCAL_DONT_DELETE_JAR_META_INF) which when set will skip deletion
of directory entries in initialize-package-file.

Change-Id: I4464b947b7528fca23925affa95e4071915f04d4
2015-01-29 17:44:27 +00:00
Ying Wang
0f205ad959 am 29a29875: Merge "Running jarjar on Java resources."
* commit '29a29875627758aa3c76aa5256641c1782c904bf':
  Running jarjar on Java resources.
2015-01-22 00:13:33 +00:00
Ying Wang
07acdbfd32 Running jarjar on Java resources.
Before this change, Java resources are added as a separate step
(add-java-resources-to-package) after dex is run, so jarjar isn't run on
the resource files.
With this change, we add Java resources immediately after we call javac,
so jarjar is run on the resource files (the module's own resource, as
well as resources carried by static Java libraries).
When we generate the final apk/jar, we use the jarjar'ed jar as the
inital pacakge file, with class files and empty folders removed.

(cherry-picked from commit 140274707e)

Bug: 18837479
Change-Id: I15ecf282bfb65fd53dd03fbd03dd4c71927c186a
2015-01-21 11:57:52 -08:00
Ying Wang
98ae798535 Fix using variable intermediates.COMMON before defining.
In commit e9dd9f2bf we moved "include $(BUILD_SYSTEM)/android_manifest.mk"
forward before the variable intermediates.COMMON gets defined. That's a
mistake.
This change replaced the tentative variables
package_expected_intermediates_COMMON and guessed_intermediates with
their proper counterparts defined in base_rules.mk.
If their values differ in the two file, that's an error and we should
fix.

Bug: 18168693
Change-Id: I2bf17b0476b4a7f97810fbb0bde7630eb8878b53
2014-12-18 15:13:04 -08:00
Ying Wang
2902d4585f Add support for prebuilt AARs.
- You can give a .aar as source file to a prebuilt static Java library
  module. The build system will set up dependencies and rules to extract
  classes.jar and other resource files.
- To build against a prebuilt AAR module, use:
  LOCAL_STATIC_JAVA_AAR_LIBRARIES := <module names of aar prebuilt AARs>
  The build system will set up rules to merge the library's
  AndroidManifest.xml with the main AndroidManifest.xml, add the AAR's
  resource dirs and link/merge the AAR's classes.jar.

Bug: 18168693
Change-Id: Ic2c1d20572a93bd98dbc72f8a39e26b459e442c2
(cherry picked from commit e9dd9f2bfc)
2014-12-17 22:27:26 +00:00
Ying Wang
8070b20f9e Support to build dpi-specific apk variants.
In unbundled apps_only build, in addition to the base apk, you can also
build the dpi-specific apk variants, with:
LOCAL_DPI_VARIANTS := <a list of dpi names>

Previously user needs to include $(BUILD_PACKAGE) repeatedly with the
same package definition except dpi flags.
With this change, all the dpi-specific apk variants share the base apk's
compiled Java code and only diverge at the point we add resources/assets
to the apk.
Also we set up variables/targets/rules in a way those dpi-specific apks
appear to be independent apks to the users, for example, you can pass
"AppName_<dpi_name>" to tapas, and AppName_<dpi_name>.apk lives in its
own intermediate directory.

Bug: 18388705
Change-Id: I2ba4972ea7d1f796352fab2407888f996781ae44
2014-12-02 18:17:55 +00:00
Ying Wang
114a0fca3b Convert comma in split arguments to underscore.
aapt already does so.
Bug: 16947729

Change-Id: I813fb8cf41b3ec836e6e6d5f68af12dc385169f8
2014-10-01 12:01:04 -07:00
Ying Wang
4cb0499a5d Allow LOCAL_ASSET_DIR point to nonexistent dir
LOCAL_ASSET_DIR may point to a dir generated during the build process.
We have done similiar things to LOCAL_RESOURCE_DIR.

(cherry picked from commit bfcdf060ba)

Bug: 16563899
Change-Id: Iaa72196e1e6350ae0720f8a4e0abc68d8d7ed642
2014-09-20 14:16:09 -07:00
Ying Wang
db48da7844 Support to build apk odex for both arch.
Build odex for both arch in multilib build if an app has
LOCAL_MULTILIB := both.
Refactored the common setup code to a separate file setup_one_odex.mk.

Bug: 17409149
Bug: 14694978
Change-Id: I74c9426cd74fe0b0cb4811368f740a88ac2ae022
2014-09-13 18:14:15 -07:00
Ying Wang
934008f9d5 Don't apply PRODUCT_AAPT_PREF_CONFIG if LOCAL_PACKAGE_SPLITS is set
Bug: 16319961
Change-Id: I8ea308c94ff58eaccd8854ab98e11238b993f867
2014-07-30 13:40:14 -07:00
Ying Wang
7f625aad03 Improve rules of split apks.
- Better messaging if the expected split apk isn't generated by the aapt
  command in the base apk rule; Remove the built base apk, so make will
  rerun aapt after the user changes the splitting parameters.
- Use cleaner static pattern rules instead of running $(foreach) with
  $(eval).

Bug: 16319961
Change-Id: If6ae302e1a39d2e0db8f784d4e1cf292ec855281
2014-07-23 16:38:06 -07:00
Ying Wang
1425e2d8c0 Support LOCAL_PACKAGE_SPLITS.
Support LOCAL_PACKAGE_SPLITS, which accepts a list of resource lables
and generates multiple apks. The build system sets up rules to sign and
zipalign the split apks.

Bug: 16319961
Change-Id: I344b3d1c7eb158c6d0df879093d666a89870aadd
2014-07-22 17:37:11 -07:00
Ying Wang
efb935800b Support "LOCAL_SDK_VERSION := system_current"
A module can declare "LOCAL_SDK_VERSION := system_current" to build
against the android system stubs generated from source.
For now this is only supported in platform build.

Change-Id: I1e9bbd159886bc0ea3a02b1dc4cbcb1a56e9cb15
2014-07-19 17:00:50 -07:00
Ying Wang
af9757e849 New installation path for apks and their JNIs.
Apk's path is changed to <parent_dir>/MyApp/MyApp.apk;
JNI path is changed to <parent_dir>/MyApp/lib/<arch_name>/libfoo.so.
Symlinks of JNIs are changed accordingly.

Bug: 16319961
Change-Id: Ib3b2309c95fa9aea27837fcc29e28d990b04747b
2014-07-18 16:26:24 -07:00
Ying Wang
0e2b634408 am 01b179bf: am bb964f00: am 432cd6dd: Merge "Allow LOCAL_RESOURCE_DIR pointing to dir generated during the build"
* commit '01b179bf3b5c4c0307e0efb4004a1c44705fe780':
  Allow LOCAL_RESOURCE_DIR pointing to dir generated during the build
2014-06-25 23:21:30 +00:00
Ying Wang
01b179bf3b am bb964f00: am 432cd6dd: Merge "Allow LOCAL_RESOURCE_DIR pointing to dir generated during the build"
* commit 'bb964f00403a23d2f1ec3313f7b579a9e7f0f12a':
  Allow LOCAL_RESOURCE_DIR pointing to dir generated during the build
2014-06-25 23:03:02 +00:00
Ying Wang
904446ce0b am 1a3d260f: am e69d4350: Merge "Support to add JNI of both archs in multilib build."
* commit '1a3d260f68755b476aa867477fc75d47ef5317bf':
  Support to add JNI of both archs in multilib build.
2014-06-25 18:46:34 +00:00
Ying Wang
6129192ed6 Allow LOCAL_RESOURCE_DIR pointing to dir generated during the build
Bug: 15850610
Change-Id: I46b98adb556d8e6bf166761f8bb240006dbe5b14
2014-06-25 14:25:14 -07:00
Ying Wang
58f8cf7273 am 904446ce: am 1a3d260f: am e69d4350: Merge "Support to add JNI of both archs in multilib build."
* commit '904446ce0b3f430ac88ae0c08b9c613721474cd5':
  Support to add JNI of both archs in multilib build.
2014-06-25 18:52:02 +00:00
Ying Wang
8e20ef6205 Support to add JNI of both archs in multilib build.
Use "LOCAL_MULTILIB := both" to install jni libraries of both archs in
multilib build.
The build system will package jni of both archs to the apk, or install
them to the right location on the system image and create symlinks,
extract .so files from prebuilt apk, etc if appropriate.

Bug: 15849902
Change-Id: I7e147b5a47db476584c38250de7b36c75ea40d81
2014-06-25 09:07:01 -07:00
Ying Wang
b574564f2e Reinforce the dependency on package-export.apk.
This fixes the bug that if an app has no resource at all, we should
still set up the dependency on package-export.apk, because the
AndroidManifest.xml may still reference symbols in package-export.apk.

Change-Id: Idb3f12abf55c04824da5b666fe7c49694e227e2c
2014-06-19 16:07:30 -07:00
Ying Wang
cf68ba00d4 am dcf90646: am 8898f2e2: am f4999d3b: Merge "Fix pattern rules for for libdvm."
* commit 'dcf90646b0122b09755014832a67b7c44bc2e1ac':
  Fix pattern rules for $(installed_odex) for libdvm.
2014-05-28 21:36:11 +00:00
Ying Wang
dcf90646b0 am 8898f2e2: am f4999d3b: Merge "Fix pattern rules for for libdvm."
* commit '8898f2e261d1bb2b389971803a1f4a23639ade9e':
  Fix pattern rules for $(installed_odex) for libdvm.
2014-05-28 21:31:19 +00:00
Ying Wang
994c226b91 Fix pattern rules for $(installed_odex) for libdvm.
When the VM is libdvm, we don't put the odex files in an arch specific
subdirectory. The previous pattern rules don't work because of the extra
"/". With this change, % evaluates to empty string when it's built for
libdvm; % evaluates to "<arch_name>/" when it's built for libart.
Also removed use of $(create-empty-package), which may causes file name
(dummy) conflict with the rule of package.apk.

Bug: 15311527
Change-Id: I9f9089bc1896b78c1f47834afdb28a3a51d34480
2014-05-28 14:23:26 -07:00
Ying Wang
78ae0ad8df am 913e0317: am a72e6f80: am 8a3f514d: Merge "Split the rules to build the odex file"
* commit '913e031793928981640f51fa2e6480312f044c37':
  Split the rules to build the odex file
2014-05-22 02:38:52 +00:00
Ying Wang
913e031793 am a72e6f80: am 8a3f514d: Merge "Split the rules to build the odex file"
* commit 'a72e6f80e447acf225822eebdf752c0d8aa2590c':
  Split the rules to build the odex file
2014-05-22 02:34:02 +00:00
Ying Wang
36142f64ae Split the rules to build the odex file
Previously the odex file is byproduct generated by the package.apk rule.
Though we have the odex file depend on the package.apk it doesn't have
its own build recipe. In case package.apk isn't updated but we still
need to update the odex file (such as changed LOCAL_MULTILIB), the odex
file will never be rebuilt.
This change split out the rules to build the odex file and make sure the
build recipe get executed if the odex file needs rebuild.

Change-Id: I60c2f32b536b3d59045301ee863aae1451734aad
2014-05-21 16:24:59 -07:00
Brian Carlstrom
8d422a3a0b am 8074ff4d: am a8355eca: am 64f3a191: Merge "Multilib support for odex"
* commit '8074ff4d0f962a933586b9809d1f1bdffe1fe5ed':
  Multilib support for odex
2014-05-19 17:04:54 +00:00
Brian Carlstrom
8074ff4d0f am a8355eca: am 64f3a191: Merge "Multilib support for odex"
* commit 'a8355ecaadf9a0d052165d0cc14564927eb9a202':
  Multilib support for odex
2014-05-19 16:59:16 +00:00
Ying Wang
b9aa5d43de Multilib support for odex
If the VM is libart and DEXPREOPT is enabled,
- For a Java library and the boot image, we build for both 1st arch and
  2nd arch.
- For an app, we build for the multilib arch the module is targeted for.
The odex file will be in <arch_name>/<module_name>.odex inside the same
dir where the jar/apk file gets installed.
Nothing changed if it's built for libdvm.

Bug: 14694978
Change-Id: I45118a83758b41d52d6c9e38f93f0ba2775a6c74
2014-05-18 22:04:58 -07:00
Ying Wang
fff7583f86 am a59c2935: am 488b23d9: Merge "Update rules to install JNI libraries."
* commit 'a59c2935bc63babded85aa1ce1a8b00e28dc6a11':
  Update rules to install JNI libraries.
2014-04-19 00:05:09 +00:00
Ying Wang
695e826a0c Update rules to install JNI libraries.
Previously we have to use LOCAL_REQUIRED_MODULES to install jni
libraries for an apk in bundled build.
With this change, we'll use LOCAL_JNI_SHARED_LIBRARIES alone to
install jni shared libraries.

The new rules are:
- If we are doing unbundled build, or the apk isn't going to be
  installed to system partitions, we'll embed the jni libs in the
  built apk.
- Otherwise, the jni libraries will be installed to the system
  lib path, and symlinks created in the app specific lib path.

Change-Id: Id6bd5301eb632bda3593664acee580f0d8b1d5d4
2014-04-18 16:36:19 -07:00
Ying Wang
96bcad49f4 Update rules to install JNI libraries.
Previously we have to use LOCAL_REQUIRED_MODULES to install jni
libraries for an apk in bundled build.
With this change, we'll use LOCAL_JNI_SHARED_LIBRARIES alone to
install jni shared libraries.

The new rules are:
- If we are doing unbundled build, or the apk isn't going to be
  installed to system partitions, we'll embed the jni libs in the
  built apk.
- Otherwise, the jni libraries will be installed to the system
  lib path, and symlinks created in the app specific lib path.

Change-Id: Id6bd5301eb632bda3593664acee580f0d8b1d5d4
2014-04-18 10:38:53 -07:00
Adam Lesinski
5eebe0f1b4 Temporarily use a separate var for including shared resources
Change-Id: I56636a1d7dfdaa070706f1991f80e03fe2f71069
2014-03-25 17:00:35 -07:00
Ying Wang
dbe23f5d98 Set up dependency of resource_export_package
The rules to build $(resource_export_package) need also the
framework-res's and potentially other shared libraries' package-export.apks.

Change-Id: I9ff10c621917ba7eed2da11a51cd2426845ad9be
2014-03-25 14:42:46 -07:00
Adam Lesinski
de057c3063 Add LOCAL_APK_LIBRARIES to the AAPT -I flag
Change-Id: I5c5c90de3c8ce6c224b6e3fbf42d5e72cfd7a4d1
2014-03-25 13:52:17 -07:00
Andrew Hsieh
66a4ef8f75 am d14f3cc7: am 5384c187: Merge "Add LOCAL_NDK_STL_VARIANT:=c++_static and c++_shared"
* commit 'd14f3cc7bc9983ea5ba1c2d952d2b5f51935f42c':
  Add LOCAL_NDK_STL_VARIANT:=c++_static and c++_shared
2014-03-18 00:09:13 +00:00
Andrew Hsieh
73d800e519 Add LOCAL_NDK_STL_VARIANT:=c++_static and c++_shared
Add llvm libc++ static and shared libraries

Change-Id: I92af9b6ab21cbf8ea82e014a4c11aeb5455920f9
2014-03-17 20:30:45 +08:00
Colin Cross
2c32144b32 resolved conflicts for merge of 7cd7bd65 to klp-modular-dev-plus-aosp
Change-Id: Ib4f062a59d442b29b9782fd8c0328fd551c3a32a
2014-02-12 13:09:29 -08:00
Colin Cross
8e4041271d add support for module supported or unsupported target architectures
Add four new variables for module makefiles:

LOCAL_MODULE_TARGET_ARCH specifies that a module is only supported for
one or more architectures.  Any architecture not in the list will be
not attempt to build the module.  The expected use case is prebuilts
that are only suitable for a single architecture, or modules like llvm
that need per-architecture support.

LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH specifies that a module cannot be
built for one or more architectures.

LOCAL_MODULE_TARGET_ARCH_WARN and LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH_WARN
are the same, but warn that the arch is not supported, which is useful
for modules that are critical but not yet working.

The logic for whether or not to build an architecture is fairly
complicated, so this patch consolidates it into module_arch_supported.mk

Change-Id: I120caf4a375f484e1fd6017b60c2f53882ae01e6
2014-02-12 12:17:55 -08:00