Commit graph

122 commits

Author SHA1 Message Date
Colin Cross
e2ad230989 Use prebuilts/jdk/jdk9 if EXPERIMENTAL_USE_OPENJDK9 is set
Bug: 62123342
Test: m -j EXPRIMENTAL_USE_OPENJDK9=1.8 checkbuild
Change-Id: I2a5a0f0962bca050a087340f7c6a262448c54a94
2017-10-06 00:08:46 +00:00
Treehugger Robot
c21d11850d Merge changes I5f6f3da7,Ia37b8b93,Ie79a2e78
* changes:
  Get dex jar resources from classpath jar
  Add -stripFile argument to merge_zips
  Change default jar time to match ziptime
2017-10-05 23:20:17 +00:00
Colin Cross
647aa4f009 Allow full protos in host modules
Test: m -j checkbuild
Change-Id: I9dd076fea3e0544b8bdeeac9b040a8ee9d818715
2017-10-05 20:56:51 +00:00
Colin Cross
7db5d6332f Get dex jar resources from classpath jar
Dex jars were getting their resources from the res.jar files of
their transitive static dependencies.  This accidentally bypassed
jarjar on resources, since the jarjar pass only happened once the
resources jar was combined into the classpath jar.  Switch to
getting the resources out of the classpath jar by merging it
with the dex jar while skipping *.class.

Test: m -j checkbuild
Test: compare ext.jar to one generated by make
Change-Id: I5f6f3da738dcb0af56ab9a1bd7174ed5359de2b2
2017-10-04 17:19:43 -07:00
Colin Cross
c157a8d0e5 Allow libraries with no sources to be installed
Libraries with no source files but static lib dependencies should
still be installable.

Test: m -j checkbuild
Change-Id: Ibc91aa3153241092ce86888dbf90e99b66069ff2
2017-10-04 15:00:27 +00:00
Colin Cross
965714f139 Fix bootclasspath for host variants of java_library modules
The partial hostdex support was causing the host variant of
java_library modules to depend on core-oj and core-libart,
which caused the tagsoup jar to use the wrong
java.lang.System.arraycopy signature.  Remove the hostdex
code that was causing the problem, and add a test.

Test: java_test.go
Change-Id: I4f7b1f29c99aae328ba19b042538d9d35544aa43
2017-10-04 05:50:00 +00:00
Colin Cross
6af17aa022 Add support for .proto files in java modules
Test: m -j checkbuild
Change-Id: Ia03429948baebff85164a91a34507866c97a08ef
2017-10-03 10:25:15 -07:00
Colin Cross
47ff2521c6 Relax SDK checks for unbundled builds
Unbundled builds might not have the prebuilt/sdk files, allow
the build to continue and then fail if the module is actually
built.

Test: m -j checkbuild
Change-Id: I21163778f1cc50945c7a12e57da0e39ba963aa7c
2017-10-02 23:18:32 -07:00
Colin Cross
d5934c8bb7 Fix arch specific properties for java modules
Arch specific properties were not being applied to modules
with OS set to Common.

Test: java_test.go
Change-Id: I8f1b49ca51b0cf96f78006dfcd121672e581d9c5
2017-10-02 23:18:19 -07:00
Colin Cross
a60ead85fc Make java_library_static uninstallable by default
Static libraries are not dexed and are not installable on a
device.

Test: m -j checkbuild
Change-Id: Iea01df381e6c8cf2439fdb87200895db6aac99e2
2017-10-02 23:01:02 -07:00
Colin Cross
0532fb0d4c Fix excluding resource directories
Using a glob as a path failed the existence check.  Append the
glob after converting the path to a string.

Test: TestExcludeResources in java_test.go
Change-Id: Ic1fd40aa283f3b0d59c1c589dbeec411583eddf1
2017-10-03 02:13:16 +00:00
Colin Cross
fa5eb23df6 Add no_framework_libs property
Add a no_framework_libs property similar to no_standard_libs.
The new property will allow modules to continue to link against
the standard bootclasspath libraries that contain java.*, but
not against the framework libraries.  This avoids having to
specify the bootclasspath libraries explicitly.

Test: m -j checkbuild
Change-Id: I0be13a45cadca9b90a0fd1797885cd18c5b462e3
2017-10-01 20:34:35 -07:00
Colin Cross
8b9d37b40a Allow modules with empty sdk_version in unbundled builds
The apps build depends modules that have empty sdk_version.  Let the
behavior match make for now.

