Commit graph

107 commits

Author SHA1 Message Date
Ying Wang
8c89b4b546 Make sure my_src_jar is set up properly for host prebuilt jar
Make sure my_src_jar is set up properly for host prebuilt jar when we
need to generate host .jack for host dalvik java libraries.

(cherry picked from commit 86e74b96fc)

Change-Id: I79393bc416fafb6d9cd28b12070a58ae5731587d
2016-02-23 10:54:30 -08:00
Alex Klyubin
0c5c50997b Merge "Sign APKs using SHA-256 instead of SHA-1 when possible." into nyc-dev 2016-02-11 18:50:12 +00:00
Alex Klyubin
b05b62df2e Sign APKs using SHA-256 instead of SHA-1 when possible.
This changes the build system to provide the signapk tool with the
minSdkVersion of the APK being signed. signapk in turn will then use
SHA-256 instead of SHA-1 if minSdkVersion is 18 (JB MR2) or higher
(see c2c49ed0c1).

To avoid increasing incremental OTA update package sizes for already
released platforms, release build scripts disable the above logic when
signing target files ZIPs for pre-N platforms.

Bug: 25643280

(cherry picked from commit 2cfd1d108c)

Change-Id: I38450d07ddc05c705de40313f843beada8db7d98
2016-02-10 17:19:08 -08:00
Yohann Roussel
d87cc99af2 Remove usages of jill.jar, use jack instead
Bug: 27113650
(cherry picked from commit d0bb7bdf5a)

Change-Id: I218ed2bda032b00bee4c52994a0aadce6d699133
2016-02-10 18:05:38 +01:00
Dan Willemsen
2685fbd5de Merge "Fix typo" am: 342037c0cf
am: 5f5ad2d2ea

* commit '5f5ad2d2ea41bdc68ed21b3713e60a5613664b9b':
  Fix typo
2016-02-02 18:04:40 +00:00
Dan Willemsen
5709bd55f3 Fix typo
This was producing a number of unused source warnings for prebuilt files
using LOCAL_SRC_FILES_<arch>.

Change-Id: I48d1face7baf642f3ef17f957448ccb73788765f
2016-02-01 21:48:41 -08:00
Dan Willemsen
917de453ee Merge "Order objects based on LOCAL_SRC_FILES and LOCAL_GENERATED_SOURCES" am: 224466b1af
am: 991c840313

* commit '991c8403131dc5781d3d4a1d10d292dc99fee202':
  Order objects based on LOCAL_SRC_FILES and LOCAL_GENERATED_SOURCES
2016-01-30 02:49:08 +00:00
Alex Klyubin
357902b9de Merge "Revert "Sign APKs using SHA-256 instead of SHA-1 when possible." This is breaking CTS." am: 01ac26d942
am: 1cafe66be2

* commit '1cafe66be274a5a8bbbc3a0dcab9d4e8f6e5ae61':
  Revert "Sign APKs using SHA-256 instead of SHA-1 when possible." This is breaking CTS.
2016-01-30 00:04:25 +00:00
Alex Klyubin
061289c432 Revert "Sign APKs using SHA-256 instead of SHA-1 when possible." This is breaking CTS.
This reverts commit c2a36afd67.

Change-Id: I4389bf99aeb213198c1c501ba9462bd4a4540d0a
2016-01-29 23:56:44 +00:00
Alex Klyubin
d0aefe7947 Merge "Sign APKs using SHA-256 instead of SHA-1 when possible." am: 50f872c696
am: 7a86884a9a

* commit '7a86884a9a3474a926d30f7afdf0b7a3d307dd81':
  Sign APKs using SHA-256 instead of SHA-1 when possible.
2016-01-29 20:25:10 +00:00
Alex Klyubin
c2a36afd67 Sign APKs using SHA-256 instead of SHA-1 when possible.
This changes the build system to provide the signapk tool with the
minSdkVersion of the APK being signed. signapk in turn will then use
SHA-256 instead of SHA-1 if minSdkVersion is 18 (JB MR2) or higher
(see c2c49ed0c1).

To avoid increasing incremental OTA update package sizes for already
released platforms, release build scripts disable the above logic when
signing target files ZIPs for pre-N platforms.

