Commit graph

88 commits

Author SHA1 Message Date
Yohann Roussel
4a01711267 Merge "Always start jack server before first call to jack" 2015-12-22 13:59:49 +00:00
Shinichiro Hamaji
f972a4a980 Reduce unnecessary rebuilds of .dex files with restat=1
The .dex.toc files are created by dexdump, which outputs all
information in a .dex file which may affect compilation of
other modules.

For prebuilt java libraries and static java libraries, we'll
output empty .toc files and don't set restat=1. .dex.toc files
are necessary even for static java libraries because they can
be referenced by LOCAL_JAVA_LIBRARIES (instead of
LOCAL_STATIC_JAVA_LIBRARIES).

We don't use this optimization for apps build. We cannot build
dexdump for apps build due to lack of libc++.

Performance:

$ m && touch \
  frameworks/base/core/java/com/google/android/util/Procedure.java \
  && time m
Before: 3m48s
After: 1m46s

Bug: 24597504
Change-Id: Id1665923b414dee705dc60af4c021390a19ea26f
2015-12-14 19:07:34 +09:00
Yohann Roussel
9214a26cfc Always start jack server before first call to jack
Also install and update the server if necessary.

The target start-jack-server produces no file so it's always built.
Since the dependency is "order only", it doesn't cause force rebuilt of
jack targets after start-jack-server execution.

Bug: 25443108

Change-Id: I1608d87d186694d47307e00337b1905f0b8079c4
2015-12-09 22:00:50 +01:00
Alex Klyubin
5b826ac609 Do not run zipalign when building APK (except prebuilts).
This changes the build system to no longer run zipalign except for
those prebuilts which do not need to re-signed.

Running zipalign is no longer needed because signapk takes care of
alignment. For those prebuilts which do not need to be re-signed
signapk is not invoked and thus zipalign is still needed because the
prebuilts may not have been aligned properly. This exemption will go
away once prebuilts are properly aligned.

Bug: 25794543
Change-Id: I31f10af80b9baa3c9481cb36f41e5e5046e852f9
2015-12-04 10:15:06 -08:00
Shinichiro Hamaji
89b255ab71 Use .KATI_RESTAT to reduce unnecessary rebuilds of .jar files
The same optimization was done for binaries in

https://android-review.googlesource.com/#/c/175250/

To create a TOC file from .jar files, this change introduces
ijar, which is designed for this purpose. Only #include lines
were modified from the original version.

https://github.com/bazelbuild/bazel/tree/master/third_party/ijar

Performance:

$ m && touch
frameworks/base/core/java/com/google/android/util/Procedure.java && time
m
Before: 4m30s (1580 targets)
After: 3m57s (772 targets)

Unfortunately, the improvement is small yet, but local
experiments showed we can cut ~2 more minutes if the similar
optimization is done for .dex files.

(cherry picked from commit c1f5d9c203)

Bug: 24597504
Change-Id: Iec3b2b0b0e674bee5d80cce3c300dc8fad6e7c13
2015-11-30 11:16:23 -08:00
Shinichiro Hamaji
2ff3ad9045 Merge "Revert "Use .KATI_RESTAT to reduce unnecessary rebuilds of .jar files"" 2015-11-27 03:59:30 +00:00
Shinichiro Hamaji
3ae7f66bab Revert "Use .KATI_RESTAT to reduce unnecessary rebuilds of .jar files"
This reverts commit c1f5d9c203.

Change-Id: I7e9969a060e3f1380154da65e76134168aee15d8
2015-11-27 03:58:51 +00:00
Shinichiro Hamaji
c9a1b27845 Merge "Use .KATI_RESTAT to reduce unnecessary rebuilds of .jar files" 2015-11-26 05:25:58 +00:00
Shinichiro Hamaji
c1f5d9c203 Use .KATI_RESTAT to reduce unnecessary rebuilds of .jar files
The same optimization was done for binaries in

https://android-review.googlesource.com/#/c/175250/

To create a TOC file from .jar files, this change introduces
ijar, which is designed for this purpose. Only #include lines
were modified from the original version.

https://github.com/bazelbuild/bazel/tree/master/third_party/ijar

Performance:

$ m && touch
frameworks/base/core/java/com/google/android/util/Procedure.java && time
m
Before: 4m30s (1580 targets)
After: 3m57s (772 targets)

Unfortunately, the improvement is small yet, but local
experiments showed we can cut ~2 more minutes if the similar
optimization is done for .dex files.