Test: m -j TARGET_BUILD_APPS=Gallery2
Change-Id: Ie5545d2cd6b1268b0b3392dc0af2e4eb3d38a588
2017-09-30 02:41:25 +00:00
Colin Cross
0f37af0c15 Add java file resources and flag to include sources
Add a properties to allow including files as resources, including
support for filegroups.  Also add a flag that causes module sources
to be included in the final jar.

Test: java_test.go TestResources
Change-Id: Ida8ee59b28df9fe66952170f46470d3a09fd5d65
2017-09-29 14:02:22 -07:00
Colin Cross
8649b2653c Use pre-desugar classes in classpath
Follow the make change in I87aee34940937dbde33a977f55d1faf2c8054561
to use classes before desugar in the classpath.

Test: java_test.go
Change-Id: I1054f4aea1eb349b6f687e1af0adb92a944fd8c5
2017-09-29 14:02:22 -07:00
Colin Cross
59f1bb66ea Only desugar/dx installable libraries
Don't waste time running dx on libraries that will never end up
on the device.

Test: m -j checkbuild
Change-Id: Iad1750823d3261cd6ad6eb6aa00c74d45b9737a3
2017-09-29 14:02:22 -07:00
Colin Cross
40a3671416 Remove jarSpec structure
It's not doing anything anymore, and the next patch will need more
complex jar arguments.  Just remove it.

Test: m -j checkbuild
Change-Id: I96d15995e86263ec04fd5c13ab0fd54d8b85c788
2017-09-29 14:02:22 -07:00
Colin Cross
d689143f1d Move errorprone dependency to compiled classes jar
The resources jar and the combined jar are not always used, so
add the errorprone dependency to the compiled jar.

Test: m -j checkbuild
Change-Id: Iaa10a04347758c676bb704969b86f9442e6c3175
2017-09-29 14:02:22 -07:00
Colin Cross
86a63ff366 Rename resource_dirs to java_resource_dirs
For consistency with make, rename java resources to
java_resource_dirs and android resources to resource_dirs.

Test: m -j checkbuild
Change-Id: Ie9aac50fef40f6a9093b4b98759e79cd086bb797
2017-09-27 23:21:36 -07:00
Colin Cross
cb2c92961c Remove duplication of bootclasspath in DefaultLibraries
Don't add bootclasspath libraries as classpath dependencies too.

Test: m -j checkbuild
Change-Id: Icb45e45536ce3babab73f67d281ca593edd4ab7f
2017-09-23 22:36:16 -07:00
Colin Cross
a713a6f6bd Don't generate dex jars for host modules
Hostdex support isn't working yet, and we are accidentally producing
a dex jar for host modules, which confuses soong_java_prebuilt.mk.

Test: m -j checkbuild
Change-Id: Ie2c331fa697f49dab23c380a5c6e0490d67c9f74
2017-09-20 18:08:04 -07:00
Colin Cross
fc3674a607 Remove android_prebuilt_sdk modules
Forcing sdk modules to be declared explicitly is unnecessary, just
add the required dependencies on the jar and aidl files.

Test: java_test.go
Change-Id: Ib28bdc1051c5825e7c0efb6adff1f9282675560e
2017-09-20 13:20:45 -07:00
Colin Cross
2acdae8853 Fix java sdk tests
Fix the java module sdk tests, and expand them to cover testing
all classpaths including for the host.

Test: java_test.go
Change-Id: I71be13cc5545f5c4d5b377c4c8de3dccbb09abf9
2017-09-20 13:20:45 -07:00
Colin Cross
4c428dfb28 Convert java tests to NewTestArchContext
Java tests will need to test code inside if ctx.Device() blocks,
switch to using TestArchConfig and NewTestArchContext.

Disable TestSdk for now, just registering modules that depend
on the SDK triggers panics because of previously untested code
that is now executed.

Test: java_test.go
Change-Id: Iff2c814af56cc830327db8d951c4350034c00361
2017-09-20 13:20:45 -07:00
Colin Cross
6ade34f641 Initial device java support
First pass at java support for the device.  Adds desugar before
dx, and passes javalib.jar to make.

Test: m -j checkbuild
Change-Id: I3138d943bc4867a52c3fce8fbdb597773793988d
2017-09-20 13:20:45 -07:00
Colin Cross
635acc9446 Rearrange manifest file handling in merge_zips and soong_zip
Jar always puts default MANIFEST.MF files in if none was specified.
Copying that behavior in soong_zip causes problems with merge_zips,
because it ends up taking the default manifest from the classes.jar
instead of the user's manifest from res.jar.  We don't want the
user's manifest in the classes.jar, otherwise a change to the
manifest will cause all the class files to rebuild.  Instead,
move the manifest insertion to the final merge_zips stage.

