Commit graph

50 commits

Author SHA1 Message Date
Yohann Roussel
f09e59eb52 [DO NOT MERGE] Compile using Jack.
This allows to compile dex targeted java sources using Jack and Jill.
Default is still to compile with the legacy toolchain. Default can be
switched to the new toolchain by setting environement variable:
export ANDROID_COMPILE_WITH_JACK=true
Toolchain can also be forced for one module by defining
LOCAL_JACK_ENABLED:=full # disabled, full, incremental
in the mk portion defining the module.

Jack execution environement can be controlled with:

Global variable ANDROID_JACK_VM allow to change the jvm executing Jack.
Global variable ANDROID_JACK_VM_ARGS allows to change default args given
to the jvm.
Global variable ANDROID_JACK_EXTRA_ARGS allows to define some default args
to give to Jack

LOCAL_JACK_VM_ARGS allows to override default args given to the jvm for
the module.
LOCAL_JACK_EXTRA_ARGS allows to override default args passed to Jack.

This includes cherry-picks of the following changes:
b4c49cba57
22c3fa6d73
138768c1bb
5dd3e1d312
83d5d04047
8bc90fd2d6
140274707e
0fbc9ff2a2
833b427d72
f9a27f45b4
2809666941
37822c443d
c6b44d43c3
d2a76c14bf
06744f60fc
95573d5036
b821391614
2794e7b582
801f2c44d0
c76d99dca1
f528e132d6
76a5e0bd1a
e25b3984ff Partially, only Jack related parts werekept
ec46a3b71f
abee3a9f41
77cbe10fd9
daf07db4cd
b6bfb5893a

Ie all Jack related changes untill
b6bfb5893a
except
a96cc59ab5 "Use Jack by default"

Change-Id: If9d47ef1c4fd1e6765ad2a47d816c1ad3cfab0e3
2015-05-19 18:31:05 +02:00
Dmitriy Ivanov
64762c3027 Do not pack relocations for prebuilts by default
Do not pack relocations for prebuilds unless
 LOCAL_PACK_MODULE_RELOCATIONS is true

Bug: http://b/20537715
Bug: http://b/18051137
Change-Id: Iddef3b09741da6ae10d73c98103b868cc7695d38
2015-04-24 15:33:14 -07:00
Nick Kralevich
5aa0223c6a Support LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES for prebuilt APKs
If a prebuilt APK contains shared libraries and the flag
LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES := true is set, then
uncompress any shared libraries stored within the APK.
This allows processes to load the shared library directly from
the APK.

Bug: 20247329
Bug: 8076853
Bug: 1162500
Change-Id: Iac4db32457d9ce31eb7256410023819b44fda0a6
2015-04-17 16:53:15 -07:00
Kenny Root
dff3755a93 Move package signing after file stripping
For dex preopt and JNI library extraction, we should remove the
classes.dex and .so files before we sign the APK so that there
isn't an entry in the manifest.

Prebuilt APKs which are pre-signed will simply not have the files
removed. This may cause some system.img bloat, but signature checks make
this necessary.

Bug: 20247329
Change-Id: I4742d1aa3aa64ab5aea2264304cb8c0bea24f784
2015-04-15 12:40:22 -07:00
Ying Wang
aaf9a5b0cc Remove ancient ranlib workaround on Mac OS X.
Apparently we don't need it for Mac OS X 10.7 and above.

Change-Id: I5ee81700c16e8c66b2d5f2b373fd2d523b5ec018
2015-04-09 10:06:33 -07:00
Ying Wang
c1729f3602 Strip prebuilt shared library by default.
Strip prebuilt shared library but not try adding gnu debuglink.
It would fail if you try run the adding gnu debuglink command if a
prebuilt is already stripped.

Bug: 17177288
Change-Id: If5811865715c2437e45fbd329983ef1212ef0109
(cherry picked from commit bfb52a2ec1)
2015-03-13 11:36:15 -07: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
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
b283ef2c3b am 18eee18e: am 60686586: Add product variable PRODUCT_AAPT_PREBUILT_DPI
* commit '18eee18e6e51da4857054376ad96add16c0c0b92':
  Add product variable PRODUCT_AAPT_PREBUILT_DPI
2014-12-11 00:07:38 +00:00
Ying Wang
18eee18e6e am 60686586: Add product variable PRODUCT_AAPT_PREBUILT_DPI
* commit '60686586a5f9c8f78b9ad16e19782da85e89a760':
  Add product variable PRODUCT_AAPT_PREBUILT_DPI