Bug: 25643280

(cherry picked from commit de5bc04717)

Change-Id: I4b100750e47788ab6ed897a0a5abfd33542e8676
2016-01-29 10:17:02 -08:00
Dan Willemsen
3bb168f10d Order objects based on LOCAL_SRC_FILES and LOCAL_GENERATED_SOURCES
We have been reordering objects to the linker based on how they were
generated. In soong, they're ordered based on the order listed in the
src_files.

Keep track of which source files created which object files so that we
can create the ordered list. Optionally change the order, based on
BINARY_OBJECTS_ORDER. That way we can compare make and soong builds.

Since we're keeping track of the used source files, warn when an entry
in LOCAL_SRC_FILES is not used. (whether it is an unused file like a
header, or a typo)

LOCAL_GENERATED_SOURCES is not verified, since it is valid to add
headers and other files in that list (to set up dependencies).

Change-Id: I1dfbbb3aa570c11c1db3b7133e46ed0b8c3b8989
2016-01-27 16:48:02 -08:00
Alex Klyubin
fcc3e3915d Merge "Revert "Sign APKs using SHA-256 instead of SHA-1 when possible."" am: 4a97cde443
am: e40660247d

* commit 'e40660247dfb4260fff31ba38b2869f644e1329b':
  Revert "Sign APKs using SHA-256 instead of SHA-1 when possible."
2016-01-27 17:56:21 +00:00
Alex Klyubin
a80a8085e0 Revert "Sign APKs using SHA-256 instead of SHA-1 when possible."
This reverts commit 74df828cb5. This commit is breaking a build, again...

Change-Id: I2df561d68302ba4c83e90a64a7bf203645033a3b
2016-01-27 17:45:42 +00:00
Alex Klyubin
6c125375b0 Merge "Sign APKs using SHA-256 instead of SHA-1 when possible." am: 72d152f478
am: 5132fe2ef9

* commit '5132fe2ef9f29bd748a8d34898bd183ef257e937':
  Sign APKs using SHA-256 instead of SHA-1 when possible.
2016-01-27 17:04:09 +00:00
Alex Klyubin
74df828cb5 Sign APKs using SHA-256 instead of SHA-1 when possible.
This changes the build system to provide the signapk tool with the
minSdkVersion of the APK being signed. signapk in turn will then use
SHA-256 instead of SHA-1 if minSdkVersion is 18 (JB MR2) or higher
(see c2c49ed0c1).

To avoid increasing incremental OTA update package sizes for already
released platforms, release build scripts disable the above logic when
signing target files ZIPs for pre-N platforms.

Bug: 25643280
Change-Id: I058393e0971d0d6559dbd69ea902754c6c7cab14
(cherry picked from commit de5bc04717)
2016-01-26 18:41:57 +00:00
Ying Wang
dd71c85a45 Support to build with AAPT2
To build with AAPT2, set "USE_AAPT2=true".
TODO: Support split apks and generated resources from other than renderscript.

Bug: 25958912
Change-Id: I19b1a038824ce5b2a3d3ffadbce3173c845193fc
2016-01-25 22:41:43 -08:00
Alex Klyubin
1429d5e14c Revert "Sign APKs using SHA-256 instead of SHA-1 when possible."
This reverts commit de5bc04717 because it's breaking some builds. Turns out some APKs have multiple sdkVersion attributes returned by aapt.

Change-Id: I013d6ef5eac473dd3900e0b9edf4c32cdc838bab
2016-01-25 17:17:09 +00:00
Alex Klyubin
de5bc04717 Sign APKs using SHA-256 instead of SHA-1 when possible.
This changes the build system to provide the signapk tool with the
minSdkVersion of the APK being signed. signapk in turn will then use
SHA-256 instead of SHA-1 if minSdkVersion is 18 (JB MR2) or higher
(see c2c49ed0c1).

To avoid increasing incremental OTA update package sizes for already
released platforms, release build scripts disable the above logic when
signing target files ZIPs for pre-N platforms.

Bug: 25643280
Change-Id: I048393e0971d0d6559dbd69ea902754c6c7cab14
2016-01-21 10:25:12 -08:00
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