Bug: 24597504
Change-Id: Id54953aea25e497c8ebbe783b03f13b488577c6a
2015-11-19 17:10:35 +09:00
Colin Cross
d6f389299c Support LOCAL_ACP_UNAVAILABLE for prebuilts
Files built by soong will be installed using BUILD_PREBUILT, and may
include prerequesites of the acp binary.  Allow specifying
LOCAL_ACP_UNAVAILABLE:=true on prebuilts.

Change-Id: Iccfe61092f90b61f397a45f5334b0c1c0f439b32
2015-11-16 17:46:10 -08:00
Dan Albert
52831d118c Allow globally disabling the relocation packer.
The relocation packer is part of prebuilts/misc, and pulling that
repository into the manifest requires pulling in a lot of other things
not needed by the simpler builds (like the clang toolchain manifest).

Bug: http://b/17441393
Change-Id: If4a94804fc1a3f81215b840247f8e332d0b510c1
2015-11-12 15:27:49 -08:00
Yohann Roussel
b2c5558435 Clean call-jack and its callers
This is possible now that we have the new Jack server.
Also fix dependency from dex/jack target to jack script
instead of jack.jar.

(cherry picked from commit 5e50b34221)

Change-Id: I8e7aa5087ba8d73cc93140ddfca8f4ab2f505175
2015-10-21 17:02:25 +02:00
Colin Cross
7ee3b85eba resolved conflicts for 953981db to stage-aosp-master
Change-Id: Ic1003a594ac5e5e91b124f249a569fb81123e973
2015-09-28 18:45:23 -07:00
Colin Cross
a4447e8c89 Don't add dependencies on Makefiles when using ninja
Ninja has an implicit dependency on the command being run, and kati will
regenerate the ninja manifest if any read makefile changes, so there is no
need to have dependencies on makefiles.
This won't catch all the cases where LOCAL_ADDITIONAL_DEPENDENCIES contains
a .mk file, because a few users of LOCAL_ADDITIONAL_DEPENDENCIES don't
include base_rules.mk, but it will fix the most common ones.

Bug: 23566977
Change-Id: I66de882421376303ab7233c8ce7274548f6b2199
2015-09-28 16:29:52 -07:00
Ying Wang
226eb92321 Uncompress .so files before signing the apk.
- In uncompress-shared-libs we may strip .so files not for the current
  TARGET_ARCH. So we need to strip first and then sign the apk.
- For PRESIGNED apks, make sure we don't strip the .so files even if
   they are "fat".

Bug: 21571418
Bug: 8076853
Change-Id: Ifd1193dda0c2cd52ac148064ce5a32bcdd03f75c
2015-06-01 19:19:57 -07:00
Ying Wang
1fb0152ff7 Don't extract jni from prebuilt apks.
- We don't need LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES now, for we always
  page-align jni shared libraries and store them umcompressed.
- For prebuilt apks, we don't extract jni any more; Instead we always run
  uncompress-shared-libs on them.
- For apks built from source, we still install the jni separately, because
  that way multiple apks can share the same jni and it saves space.

With this change, for most prebuilt apks, we don't need to specify
LOCAL_PREBUILT_JNI_LIBS ("@lib/<abi>/foo.so") any more, for the build
system automatically replaces the embedded jni with uncompressed files;
But if a prebuilt is a fat apk (i.e. containing jni not needed by the
current product architecture), you still need LOCAL_PREBUILT_JNI_LIBS to
specify what jni to keep. Otherwise all embedded jni will be replaced with
uncompressed files, that wastes space.

Bug: 8076853
Change-Id: Ic3666dc72bf17cd293787414dd185470b365f967
2015-06-01 19:19:45 -07:00
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
Ying Wang
97dfa3177d Revert "Don't extract jni from prebuilt apks."
This reverts commit 3797466fbd.

Bug: 20810492
Bug: 20811499
Change-Id: Ic922d9daccc4550db489c0f3d4ad6b4ff85b5e60
2015-05-04 18:39:46 +00:00
Ying Wang
3797466fbd Don't extract jni from prebuilt apks.
- We don't need LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES now, for we always
  page-align jni shared libraries and store them umcompressed.
- For prebuilt apks, we don't extract jni any more; Instead we always run
  uncompress-shared-libs on them.
- For apks built from source, we still install the jni separately, because
  that way multiple apks can share the same jni and it saves space.

With this change, for most prebuilt apks, we don't need to specify
LOCAL_PREBUILT_JNI_LIBS ("@lib/<abi>/foo.so") any more, for the build
system automatically replaces the embedded jni with uncompressed files;
But if a prebuilt is a fat apk (i.e. containing jni not needed by the
current product architecture), you still need LOCAL_PREBUILT_JNI_LIBS to
specify what jni to keep. Otherwise all embedded jni will be replaced with
uncompressed files, that wastes space.