2014-12-10 22:19:49 +00:00
Ying Wang
60686586a5 Add product variable PRODUCT_AAPT_PREBUILT_DPI
We use search LOCAL_DPI_VARIANTS in the list of
"$(PRODUCT_AAPT_PREF_CONFIG) $(PRODUCT_AAPT_PREBUILT_DPI)"
and the first takes precedence.
That way if we don't have a best match, we fall back to the second best,
the way how it worked with PRODUCT_AAPT_CONFIG previously.

Bug: 18388705
Change-Id: I8bd646c52215c65cc6e38c728857af9b64d13469
2014-12-10 12:40:09 -08:00
Ying Wang
0217e3b20b resolved conflicts for merge of a4f415d6 to lmp-mr1-dev-plus-aosp
Change-Id: Ibb54bce20342bd386ec85388d48c1c08e8b80197
2014-11-18 16:28:04 -08:00
Ying Wang
a4f415d65e am ea4dfb75: Merge "Support prebuilt apk source selection based on PRODUCT_AAPT_PREF_CONFIG" into lmp-mr1-dev
* commit 'ea4dfb7551e680f7496e1d35c05bdad10ca58b4a':
  Support prebuilt apk source selection based on PRODUCT_AAPT_PREF_CONFIG
2014-11-19 00:23:00 +00:00
Ying Wang
43f7a3226a Support prebuilt apk source selection based on PRODUCT_AAPT_PREF_CONFIG
Two new LOCAL variables are added to support dpi-specific prebuilt apk
selection:
- LOCAL_DPI_VARIANTS: specify a list of dpis the module provides with
  specific prebuilt.
  Example: LOCAL_DPI_VARIANTS := xxhdpi xhdpi hdpi mdpi
- LOCAL_DPI_FILE_STEM: specify the dpi-specific source file name
  pattern.
  Example: LOCAL_DPI_FILE_STEM := MyApp-%.apk
  "%" will be substitued by $(PRODUCT_AAPT_PREF_CONFIG) in the core
  build system.
  If you don't set up LOCAL_DPI_FILE_STEM, the default is
  $(LOCAL_MODULE)_%.apk.

The build system searches $(PRODUCT_AAPT_PREF_CONFIG) in a prebuilt apk
module's $(LOCAL_DPI_VARIANTS). If not found, use whatever
$(LOCAL_SRC_FILES) as the source file; Otherwise use $(LOCAL_DPI_FILE_STEM)
to construct the dpi-specific apk's source file name, and use whatever
directory name of $(LOCAL_SRC_FILES).

Bug: 18388705
Change-Id: I63cae73f1b6f880302142abc476b3ce1fb5500b5
2014-11-17 17:05:27 -08:00
Dan Albert
5245bc8b34 am 201f6b3e: Merge "Make modules depend on their makefile."
* commit '201f6b3e92a2ef2f3a117f33cd399d5304dd385a':
  Make modules depend on their makefile.
2014-11-11 22:56:01 +00:00
Dan Albert
954b5bdcf4 Make modules depend on their makefile.
This should obviate much of the need for cleanspecs, and also make it
unnecessary to continue adding LOCAL_ADDITIONAL_DEPENDENCIES for this
sort of thing all over the tree.

Change-Id: I97aa8fd280ae868a5f6364f8b7bf3c2fe235d6ce
2014-11-11 14:30:54 -08:00
Ying Wang
007026f0eb am 3fe170c5: Merge "Add support for prebuilt AARs." into lmp-mr1-ub-dev
* commit '3fe170c51ea1eca253164fa8738ab42b5b9aaa6b':
  Add support for prebuilt AARs.
2014-11-03 18:07:45 +00:00
Nick Kralevich
0a5105bd25 am e4cbc2af: Merge "Revert "Add support for prebuilt AARs."" into lmp-mr1-ub-dev
* commit 'e4cbc2af5f476d9eb875253584260bed807acddf':
  Revert "Add support for prebuilt AARs."
2014-11-02 16:53:29 +00:00
Ying Wang
e9dd9f2bfc 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
2014-11-02 16:51:49 +00:00
Nick Kralevich
bcf8683b29 Revert "Add support for prebuilt AARs."
master doesn't compile anymore.

This reverts commit f567292504.

