Commit graph

671 commits

Author SHA1 Message Date
Yohann Roussel
ee57268cd7 Use Jack to check build
Run jack with no outputs as a quick check for compilation errors and use
a timestamp to store that check was made.

Bug: 19069325

(cherry picked from commit 43084d9f49)

Change-Id: I9b84b503b28cfdfa245f91da0061ee3a79386b28
2016-03-01 16:34:08 +01:00
Dan Willemsen
1c6dc5b942 Remove USE_NINJA=false
And everything special-cased on that. Add a warning if USE_NINJA is
set to let users know that it no longer changes anything.

Change-Id: Ib8739151fe26ea6bf8f76b7ac2b8f4097dab0b47
2016-02-26 21:48:31 -08:00
Dan Willemsen
c6e194ffad Define a class for renderscript bitcode files
These have been using SHARED_LIBRARIES, but aren't elf shared libraries.
Continue installing them to /system/lib[64], but do not apply any other
normal shared library logic to them.

Change-Id: I3055ff86bb7b116c7107c41578ed6f0f304b1cf1
2016-02-13 00:19:40 -08:00
Sebastien Hertz
91d20b06f5 Merge "Remove usages of jill.jar, use jack instead" 2016-02-11 08:48:44 +00:00
Alex Klyubin
2cfd1d108c 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: I3f2faaf49c6fa392ffbf1ee9f30de476f9f73231
2016-02-10 09:40:31 -08:00
Yohann Roussel
ccfa5c6761 Remove usages of jill.jar, use jack instead
Bug: 27113650
(cherry picked from commit d0bb7bdf5a)

Change-Id: Ie9be0d5c7e43ea857411431bb79db5cbb476484f
2016-02-10 18:07:15 +01:00
Dan Willemsen
9ecbf83259 Add 64-bit windows cross-compiles
This is mostly the same as the existing 2ND_HOST / HOST_CROSS support.

The interesting thing I did here was make x86 the 'first' architecture,
and x86_64 the second. This way LOCAL_MULTILIB := first defaults to
32-bit windows modules.

  windows-x86/bin   <- defaults to 32-bit executables
  windows-x86/lib   <- 32-bit libraries, like before
  windows-x86/lib64 <- 64-bit libraries
  windows-x86/obj   <- 32-bit intermediates
  windows-x86/obj64 <- 64-bit intermediates

Then modules are registered with the names:

  host_cross_liblog    <- 32-bit, like before
  host_cross_liblog_64 <- 64-bit

Bug: 26957718
Change-Id: I9f119411acb43e973ec1e6bca3c1dc291c91556c
2016-02-05 16:33:18 -08:00
Sebastien Hertz
4dad88980f Merge "Support code coverage with Jack" 2016-02-02 07:31:37 +00:00
Shinichiro Hamaji
52a1d6c666 Use dependency files generated by llvm-rs-cc for Java
This is a reland of 4c474617d4
This time, we use awk instead of sed, and the script works
on Mac.

For C++ code llvm-rs-cc defines two targets but it defines
three targets for Java. The sed script was updated to handle
both cases appropriately.

Bug: 26839129
Change-Id: I1bca7d253764554d552950e03deedabaa9b7f17e
2016-02-01 17:59:01 +09:00
Shinichiro Hamaji
d6184e1da9 Merge "Revert "Use dependency files generated by llvm-rs-cc for Java"" 2016-02-01 08:16:42 +00:00
Shinichiro Hamaji
5f50ea3bc9 Revert "Use dependency files generated by llvm-rs-cc for Java"
This reverts commit 4c474617d4.

Change-Id: I66c46360d0ccf927c807ddd5cfbc56cbd97ed4a2
2016-02-01 08:08:26 +00:00
Shinichiro Hamaji
3fdb9ad716 Merge "Use dependency files generated by llvm-rs-cc for Java" 2016-02-01 07:50:32 +00:00
Shinichiro Hamaji
4c474617d4 Use dependency files generated by llvm-rs-cc for Java
This is similar to 2e45fd036a
but this CL is for generated java code.