Test: m -j checkbuild
Change-Id: Id6376961dbaf743c2fb92843f9bdf2e44b963be0
2017-09-20 13:20:45 -07:00
Colin Cross
945c000aac Add -XDskipDuplicateBridges=true flag to javac
Turbine leaves out bridges which can cause javac to unnecessarily insert
them into subclasses.  Setting this flag causes our custom javac to
assume that the missing bridges will exist at runtime and not recreate
them in subclasses.  If a different javac is used the flag will be
ignored and extra bridges will be inserted, which should be harmless.
The flag is implemented by https://android-review.googlesource.com/c/486427

Test: m -j checkbuild
Test: check core-libart for extra methods
Bug: 65645120
Change-Id: I6e2babe4a5a24cda4903845ae895c369343ec55b
2017-09-19 12:19:36 -07:00
Dan Willemsen
d6ba0d592c Use dependency tags for genrules
So that we don't get confused when using :<module> in srcs to depend on
a module that could also be a HostBinTool.

Test: m -j
Change-Id: Ia3b1c26826e70f84c6dc5ff78c95dd11d76901b6
2017-09-14 22:59:33 +00:00
Colin Cross
3a5de657db Add missing space between errorprone flags
A space was missing between flags in the errorprone build rule.

Test: m -j RUN_ERROR_PRONE=true checkbuild
Change-Id: If6f48a700e6f19e318b6cc9734e1d8fd2289491f
2017-09-11 23:10:21 -07:00
Colin Cross
4f26bc0263 Strip javac 9 module arguments
Strip module-related javac 9 command line arguments that don't apply
to javac 8.

Test: m -j checkbuild
Change-Id: If44a3d9d7227e923117dc75bbabbddb41026b25d
2017-09-11 13:14:21 -07:00
Colin Cross
018f4a0d08 Merge changes Ifbf9fe27,I41a6cd42,Ieae59efb
* changes:
  Allow some duplicates in merged jars
  Add support for java annotation processors
  Update java androidmk conversions
2017-09-09 05:18:44 +00:00
Colin Cross
1965568eee Use same module name for java binary wrapper and jar
Trying to use dx.jar for the jar module name and dx for the
wrapper module name leads to the make side installing dx.jar.jar.
The separate names are only needed to make LOCAL_REQUIRED_MODULES
work.  Make the names the same again, and use a manual dependency
from the installed location of the wrapper script to the installed
location of the jar to make sure that both get installed and that
the wrapper script timestamp is always as new as the jar.

Test: m -j checkbuild
Change-Id: Ibc8ce9d24ed770e9a270fb8eaa8fe1b427a382a7
2017-09-07 17:00:22 -07:00
Colin Cross
5349941875 Use soong_java_prebuilt.mk to export soong jars to java
Instead of trying to squeeze soong jars through prebuilt_internal.mk,
make a separate soong_java_prebuilt.mk.

Test: m -j checkbuild
Change-Id: Idadef3c21a6f618d573110f04c80d7db3db92031
2017-09-07 20:23:43 +00:00
Colin Cross
32f676a7b4 Add support for java annotation processors
Add annotation_processor and annotation_processor_classes properties.

Test: m -j checkbuild
Change-Id: I41a6cd42f0c048070a99cb18af150030170498f7
2017-09-06 13:44:03 -07:00
Colin Cross
0a6e007e06 Make javac rules output a jar with soong_zip
Make javac rules output a jar file instead of a classes.list.
Combine the output jar, static jar dependencies, and resources
into the final jar using a separate rule.  For now, use a shell
command with unzip and soong_zip to create the final jar,
eventually it will be done with a zip2zip-style jar combiner.

Bug: 64691570
Test: java_test.go
Change-Id: Id8e6313e0097b78947d88e86e47b56ad08caca1a
2017-09-05 22:08:13 -07:00
Colin Cross
fee57cb33e Move error_prone config to external/error_prone
The error_prone config will likely need to be updated at the same
time as the error_prone prebuilts, so move the config into the same
project.  This requires jumping through some hoops because
external/error_prone may not be present in all manifests.

Bug: 64489631
Test: m -j RUN_ERROR_PRONE=true
Change-Id: I2c59df1148134ffedac0e00d32ac7082a9fb5330
2017-09-05 22:08:13 -07:00
Treehugger Robot
612e27d545 Merge changes I825ec897,I565a5624
* changes:
  Support non-installable java libraries
  Add notice property to all modules