Change-Id: Icc16fe5360d1222740b803e9dd006081e3c66e46
2014-11-02 05:11:11 +00:00
Ying Wang
4ef8133a42 am f5672925: Add support for prebuilt AARs.
* commit 'f56729250448200834c5c95c86c937e887d73623':
  Add support for prebuilt AARs.
2014-10-31 00:13:50 +00:00
Ying Wang
f567292504 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: I478913d5d498f800b322529d7c2c2c0ea78425e5
2014-10-29 23:40:52 +00:00
Ying Wang
230afab744 am e4e50f9b: am 8330c4c5: Merge "Apply LOCAL_CXX_STL to also prebuilts."
* commit 'e4e50f9bb4ae8af11aaddf9825a09ff33241b204':
  Apply LOCAL_CXX_STL to also prebuilts.
2014-10-07 23:23:15 +00:00
Ying Wang
4019305580 am e4e50f9b: am 8330c4c5: Merge "Apply LOCAL_CXX_STL to also prebuilts."
* commit 'e4e50f9bb4ae8af11aaddf9825a09ff33241b204':
  Apply LOCAL_CXX_STL to also prebuilts.
2014-10-07 23:20:51 +00:00
Ying Wang
75e8fcbb6c Apply LOCAL_CXX_STL to also prebuilts.
Because LOCAL_CXX_STL modifies a module's required shared libaries,
we need this for also prebuilt shared libraries and executables.

Change-Id: I418c26143999a613c40aadf990f131b123e0ac3d
2014-10-07 13:07:00 -07:00
Andreas Gampe
5e0dbe0c37 Conditionally skip dex-preopting prebuilts.
To skip dex-preopting prebuilts (to save system image space),
set "DONT_DEXPREOPT_PREBUILTS := true".

Bug: 17772057

Change-Id: I13f10e2a9c251366f29606158f8c2fb54f8ee8b1
2014-10-02 10:14:59 -07:00
Ying Wang
00fe587974 Support to install prebuilt split APKs with LOCAL_PACKAGE_SPLITS
In prebuilt app module, you can use LOCAL_PACKAGE_SPLITS to specify a
list of prebuilt split apks. The build system will sign and zipalign the
apks and install them with the same file names.
Note that you need to put all the source split apks in the same folder.

Bug: 16319961
Change-Id: Id2b6d743c1edc5e436007ec11acece1748adad45
2014-07-23 14:38:02 -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
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
01c4f4622b am dceddd91: am 79b46720: am 02f98a26: Merge "Fix loophole in module expansion."
* commit 'dceddd91d9a6516346e752b9f942747bea931cfa':
  Fix loophole in module expansion.
2014-06-11 20:49:20 +00:00
Ying Wang
e1b867dde7 Fix loophole in module expansion.
Previously we only expanded product_MODULES with LOCAL_REQUIRED_MODULES,
but not modules introduced by LOCAL_SHARED_LIBRARIES; Later we did a further
shared libary expansion in vendor_module_check.mk.
It couldn't track C in the following case:
A : B, by LOCAL_SHARED_LIBRARIES; B : C, by LOCAL_REQUIRED_MODULES.

With this change, we transformed the LOCAL_SHARED_LIBRARIES dependencies
into LOCAL_REQUIRED_MODULES dependencies before doing the required
module expansion and the loophole is closed.
All module names are now expanded to product_MODULES now and it makes
vendor_module_check.mk simpler.

Change-Id: I8835a478d2ce0ce10601a8449f446f07b01c2b7f
2014-06-10 14:30:30 -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
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
Ying Wang
7cf9f28b5f Support to extract JNI libs from prebuilt APK
Use LOCAL_PREBUILT_JNI_LIBS to install prebuilt JNI libraries extracted
from the prebuilt apk, or prebuilts as source, to the app specific lib path.
LOCAL_PREBUILT_JNI_LIBS accepts 2 kinds of files:
- Files like @path/to/libfoo.so (path inside the apk) are JNI libs
  extracted from the prebuilt apk. In this case, all embedded JNI libs
  inside the prebuilt apk are stripped.
- Files like path/to/libfoo.so (path relative to LOCAL_PATH) are
  prebuilts in the source tree.

Those prebuilt JNI libs are not defined as modules in the build system,
so this works around possible module name conflict.

Bug: 13170859
Change-Id: I91bb844cc11b3621a85733bc7e8910f168957ef0
2014-05-20 18:02:17 -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
64f3a191f9 Merge "Multilib support for odex" 2014-05-19 16:50:17 +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
a27da32b69 am e75315fd: am 002f3c28: am 4636abe5: Merge "Real "LOCAL_MULTILIB := both" for prebuilts"
* commit 'e75315fdef200600f280f829089fd8d32e662b2e':
  Real "LOCAL_MULTILIB := both" for prebuilts