For C++ code llvm-rs-cc defines two targets but it defines
three targets for Java. The sed script was updated to handle
both cases appropriately.

Bug: 26839129
Change-Id: I5c7705c67f3c65c4c14f74558e603f8ec9f35879
2016-01-28 17:03:02 +09: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
Sebastien Hertz
dfce8ad4f4 Support code coverage with Jack
Building an app with Jack and with the environment variable
EMMA_INSTRUMENT_STATIC set to true will apply code coverage
onto the app targeting Jacoco.

Bug: 20115492
Change-Id: Ief3640fa3faa466f7f6aaa9739e06d3db24110a0
2016-01-27 19:14:14 +01: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
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
Shinichiro Hamaji
2e45fd036a Use dependency files generated by llvm-rs-cc
This was a regression since kati has been introduced. This CL
introduces include-depfile function to make it easier to write
Makefiles which work with both make and kati.

As ninja can handle only a single dependency file per a build
rule, now we merge multiple .d files generated by llvm-rs-cc
into a .d file.

Change-Id: Iaf64a8f0523ab98115837e6e06abd50f06620363
2016-01-26 14:24:46 +09:00
Christopher Wiley
087f327304 Separate aidl dependencies from compiler dependencies
Both aidl and clang/gcc were putting their dependencies in the same
place.  Move aidl's dependencies to a file ending with .aidl.P rather
than the compiler's .P.

While here, inform kati that we have these special dep files.

Bug:26409006
Test: Rebuild, note both files being generated

Change-Id: I29d2eea822235d60713c2059f3a314e475eb5aa3
2016-01-20 12:54:09 -08:00
Christopher Wiley
257796c62d Keep aidl generated C++ inside the generated folder
Transform ../ to dotdot/ for C++ generateds from .aidl source files.
This forces us to use one layer of indirection to calculate the build
rules for .aidl files, since we can no longer use a pattern rule.

This was tested by modifying system/tools/aidl's Android.mk to refer to
its .aidl files by going up two directories and then repeating the
directories again.  When I print the build rules with $(info) I see that
dotdot/ appears in appropriate places (C++ paths, but not .aidl paths).

Bug: 26407018
Test: Described above.

Change-Id: I397c9d10408c0c66d8b5a247a1f34eb4bf4f74ce
2016-01-20 09:17:20 -08:00
Colin Cross
19f6638026 Merge "Ignore Android.mk files with USE_SOONG=true" 2016-01-13 20:32:26 +00:00
Ying Wang
64088f2459 Generate .c for .y and .l
- For .l/.y source files, generate .c files; for .ll/.yy source files,
  generate c++ files.
- Simplified the rules by adding the generated sources to
  my_generated_sources.
- Simplified generated header file naming by always using .h extension
  with bison's "--defines=" option.
- Removed the unnecesarry conditional inclusion to the generated
  headers. Bison already automatically generates such things.

Bug: 26492989
Change-Id: I9ab6dc149c258f7642bc36c3fa32f90ff7ee51a4
2016-01-11 17:41:56 -08:00
Colin Cross
861ab99536 Ignore Android.mk files with USE_SOONG=true
When USE_SOONG=true, ignore any Android.mk file that has an Android.bp
file in the same directory.

Change-Id: Id79bd90c2aed5dafc2f8ad2c5b7eb0aa6e81dc18
2016-01-11 13:43:27 -08:00
Przemyslaw Szczepaniak
20de4fa41c Allow for 5200 words in dump-words-to-file
After switching to OpenJdk,  doc-comment-check target
started to fail due to "Too many words (5082)" while
generating out/target/common/docs/doc-comment-check-timestamp.rsp
This change extends number of dumped words to 5200.

Bug: 25758743

(cherry picked from commit 972a2681c6)

Change-Id: I9b8516d1e7c113d667dcfb7963ee352972677afa
2015-12-24 10:10:55 +00:00
Yohann Roussel
09ee66e2b4 Do not set Jack source version, use default
Default source version is 1.7 in Jack B and Jack C so this means no
change to default. Not forcing it in the build rules will allow to
change it in LOCAL_JACK_FLAGS.

