Commit graph

130 commits

Author SHA1 Message Date
Colin Cross
e46727a2ba Run ErrorProne in OpenJDK9
Run ErrorProne as a processor in javac from OpenJDK9.

Bug: 69485063
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I2dde597430b47c440df22d248809233a6ade1625
2018-06-20 18:49:50 -07:00
Jiyong Park
1cf8ee619b Export SDK library names
A java module exports SDK library names that it is using directly or
indirectly via its dependencies. Manifest fixer uses the SDK lib names
to automatically add <uses-library> tags for the apk.

The SDK library names are exported via exported-sdk-libs file in make.
From Soong, they are exported via LOCAL_EXPORT_SDK_LIBRARIES flag.

Bug: 77575606
Test: m -j

Change-Id: I4e7a9bdc5bf845af85168abf55f8063900bacc72
2018-06-20 11:50:06 +09:00
Sundong Ahn
2b17041789 Add support when LOCAL_PRIVATE_PLATFORM_APIS is true.
LOCAL_PRIVATE_PLATFORM_APIS := ture means that the apps or packages can
use the private API. So, if LOCAL_PRIVATE_PLATFORM_APIS := true, they
are linked to ".impl" instead of ".stub".

Bug: 77577799
Test: build
Change-Id: I782e52078bb8c4139c3a24862cb381f6a84e53fe
2018-05-23 21:34:18 +09:00
Jiyong Park
45bb10c470 When building unbundled apps, link to the prebuilt stubs lib
There was a bug that when an unbundled app is built without SDK
(LOCAL_SDK_VERSION isn't set), it is linked to the nonexisting stubs
library from java_sdk_library. The built stubs libs are not created for
unbundled builds. For unbundled builds, we need to use the prebuilt
stubs lib.

Bug: 77575606
Test: m -j
Test: make -j dist
ANDROID_BUILDSPEC=vendor/google/build/app_build_spec.mk

Change-Id: I70cced1c872053e151fea157e3a6d218b1fab9dc
2018-05-16 09:55:47 +09:00
Colin Cross
2029903b64 Allow forcing AAPT2 on
Building with FORCE_AAPT2=true will turn on AAPT2 for all modules
unless they set LOCAL_USE_AAPT2 := false.  The build system will
attempt to rewrite common AAPT patterns into AAPT2 patterns,
including removing --extra-packages for support library packages,
removing LOCAL_RESOURCE_DIR point to support library resources,
adding a default empty manifest file if it doesn't exist, and
converting LOCAL_STATIC_JAVA_AAR_LIBRARIES to
LOCAL_STATIC_ANDROID_LIBRARIES.

Bug: 79481102
Test: m checkbuild
Change-Id: I8d9d55fe4d5d5c965c64b0407efe74e0afc35c3a
2018-05-11 02:23:20 +00:00
Anton Hansson
9d030609e5 Forbid depending directly on SDK modules.
They should be depended on by specifying LOCAL_SDK_VERSION. Depending
on them directly makes it difficult to rename or modify these targets,
as I've found when working on b/77525052.

This list can be further extended to other libraries that should not
be depended on directly.

Bug: b/77525052
Test: make
Change-Id: I911bcc8a5a90995b3607599388dc6119eb88ea96
2018-05-02 15:02:09 +01:00
Jiyong Park
cd06fe34e0 sdk lib name can be in LOCAL_[STATIC_]JAVA_LIBRARIES
When an sdk lib name (a module defined with java_sdk_library{...}) is
listed in LOCAL_JAVA_LIBRARIES or LOCAL_STATIC_JAVA_LIBRARIES, the name
is translated to the stubs lib name of the sdk lib.

We have to support this at least until all existing references to sdk
libs are all correctly converted to LOCAL_SDK_LIBRARIES.

Bug: 77575606
Test: m -j
Change-Id: I8cff668afd6b5f265cc7ae6fe6f5fa36b76b8334
2018-05-01 09:32:11 +09:00
Jiyong Park
6023db8844 java_sdk_library supports test as another API scope
When a module built with LOCAL_SDK_VERSION := test_current, then
it is linked against test variant of the sdk stubs library.

Bug: 77575606
Test: m -j
Change-Id: I08ce120d8e4774722a95bfc4e200ad7d123abc70
2018-05-01 09:32:01 +09:00
Anton Hansson
8ae30017e9 Support LOCAL_SDK_LIBRARIES for "current" builds.
Resolve these using the naming scheme from sdk_library.go, added
in I4a4ccf6e730e041703c63bb275d8860d0de96887.

Also re-write the LOCAL_SDK_VERSION logic, as it was becoming a
real mess.

Bug: 77575476
Test: With uiautomator in a follow-on CL
Change-Id: I11bd10c02df3d458a4ed6de90114e27fabe8d9e0
2018-04-30 23:06:57 +01:00
Anton Hansson
f5cefdcefb Add support for specifying LOCAL_SDK_LIBRARIES for prebuilts.
This new variable allows specifying libraries like this:
LOCAL_SDK_VERISON := 25
LOCAL_SDK_LIBRARIES := org.apache.http.legacy,
which would automatically pick up the prebuilt OAHL prebuilt
from prebuilts/sdk/25/public/org.apache.http.legacy.jar

Test: In master with uiautomator.
Bug: 77575476
Change-Id: Id8d92176f5b608c2bcea622b6aed4aa27c32e000
2018-04-19 15:18:55 +01:00
Anton Hansson
400673cf1e Consolidate the logic for the sdk prebuilt module names.
I'm making some changes to it, and found the names are scattered
in various places. Make a macro and re-use the logic instead.

Bug: 77525052
Test: make droid
Change-Id: I0f2da80b8b4d427353509b27ec720d024eee7a6e
2018-04-10 18:53:30 +01:00
Colin Cross
1e047d39a5 Move java renderscript support to java_renderscript.mk
Move java renderscript support to java_renderscript.mk in
preparation to moving it before aapt.  Filter *.rs files
out of LOCAL_SRC_FILES and forbid them in java_common.mk
so that using *.rs files is an error if java_renderscript.mk
was not included.

Bug: 73885582
Test: m checkbuild
Change-Id: Ib37ce89daee58b025dec98f733c5a08149641afd
Merged-In: Ib37ce89daee58b025dec98f733c5a08149641afd
(cherry picked from commit 71822d6fb9)
2018-03-20 15:26:27 -07:00
Colin Cross
11e2d55c0f Add LOCAL_SRCJARS support
Allow java modules to take jars containing .java files as an input.
For turbine, pass them directly to turbine.  For javac, extract them
to a directory and pass a list of the files to javac.

Bug: 73885582
Test: m checkbuild
Change-Id: Ib4351a5b4b165a55e5fb02ee2680466db368983a
2018-03-14 12:05:04 -07:00
Colin Cross
93d6550c53 Remove unused .fs file suppport
.fs files are obsolete.

Bug: 73885582
Test: m checkbuild
Change-Id: I74b618099333fe565c7b235994be64e6466d2da6
2018-03-14 12:05:01 -07:00
Colin Cross
c3e7074df1 Remove unused file lists
RS_FILES and AIDL_FILES were used for cleaning up the intermediate
src dir, but are no longer used after
If7529979de6fa62a651933a3a974f47b033851d6 and
I01feff7cc399ac5b88b83333a1ac86928d0a81e6.

Bug: 73885582
Test: m checkbuild
Change-Id: If2653f846b568fd2587c8e055ef820e17760f133
2018-03-14 12:04:58 -07:00
Colin Cross
b6013af085 Move aapt flags from java_common.mk to aapt_flags.mk
The aapt flags were being set in java_common.mk, which is used by
various entry points.  host_dalvik_java_library.mk and
host_java_library.mk, and java_library.mk don't support aapt, only
package_internal.mk and static_java_library.mk do.  Move the aapt
flags into aapt_flags.mk, and include it from package_internal.mk
and static_java_library.mk.

Bug: 73885582
Test: no change to build-${TARGET_PRODUCT}.ninja
Change-Id: I124393846d37b9bbc941272cce4274121ac235ef
2018-03-14 12:04:35 -07:00
Colin Cross
8dad6c62d4 Remove missed PRODUCT_AAPT_FLAGS
PRODUCT_AAPT_FLAGS was removed by Iacc914114616b5bd19d9a1011802f4f9bca9bc19,
remove one more that it missed.

Test: m checkbuild
Change-Id: I31ea4954f5af5af37f13210925ed5d622625d71b
2018-03-07 09:48:33 -08:00
Sundong Ahn
7a02001fa9 Change the naming policy of system_$(VER)
The module name of system_$(VER) prebuilt file is system_sdk_v$(VER).
But this is inconsistent with sdk_v$(LOCAL_SDK_VERSION) in prebuilts/sdk.
So, system_sdk_v$(VER) is changed to sdk_vsystem_$(VER) to use the same
naming policy.

Bug: 72031391
Test: build
Change-Id: I379c0f9aa0de7407489eeec2b07ee7727e81d69d
2018-02-07 03:37:24 +00:00
Jiyong Park
5ebca30d21 Support LOCAL_SDK_VERSION := core_current
core_current is a pseudo SDK version which is a core Java API subset of
the Android API. It is expected to be mainly used for external Java
projects which are agnostic to Android; such as junit, guava, etc.

A module built with this SDK version can only link to java modules of
the same kind. It can't depend on modules built with LOCAL_SDK_VERSION
:= current or without LOCAL_SDK_VERSION.

Bug: 72206056
Test: m -j
Change-Id: I34a9696393aa6704fd6684a40ea5b05d3fb46b23
2018-02-01 17:14:55 +09:00
Tobias Thierer
0276db1ec7 javac 9 -target 1.9: Move bootclasspath jars onto classpath.
When building with OpenJDK 9's javac with -source 1.9 -target 1.9,
a runtime image (with system modules) is used via the --system
command line flag, instead of --bootclasspath.
The runtime image only contains the default libraries (libcore)
but is missing other libraries that might be on the bootclasspath
for a particular build target.

This CL fixes compilation for this case by adding the missing
jars onto the classpath instead.

This already used to work but was broken by CL [1]. I attempted
to conditionally revert some of that CL's changes to java_common.mk
for the case of language level 1.9, but couldn't get it to work.
Therefore this CL follows a different approach.

[1] http://r.android.com/519552

Bug: 38177569
Test: Treehugger
Test: Ran "EXPERIMENTAL_USE_OPENJDK9=true make checkbuild docs"
      and spot-checked some javac invocations to confirm that the
      system modules libs were not included in the bootclasspath,
      but other libs were.

Change-Id: I48fd11aac9b310bfa58dee0f9cfb3ef33f10bca8
2018-01-26 02:48:48 +00:00
Tobias Thierer
f795dcb767 Experimental feature: LOCAL_PATCH_MODULE option in .mk files.
Specifying this option causes the make target's sources
and classpath dependencies to be patched into the specified
module via --patch-module (if the build toolchain implements
the module system, ie. when targeting 1.9). This allows tests
to compile that have classes in packages under test.

Currently, only java.base is on the module path (everything
else is on the classpath), and only when using -target 1.9
(ie. EXPERIMENTAL_USE_OPENJDK9=true).

Bug: 71699916
Test: Treehugger
Test: Checked that I was able to compile some ojluni & icu
      test sources that had classes in (libcore) packages
      under test.

Change-Id: I044fb9d904754ed281f574ab3dd52235cf0d7fec
2018-01-11 01:13:13 +00:00
Tobias Thierer
7e99d45ec2 Pass OpenJDK 8's bootclasspath for host tools targeting <= 1.8.
Host (as opposed to hostdex) tools compile and run against OpenJDK's
core libraries. Before this CL, the core libraries of the default
toolchain were always used, even when targeting an earlier language
version.

This meant that code that uses APIs from a later version of OpenJDK
than corresponded to LOCAL_JAVA_LANGUAGE_VERSION would compile, but
would fail to run under that earlier version of OpenJDK. It also
meant that calls to existing APIs might be reinterpreted; for
example, the return type of java.nio.ByteBuffer.clear() changed from
Buffer in OpenJDK 8 to ByteBuffer in OpenJDK 9. At compile time, this
was noted via the warning:
  bootstrap class path not set in conjunction with -source 1.8

After this CL, when targeting a language version <= 1.8 (which is
always the case when building with OpenJDK 8), some of OpenJDK 8's
core library/tools jars are now passed on the bootclasspath. The
decision to include the bootclasspath argument when building with
OpenJDK 8 was somewhat arbitrary, but has the advantage that we
discover any issues before we switch to OpenJDK 9.

Even when compiling with OpenJDK 9, use of OpenJDK 9 APIs will now
fail at compile time rather than at runtime; calls to existing APIs
will now be interpreted in OpenJDK 8 rather than 9 fashion. For
example, this means that dx and host-side CTS tests built with
OpenJDK 9 javac -target 1.8 will be runnable under OpenJDK 8.

Bug: 70521453
Bug: 70862583
Test: Checked that the bootclasspath argument was passed
      in the javac invocation targeting 1.8 during:
      make showcommands compatibility-common-util-hostsidelib
Test: make checkbuild

Change-Id: I9b6081edfdd2c3e9a450ae8a39c4e32c3d2cda92
2017-12-21 01:38:44 +00:00
Joe Onorato
bfc7811441 When compiling with the lite protobuf option, pass the option to aprotoc to force the lite runtime.
With LOCAL_PROTO_OPTIMIZE_TYPE set to one of the lite variants, the build system thinks
the proto should be compiled with lite, and will link in the line runtime libs. But if
the .proto files don't contain the directive to compile the source as lite
(option optimize_for = LITE_RUNTIME;), then the generated code will be full and the
libraries will be full, and it won't link.

Test: make
Merged-In: Ib8a135218d62fa42fa6448c49c97f7aeb2755c42
Change-Id: Ib8a135218d62fa42fa6448c49c97f7aeb2755c42
2017-12-15 08:40:48 -08:00
Colin Cross
3277ba34ae Add java modules to soong_to_convert.txt
Test: examine soong_to_convert.txt
Change-Id: Ibb6db664238a4e98f5d8885dfb3ddc0f35d11ff6
2017-12-06 15:38:52 -08:00
Sundong Ahn
3c113098f7 Fix build error
Fix the build error when TARGET_BUILD_APPS is set

Bug: 67724799
Test: m -j TARGET_PRODUCT=full TARGET_BUILD_APPS=TVTestInput

Merged-In: I981b0a245d7e8f2dabbd4e51db52d17aeacc6106
Change-Id: I981b0a245d7e8f2dabbd4e51db52d17aeacc6106
(cherry picked from commit 8e7a4c413f)
2017-12-01 00:40:56 +00:00
Sundong Ahn
5a44d1f069 Add LOCAL_SDK_VERSION := system_$(VER)
The system_$(VER) can be set in LOCAL_SDK_VERSION, and the apk will use
android_system.jar at build time.
If LOCAL_SDK_VERSION is not defined and this module is installed in
vendor.img, LOCAL_SDK_VERSION is set to system_current.

Bug: 67724799
Test: 1. build && run on taimen
2. LOCAL_SDK_VERSION:=system_27 in ims.apk && build ims.apk && check
the vsdk_v27_intermediates.

Merged-In: I5b11c78b8fcd4a2f2a5e3b141527cd34dbe80018
Change-Id: I5b11c78b8fcd4a2f2a5e3b141527cd34dbe80018
(cherry picked from commit ef212cbe8d)
2017-12-01 00:39:07 +00:00
Dan Willemsen
bb6393c5a4 Add LOCAL_AAPT2_ONLY
This allows modules to specify that they may only be used from modules
using aapt2. Using aapt2 removes absolute path references to modules, so
this can be useful if a module is preparing to move its sources, or
replace itself with a prebuilt aar.

Test: m
Test: Label frameworks/support/design; m
Test: Label frameworks/support/v4; m
Test: build/soong/build_test.bash
Change-Id: Icfb3d4b19a6a0e3a3bb00091d2a97a4d88c0c761
2017-11-17 15:54:15 -08:00
Tobias Thierer
f6bd495728 Break EXPERIMENTAL_USE_OPENJDK9 into {USE,TARGET}_OPENJDK9.
This CL topic breaks the single flag value EXPERIMENTAL_USE_OPENJDK9
into two flags USE_OPENJDK9 and TARGET_OPENJDK9 which are computed
independently in config.mk and config.go; this means that later
build logic no longer depends on / duplicates the semantics of an
unset EXPERIMENTAL_USE_OPENJDK9, because that later build logic
can use USE_OPENJDK9 and TARGET_OPENJDK9 instead. Thus, it becomes
slightly easier to change this default in future CLs (touching
only config.mk and config.go).

It also makes it more straightforward to convert .mk files
to .bp.

This CL also introduces a new allowed value "false" for
EXPERIMENTAL_USE_OPENJDK9. This fourth possible value currently
has the same semantics as a default/unset
EXPERIMENTAL_USE_OPENJDK9, but allows people to explicitly
switch back to the old semantics when the default changes.

Test: make showcommands core-oj (in environments with
      EXPERIMENTAL_USE_OPENJDK9 set to "", "1.8", and "true").
Bug: 38177295

Change-Id: Iaade9610b237722e5d175143808b8653b1e98996
2017-11-17 13:14:11 +00:00
Allen Hair
1d226aaf0f Fix coverage build.
Bug: 68713631
Test: m showcommands dist ANDROID_COMPILE_WITH_JACK=false \
    EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true \
    SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false tests
Change-Id: Ic2540a7db26b7fe6d2ee2bb5feb54a4334deafcc
2017-10-31 14:06:00 -07:00
Colin Cross
98caed6e7f Fix desugaring when LOCAL_SDK_VERSION is not set
When LOCAL_SDK_VERSION is not set, frameworks.jar is put
in the classpath for javac.  If it is also in the classpath
(as opposed to the bootclasspath) for desugar then desugar
tries to rewrite classes that implement interfaces with
default methods to contain calls to the generated companion
classes for those interfaces.  frameworks.jar will not
contain the companion classes, which causes proguard to
fail.

Move frameworks.jar to the bootclasspath, which matches more
closely with builds against the SDK stubs jars.

Also remove the static libraries from the classpath, they have
already been merged into the input jar.

Test: m checkbuild
Change-Id: If30943efcaea44b2db1b38a6c1d558113324757f
2017-10-26 13:09:07 -07:00
Colin Cross
f960257c14 Use system modules generated by soong when using javac -target 1.9
Soong has support for building system modules.  Use the directories
produced by Soong with --system to replace -bootclasspath arguments
when using javac -target 1.9.

Since soong can't generate current SDK stubs yet, and no existing
SDK stubs need -target, only use -target 1.9 for modules that are
not compiling against the SDK.  That means in practice the only
system modules that will be used for now is the default one,
core-system-modules.

Bug: 63986449
Test: m -j EXPERIMENTAL_USE_OPENJDK9=true makes some progress
Change-Id: I350ef50aedf36fdd72458c23d4fe8a2edf1a9a02
2017-10-16 17:55:24 -07:00
Tobias Thierer
745c6a55d3 Cap LOCAL_JAVA_LANGUAGE_VERSION <= 1.8 for API versions <= 26.
The default LOCAL_JAVA_LANGUAGE_VERSION is normally 1.8, or 1.9
when EXPERIMENTAL_USE_OPENJDK9 is explicitly set to the
nondefault value of "true".

Since old Android API levels do not support later versions,
LOCAL_JAVA_LANGUAGE_VERSIONs is already capped at 1.7 for
APIs <= 23.

This CL further caps it at 1.8 for all released APIs (currently
<= 26) even when EXPERIMENTAL_USE_OPENJDK9=true.
This may need to be updated in future.

This CL only affects builds where EXPERIMENTAL_USE_OPENJDK9 is
set; it does not affect the default build.

Bug: 67454477
Test: Treehugger

Change-Id: I54ca72bdb09aeb4184d5bb3c51d881dcfc943839
2017-10-06 15:57:33 +01:00
Colin Cross
e673deb280 Delete jack support
Remove all support for running jack.

Bug: 65302138
Test: m -j checkbuild
Change-Id: I1ef87c88af3f2689f8b0dcf1a01c958b16159631
Merged-In: I1ef87c88af3f2689f8b0dcf1a01c958b16159631
(cherry picked from commit 5db5d31d73)
2017-10-02 11:15:19 -07:00
Treehugger Robot
b182ea7bcb Merge changes I06179fca,Ie48746c8,Ia47ebc95
* changes:
  Disable turbine for unbundled builds
  Allow disabling turbine
  Simplify the *-lib-* functions
2017-09-27 02:36:24 +00:00
Colin Cross
7dc9043546 Allow disabling turbine
m -j TURBINE_ENABLED=false will build without turbine.  This is
primarily useful for A/B comparisions of turbine builds, but will
also be used to temporarily disable turbine for unbundled builds
until we have turbine prebuilts.

Bug: 64308460
Test: m -j TURBINE_ENABLED=false java
Test: m -j java
Change-Id: Ie48746c8bfc60c361be9634cb1805ca1c09aa1fe
2017-09-26 16:23:00 -07:00
Colin Cross
9b2e4c6950 Simplify the *-lib-* functions
Simplify the java-lib-* type functions, three layers of abstraction
is a bit much for a single line function, and isn't reducing enough
duplication to be worth the complexity.

Add app-lib-* functions and use them.

Test: m -j checkbuild
Change-Id: Ia47ebc95e4af2073396233416f14fdee7d856844
2017-09-26 16:23:00 -07:00
Treehugger Robot
a4a1f2089b Merge changes I0a1aa003,I000c3c22
* changes:
  Use dx or d8 from prebuilts/build-tools
  Desugar lambdas in javac unbundled builds
2017-09-26 18:29:22 +00:00
Colin Cross
0a68e5e66f Fix unbundled jack builds
Recent change Icbc8987468f237aa351708b33c3abe5ea3d1816e was
unconditionally adding core-oj and core-libart as the
bootclasspath for all jack compiles, which is incorrect and
was breaking unbundled builds that don't have sources for
core-oj and core-libart.  Only add them when LOCAL_SDK_VERSION
is not set.

Test: unbundled build
Change-Id: I6bab7e36e8178384f13cf9df8183a53fcb4b23f8
2017-09-25 23:47:21 -07:00
Colin Cross
5d969a3df4 Desugar lambdas in javac unbundled builds
Use prebuilt core-lambda-stubs from prebuilts/sdk and desugar from
prebuilts/build-tools to desugar lambdas in javac unbundled builds.

Test: apps build with ANDROID_COMPILE_WITH_JACK=false
Bug: 62038127
Change-Id: I000c3c2234443aa17f091784726ab9f63c0cc361
2017-09-25 16:15:11 -07:00
Colin Cross
b541aae17c Remove duplication of bootclasspath in LOCAL_JAVA_LIBRARIES
The bootclasspath libraries have direct dependencies now, so
remove them from LOCAL_JAVA_LIBRARIES so they don't also end
up in the classpath.

Test: m -j checkbuild
Test: m -j ANDROID_COMPILE_WITH_JACK=true java
Test: manually inspection of build-${TARGET_PRODUCT}.ninja
      only has expected changes
Test: no changes to system.img
Change-Id: Icbc8987468f237aa351708b33c3abe5ea3d1816e
2017-09-25 16:15:10 -07:00
Colin Cross
1d1e5ef61b Add dependencies on bootclasspath libraries
The libraries in the bootclasspath were getting their dependencies
because they were also in the default libraries list.  Make the
dependencies explicit in preparation for rearranging the default
libraries.

Test: m -j checkbuild
Change-Id: I3ea004714a31cd648ec2ef57ed3099bce70bc6b9
2017-09-25 16:14:42 -07:00
Colin Cross
f6bc1a1ac0 Reindent bootclasspath code
Apply indentation to the bootclasspath selection code.

Test: m -j checkbuild
Change-Id: I5ca15636d34d43f9ebe7264d566d06d8c045b0e3
2017-09-23 19:48:27 -07:00
Colin Cross
34a9885f34 Revert "Revert "Support <dir>:<file> for LOCAL_JAVA_RESOURCE_FILES""
This reverts commit 15a2fa21a8.

This reapplies I83f3d45bdd156200308dc7ed0e0fea5d895d37a6 without
the error on absolute paths if they are in $(OUT_DIR).

Test: OUT_DIR=/tmp/out mmma -j art/tools/ahat
Change-Id: Ia0b156d21ba4b95eb3004d61f6fae2f4341fd39c
2017-09-22 13:45:23 -07:00
Colin Cross
15a2fa21a8 Revert "Support <dir>:<file> for LOCAL_JAVA_RESOURCE_FILES"
This reverts commit 4a93294fc1.

Broke builds with absolute OUT_DIR.

Test: revert
2017-09-22 13:33:52 -07:00
Colin Cross
4a93294fc1 Support <dir>:<file> for LOCAL_JAVA_RESOURCE_FILES
Support the same syntax as LOCAL_TEST_DATA for
LOCAL_JAVA_RESOURCE_FILES to allow placing files at a subdirectory
in the jar file by replacing the / before the first path element
to be included with a :.

Test: m -j checkbuild
Test: out/build-${TARGET_PRODUCT}.ninja is the same
Change-Id: I83f3d45bdd156200308dc7ed0e0fea5d895d37a6
2017-09-21 20:45:55 -07:00
Nan Zhang
9bd540594d Use merge_zips to merge jars during Java build in Make.
1. Use merge_zips to merge jars without unzipping/rezipping static Java
libraries. And seperate merging process as a independent Make target so
that Javac can only depend on Turbine.

2. Remove duplicate vars: "full_java_lib_deps" in droiddoc.mk

3. Also use classes-header.jar for link_apk & link_instr

Bug: b/65455145
Test: m clean && m -j32

Change-Id: I7b0307664a6b86075c983284fce099bd3946318c
2017-09-19 18:49:33 -07:00
Nan Zhang
b3ec534bd1 Revert "Revert "Add Turbine as part of java build toolchain in Make.""
This reverts commit 33dcd0c5eb.

Reason for revert: <stub.jar.toc needs classes.jar.toc which is no longer existed after Turbine was introduced. So use classes.jar to represent stub.jar.toc>

Bug: b/64308460
Test: m clean && time m -j32 ANDROID_COMPILE_WITH_JACK=true
Change-Id: If618993f1e0c789d93cc15664212603f994fd460
2017-08-31 14:56:54 -07:00
Nan Zhang
33dcd0c5eb Revert "Add Turbine as part of java build toolchain in Make."
This reverts commit 0739155c86.

Reason for revert: <sdk_google_aw_x86-sdk (linux) build 4310016 in git_master is broken>

Change-Id: I525d48557bd0425917e61a85f596663ccc63c887
2017-08-31 19:56:59 +00:00
Nan Zhang
0739155c86 Add Turbine as part of java build toolchain in Make.
1. Bundle static_java_header_libs during turbine-classes.jar if
necessary. This can be improved if we have the ability to merge jars on
the fly.

2. Copy sdk/stubs-classes.jar to sdk/stubs-classes-header.jar, and Use
.KATI_RESTAT to cut un-necessary targets rebuilt.

3. Copy prebuilt-classes.jar to prebuilt-classes-header.jar since
Turbine doesn't apply to prebuilt.

4. Run jarjar after Turbine compilation, otherwise downstream targets
won't find corresponding symbols.

5. Change classes.jar in -classpath used in Desugar to
classes-header.jar.

6. Change legacy-libs in Proguard from classes.jar to
classes-header.jar.

7. Add .KATI_RESTAT for turbine-classes.jar, and remove IJAR.

8.boot.art is re-generated during the incremental rebuild since
javalib.jar got re-generated. Then boot.art re-triggered lots of
downstream targets to be rebuilt. So we add .KATI_RESTAT for javalib.jar
to prevent downstream to be rebuilt. The ziptime & commit-change-to-toc
operation for javalib.jar(small) didn't bring too much overhead when we build
from clean state.

Next step: specify static_java_header_libs in -classpath, and merge jars
at the end.

touch frameworks/base/core/java/com/google/android/util/Procedure.java &&
time m
time: 1m58s (794 -> 49 targets)

m clean && time m java
time: 9m34s

Bug: b/64308460

Test: m clean && m checkbuild

Change-Id: Iefcc234405b9f461b6882c06bba15e21fa783d28
2017-08-30 16:01:39 -07:00
Colin Cross
dfc45ec337 Separate java source list generation into its own rule
Move the java source list generation step into its own rule.  This
has a couple of advantages.  It consolidates the source list
generation so that it only has to run once for javac, jack, and
jack-check.  It also massively reduces the length of the javac
command line, so that error messages are significantly shorter,
and allows easily rerunning the failing build command because
the file list is still on disk.

The primary disadvantage is that javac error messages no longer
include the list of files passed to javac, but the list is
available earlier in the build long when the file list was written,
and is still available on disk.

Test: m -j javac-check
Change-Id: I9730b352b33a060e08221b61c11c617d23320d67
2017-08-29 16:50:11 -07:00