2017-09-05 22:31:33 +00:00
Colin Cross
2c429dc7d4 Support non-installable java libraries
Some java libraries will never be installed, support an
installable: false property and export it back to make as
LOCAL_UNINSTALLABLE_MODULE := true.

Test: m -j checkbuild, manually inspect out/soong/Android*.mk
Change-Id: I825ec897648c82fb7323da7df3539c9aaa6bcfce
2017-09-05 13:48:23 -07:00
Treehugger Robot
5ade8a859d Merge changes I7b6c6ce0,If0eaf5d5
* changes:
  Allow java modules to use filegroups
  Rename no_standard_libraries to no_standard_libs
2017-09-01 22:21:25 +00:00
Treehugger Robot
b0579d70b8 Merge "Add core-oj to bootclasspath" 2017-09-01 19:55:53 +00:00
Colin Cross
379877d794 Merge changes I5fae03f4,Id41ad4ea
* changes:
  Pass --min-sdk-version to dx
  Make binaries executable
2017-09-01 19:50:39 +00:00
Colin Cross
7f9036c89b Allow java modules to use filegroups
Using filegroups requires calling ExtractSourcesDeps from the deps
mutator.

Test: m -j checkbuild
Change-Id: I7b6c6ce0075e4a703d28085a3965f11d9bb46315
2017-08-31 13:48:52 -07:00
Colin Cross
227d436943 Add core-oj to bootclasspath
Also clear the bootclasspath for device builds so javac doesn't
fall back to the default rt.jar bootclasspath.

Test: java_test.go
Change-Id: Ia21f55c7d45db560e2f44be81b2f46587d9026f2
2017-08-31 13:48:52 -07:00
Colin Cross
595a406f88 Pass --min-sdk-version to dx
Pass the sdk_version property, the platform sdk version, or 10000
to dx as --min-sdk-version.

Test: m -j checkbuild
Change-Id: I5fae03f44153dc2d6244c33f4c055e746980aefe
2017-08-31 13:48:52 -07:00
Colin Cross
76b5f0ca31 Rename no_standard_libraries to no_standard_libs
For consistency with libs and static_libs.  And make it a *bool
so that it can be overriden when used in java_defaults modules.

Test: java_test.go
Change-Id: If0eaf5d5571dc6e565056d273b0addd960d6b33f
2017-08-31 13:48:52 -07:00
Colin Cross
5c51792926 Make binaries executable
Split InstallFileName into InstallExecutable that does chmod +x
after copying the file.  Also remove InstallFile and rename
InstallFileName to InstallFile.

Test: m -j checkbuild
Change-Id: Id41ad4eafe521f6cd5d8cc250b7747ecb3da8dfc
2017-08-31 13:48:52 -07:00
Tobias Thierer
77d0b41d2e Export JLINK and JMOD commands from soong.
jlink and jmod are new commands added in OpenJDK 9.
The new commands are exported only when the environment
variable EXPERIMENTAL_USE_OPENJDK9 is set to true.

Control of toolchain commands moved to soong in commit
2aad9c2882

Bug: 38177569
Test: Treehugger

Change-Id: I52d81b95357162e31a2017080b27ef076a470b14
2017-08-31 16:15:06 +01:00
Colin Cross
2aad9c2882 Export TARGET_JAVAC and HOST_JAVAC to make
Export TARGET_JAVAC and HOST_JAVAC to make.  This moves control
of the javac command line flags into soong.

Test: m -j checkbuild
Merged-In: Ifa3e35be0abd2778741680216427403ba58a0a3b
Change-Id: Ifa3e35be0abd2778741680216427403ba58a0a3b
(cherry picked from commit 2478d8b885)
2017-08-29 13:02:52 -07:00
Colin Cross
3203dde60b Pass javac flags to errorprone builds
Pass CommonJdkFlags to errorprone builds, which is required for
frameworks/base/layoutlib/create to work correctly.  Unfortunately,
javac and errorprone cannot use the same syntax for the heap size,
javac needs -J-Xmx and errorprone needs -Xmx, so split the heap size
flag out into a separate variable.

Test: m -j RUN_ERROR_PRONE=true javac-check
Change-Id: Icd7f8cf627534fb089ec83e462c060572dd2d20c
2017-08-28 19:27:36 -07:00
Colin Cross
c6bbef326f Add error-prone support
Add support for compiling java sources with the error-prone tool.

Test: m -j checkbuild
Change-Id: Ieb4ee0e05f8f34a52ed7bcf1c7cbacf1c9c4d0b5
2017-08-28 11:12:38 -07:00