Bug: 26257295
Change-Id: If9b5fe250eea4bc6bcb3c16ad9cf7024d399ff3c
2015-12-18 10:30:21 +01: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
Alex Klyubin
9667b18f23 Make signapk use Conscrypt.
This makes the signapk tool use Conscrypt (where possible) instead of
the platform-default JCA providers and the Bouncy Castle JCA provider.
This speeds up (by 10-30%) APK and OTA update signing because
Conscrypt's crypto primitives are backed by BoringSSL.

Previously, the signapk tool consisted only of the signapk.jar.
Because Conscrypt is backed by native code, signapk now consists of
signapk.jar and crypto_openjdk_jni shared library. This requires that
users of the tool be updated to provide a suitable -Djava.library.path
argument to the Java runtime. This change updates all known users of
the tool inside the Android source tree to do so.

Bug: 26097626
Change-Id: I8411b37d7f771ed99269751a3007dff103083552
2015-12-11 08:36:42 -08:00
Ying Wang
427f8c43aa Gmake doesn't like newline in macro expansion result.
When $(call func) in the makefile text expansion includes newline, gmake
reports error "missing separator". But it's fine if the expansion includes
only spaces. That's a bit odd.
This change fixes the "missing separator".

Change-Id: I094e5ae1725699ebfa4ed66544eef037dd68714c
2015-12-04 16:44:03 -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
Paul Duffin
623799d3e0 Merge "Fix generated-sources-dir-for for COMMON" 2015-11-26 11:39:30 +00:00
Shinichiro Hamaji
c9a1b27845 Merge "Use .KATI_RESTAT to reduce unnecessary rebuilds of .jar files" 2015-11-26 05:25:58 +00:00
Paul Duffin
699a32217a Fix generated-sources-dir-for for COMMON
When the 4th argument specified is non-empty then it attempts to
use either HOST_OUT_GEN_COMMON or TARGET_OUT_GEN_COMMON
depending on whether the 3rd argument is non-empty or not
respectively. Unfortunately, those two variables do not exist,
the correct names for those variables is HOST_OUT_COMMON_GEN and
TARGET_OUT_COMMON_GET.

Change-Id: I66edb02824c06e0f504ebe04ff80ddbd77a16c95
2015-11-25 13:14:23 +00:00
Ying Wang
6cce4026ff Fix typo.
Change-Id: I299076791c620968fa7a5c420b5ca21ea4d30b51
2015-11-24 14:09:11 -08:00
Ying Wang
3be52e6692 Don't delete META-INF in jack-java-to-dex when packing resources.
LOCAL_DONT_DELETE_JAR_META_INF is meant for deleting resources carried
by static Java libraries, see comment in clear_vars.mk.
For a module's own resources, we should pick up whatever in
LOCAL_JAVA_RESOURCE_DIRS.
The same applies  when building .jack from a  prebult jar in
transform-jar-to-jack.

Bug: 25860887
Change-Id: I20c120e039342a1124362c5f8747eace94b03931
(cherry-pick from commit 996ae38ffd)
2015-11-24 13:57:10 -08: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
Dan Willemsen
67d993fc9c Merge "Sort dex and static lib resources" 2015-11-13 01:39:30 +00:00
Yohann Roussel
94f86f8877 Sort dex and static lib resources
Before adding them to the apk or javalib.jar. This allows the entries
order to be reproducible and will help to have a reproducible build.

Bug: 25629246

Change-Id: Ie596aecfdd08047ea9f9071896a2b980e7200b41
2015-11-12 14:58:19 +01:00
Dan Willemsen
5c64b4e81c Make uncompressing jni libs in prebuilt APKs reproducible
This was extracting the shared libraries into a temporary directory,
then adding them back into the zip file using the raw filesystem
ordering. Fix that by passing a sorted list to zip.