Bug: 8076853
Change-Id: Icf07e0998ac3602e6e05e80fed836fbafca33e01
2015-05-01 16:09:58 -07:00
Ying Wang
ffe376b49e Fix jack transformation on prebuilt AAR.
Change-Id: I74f932cff606138943d97b923bbd059bcd496e46
2015-04-30 09:55:08 -07:00
Dmitriy Ivanov
155d7cc845 am 7347196a: am df7afb47: am 3b023915: am 4fa4e4be: Merge "Do not pack relocations for prebuilts by default"
* commit '7347196acbf640caaf68e4e790489a40d770a083':
  Do not pack relocations for prebuilts by default
2015-04-24 23:36:21 +00: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
e128152c4c am ebe3f7a5: am 700265ce: am 69b20474: Merge "Support LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES for prebuilt APKs"
* commit 'ebe3f7a59878d797f8f0de234f251958fee1c5af':
  Support LOCAL_PAGE_ALIGN_JNI_SHARED_LIBRARIES for prebuilt APKs
2015-04-18 01:33:09 +00: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
Ying Wang
87a21c8b89 resolved conflicts for merge of eec386a4 to master
Change-Id: Ia686e67ed480427a6422d87bef2dcd4e44e27266
2015-04-15 14:39:26 -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
Yohann Roussel
77cbe10fd9 Use Jack launcher
Bug: 20132430
Change-Id: I6e30ad3dffbb32824a4c62e562359b084e6a8784
2015-04-15 12:29:01 +02: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
4972d195dd 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 09:45:39 -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
Yohann Roussel
801f2c44d0 Allow to pass arguments to Jill
Bug: 19026410
Change-Id: I3f3d7c0e7f8d6cc7150ae560b8734093798e8299
2015-03-05 14:54:06 +01:00
Narayan Kamath
7a9e388405 am 738871f6: am e886392c: am 37a44faa: Merge "Store native libs aligned to PAGE_SIZE"
* commit '738871f6eb3c372b60928e761f0dc24e46a6bba5':
  Store native libs aligned to PAGE_SIZE
2015-02-26 12:58:11 +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
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
Yohann Roussel
1d58de3b0a Merge "Adapt to Jack and Jill Brest release" 2014-12-11 12:28:16 +00:00
Ying Wang
43ad7b9eba am b283ef2c: am 18eee18e: am 60686586: Add product variable PRODUCT_AAPT_PREBUILT_DPI
* commit 'b283ef2c3bf76a268e216ba66d0d9cf97d7b97ea':
  Add product variable PRODUCT_AAPT_PREBUILT_DPI
2014-12-11 01:39:26 +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
Yohann Roussel
22c3fa6d73 Adapt to Jack and Jill Brest release
Includes cherry-picks of:
2e78d2f4263bc7c0f90d58af7014017f16aa3ce6 Jack option --import-res was renamed --import-resource
fdc913ee86fe0c45581178b901a673fdd7937e03 Update references to Jack type collison policy
8d83d1b21ec678fb9fb1c6ee643ace46d5f700ce Rename jill tmp file
8a1c98ce4ba0b4db39f274d6258b6a08bbc3ec2c Ensure that jar-arg-list is never shared
8d83d1b21ec678fb9fb1c6ee643ace46d5f700ce Remove manipulations of jack libraries

Change-Id: I3ee159d408ba5281ac15c9836dc4fd2bdeb845d3
2014-12-10 15:41:56 +01:00
Yohann Roussel
b4c49cba57 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_USE_JACK:=true # false
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.

Change-Id: Ib81a0fd5f86a51d1e0edbb81cc791d828a05dd29
2014-12-02 18:11:13 +01:00
Ying Wang
f9c93d7cbd am 0217e3b2: resolved conflicts for merge of a4f415d6 to lmp-mr1-dev-plus-aosp
* commit '0217e3b20b6a331b0820014dc136d782070bca45':
  Support prebuilt apk source selection based on PRODUCT_AAPT_PREF_CONFIG
2014-11-19 00:33:48 +00: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
6da20991fd am 5245bc8b: am 201f6b3e: Merge "Make modules depend on their makefile."
* commit '5245bc8b3421b3a9676a9ad650d0804d8d9e2787':
  Make modules depend on their makefile.
2014-11-11 23:00:40 +00: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
f4053c70e4 am 007026f0: am 3fe170c5: Merge "Add support for prebuilt AARs." into lmp-mr1-ub-dev
* commit '007026f0ebf2216d875b9fdab44cc68b659e2307':
  Add support for prebuilt AARs.
2014-11-03 18:11:53 +00: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