2014-05-17 03:13:51 +00:00
Ying Wang
34d5f1b27e Real "LOCAL_MULTILIB := both" for prebuilts
This uses the fact that unsetting LOCAL_MULTILIB equals "either".
It's useful to build for both 32-bit and 64-bit in the same prebuilt
module definition.

Bug: 13751317
Change-Id: I4f1625a83e13f22f807039afebae73f69ed35918
2014-05-16 10:49:57 -07:00
Ying Wang
8200231ae1 am e50f2d9f: am 40b49d30: am a74ade94: Merge "Support host multilib build"
* commit 'e50f2d9f32a27d8290692dbf99ab8b247ef9d553':
  Support host multilib build
2014-05-15 01:09:49 +00:00
Ying Wang
6feb6d5607 Support host multilib build
This change basically ported our target multilib to the host side.
It supports 2 host build modes: x86 and x86_64 multilib build.
For now you need to set "BUILD_HOST_64bit=true" to switch to x86_64
multilib build. Later we'll default to x86_64 build and have a flag
to force 32-bit only build, which may be needed by SDK build.

In host module definition, like in target ones, you can use the
following
LOCAL variables to set up multilib configuration:
LOCAL_MULTILIB: can be "both", "first", "32" or "64".
It also supports the same set of arch or 32-vs-64 specific LOCAL
variables.
By default, it builds only for the first arch.

To keep path compatibility, in x86_64 build files are still output to
out/host/linux-x86; Both 32-bit and 64-bit executables are in
out/host/linux-86/bin;
In x86_64 build 32-bit shared libraries are installed to
out/host/linux-x86/lib32
and 64-bit shared libraries are installed to out/host/linux-x86/lib;
32-bit object files are output to out/host/linux-x86/obj32 and 64-bit
object files
are output to out/host/linux-x86/obj.

Bug: 13751317
Change-Id: I6044f83b7db369a33e05209e8c588eb6dc83409f
2014-05-14 16:55:04 -07:00
Ying Wang
74eb6600b4 Support to extract JNI libs from prebuilt APK
Use LOCAL_PREBUILT_JNI_LIBS to install prebuilt JNI libraries extracted
from the prebuilt apk, or prebuilts as source, to the app specific lib path.
LOCAL_PREBUILT_JNI_LIBS accepts 2 kinds of files:
- Files like @path/to/libfoo.so (path inside the apk) are JNI libs
  extracted from the prebuilt apk. In this case, all embedded JNI libs
  inside the prebuilt apk are stripped.
- Files like path/to/libfoo.so (path relative to LOCAL_PATH) are
  prebuilts in the source tree.

Those prebuilt JNI libs are not defined as modules in the build system,
so this works around possible module name conflict.

Bug: 13170859
Change-Id: I91bb844cc11b3621a85733bc7e8910f168957ef0
2014-04-18 20:13:41 -07: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
Ying Wang
f0534c2897 LOCAL_CERTIFICATE only applies to APPS.
Change-Id: Iae8c62f1686736f3ce21a2eb6b82fedc9fd12125
2014-04-15 11:12:21 -07:00
Ying Wang
6c930fc1c9 Select src arch for prebuilts.
Change-Id: I2d08f923d28d59cfef93ff0bd9893352baaee60b
2014-02-27 18:25:29 -08:00
Ying Wang
c0adfb76cd Select src arch for prebuilts.
Change-Id: I2d08f923d28d59cfef93ff0bd9893352baaee60b
2014-02-27 17:24:12 -08:00
Ying Wang
58f462fccf Fix prebuilt library dependency for multilib build
Also we don't need to include module_arch_supported.mk again, if we are
currently substituting the source build with LOCAL_PREBUILT_MODULE_FILE.

Change-Id: I444b0397d74c3153b398a050b762e49418062a86
2014-02-25 18:32:27 -08:00
Colin Cross
e18cb93e48 support LOCAL_MODULE_TARGET_ARCH for prebuilts
Prebuilts often support only a single architecture, allow them to
use LOCAL_MODULE_TARGET_ARCH to specify it.

Change-Id: I2514f66f682ef267bbf1a1ab78510faff0a18b64
2014-02-13 15:36:41 -08:00