Bug: 24201956
Change-Id: I59c41151968be6faf289e04719a9992157eb405d
2015-11-11 18:26:38 -08:00
Shinichiro Hamaji
0e7587a9ea Use .KATI_RESTAT to reduce unnecessary rebuilds of binaries
When a shared object is rebuilt, all dependent libraries and
executables are rebuilt. Such rebuild is unnecessary when there
is no interface change. With this patch, .toc files will be
generated for all .so files. The rule which generates .toc files
has ninja's restat=1 and .toc files are not changed ninja won't
rebuild dependent targets.

Performance:

$ m && touch bionic/libc/stdio/stdio.c && time m
Before: 1m03s (2563 targets)
After: 21s (90 targets)

Bug: 24597504
Change-Id: Ia5dd950273d143f4e99eee8bef7478f1a94cd138
2015-11-04 15:23:59 +09:00
Dan Willemsen
a25ddad7d6 Don't use ziptime with unbundled builds
Some of the trees are unable to compile native code with the normal
build rules, even though they can build kati.

Bug: 24201956
Change-Id: I2afc3468480b2c78407d62323e6b82979c8ee254
2015-11-03 16:18:41 -08:00
Dan Willemsen
48a621c277 Remove changing uids/timestamps from zip/jar files
Pass -X to zip so that Unix UID/GID and extra timestamps aren't
saved into the zip files.

Add a new tool, ziptime, that uses a very stripped down copy of
zipalign. It no longer depends on libandroidfw, and now rewrites the
timestamps in place instead of making a copy of the zipfile. This should
improve speed and reduce disk requirements, especially with the large
packaging zip files.

Bug: 24201956
Change-Id: I50f68669f659da1b4393e964ad40b6aafb00c1e7
2015-11-02 14:51:54 -08:00
Lee Campbell
04ba31236e build: Add extra build customization for /product
This makes /product more consistent with /device & /vendor

BUG: 22030305

Change-Id: Ic65bfde7fb3e9fab8c8fb8d99af15404574abde0
2015-11-02 14:18:13 -08:00
Dan Willemsen
b589ae4e26 Revert "Remove changing uids/timestamps from zip/jar files"
This reverts commit 3c2c064c87.

zipalign depends on libandroidfw, and some setups don't include frameworks/base.

Bug: 24201956
Change-Id: I48ee95808924f6b2221f0a49ab205c2565096b1f
2015-10-29 21:26:18 +00:00
Dan Willemsen
3c2c064c87 Remove changing uids/timestamps from zip/jar files
Pass -X to zip so that Unix UID/GID and extra timestamps aren't
saved into the zip files.

Add a new option to zipalign, -t, to replace all timestamps with static
timestamps (2008 Jan 1 00:00:00). Use this for all non-APK zip files.
APK zip timestamps are set based on the certificate date in SignApk.

Bug: 24201956
Change-Id: Ifb619fc499ba9d99fc624f2acd5f8de36d78ef8e
2015-10-29 11:57:16 -07:00
Ying Wang
4d68879ca6 Normalize java source file paths before running "sort -u".
We rely on "sort -u" to dedupe aidl/logtags generated java files added
by both from $(all_java_sources) and from "find
$(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java".
But "sort -u" doesn't work if any of the aidl/logtags source file path
has "../" in it.
This change fixes this issue by normalizing the source file paths before
passing them to "sort -u".

Change-Id: I12d2c4e0397bed9f426a1ed9b13608d72d01e0df
2015-10-23 13:19:47 -07:00
Yohann Roussel
6528ea3086 Remove LOCAL_JACK_EXTRA_ARGS
Use of DEFAULT_JACK_EXTRA_ARGS and LOCAL_JACK_FLAGS provides all needed
support.

(cherry picked from commit d2b2983cc7)

Change-Id: I1cd76836792e7332bc3750408a860400b0957485
2015-10-21 17:22:27 +02:00
Yohann Roussel
8998d57404 Allow control of jack used for compilation
Version of Jack used to compile a module can now be control from
a dedicated mk located in prebuilts/sdk/tools

Bug: 24564814

(cherry picked from commit b68c9a498d)

Change-Id: I7809dc966026ff94b5cb2daa7e2c63762ca4768d
2015-10-21 17:22:05 +02: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