Added new CompilerProperty flag, rename_kotlin_stdlib, which
allow to build kotlin libraries/binaries that use platform internal
version of kotlin stdlib (com.android.kotlin.*). This way, app-provided
kotlin standard library won't collide with version used internaly.
+ remove kotlinc-build.xml after compilation so it won't end up in the
result jar file
+ remove *.kotlin_module and *.kotlin_bultin filesfrom result jar file.
These files are needed only by kotlin-reflect library and
need more work to support kotlin-stdlib renaming.
Bug: 73281388
Test: java_test.go
Change-Id: Iae7ccb919e2ae9853b3f30f3dd447ebd01a1bed0
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
Support Droiddoc to Soong based on core/droiddoc.mk. The non-std doclet
based droiddoc compilation output is a "real" stubs.jar instead of a
directory of java files and a timestamp file.
The std doclet based javadoc compilation output is a "empty" stubs.jar
instead of a timestamp file.
The stubs.jar will be exported to
out/target/common/obj/JAVA_LIBRARIES/$(LOCAL_MODULE)_intermediates/classes.jar
and out/target/common/docs/$(LOCAL_MODULE)-stubs.jar
A $(LOCAL_MODULE).zip file will be generated also, and is exported to
out/target/common/docs/$(LOCAL_MODULE)-docs.zip if property: installable is not set
to false.
Bug: b/70351683
Test: unittest + convert libcore docs Android.mk to Soong manually.
Change-Id: I1cffddd138a5d9d445f86a3d4a3fd4de88a2bc0f
(cherry picked from commit 78188ec622cb1ee24171455867fc58ffab91562e)
This reverts commit 606e9de344.
Reason for revert: <try to fix the broken build yesterday>
Change-Id: I2963b9af63c7c7398159e5e9a1e448266e1c81d5
Test: unittest
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 other sdk (e.g.
current) or without sdk.
Bug: 72206056
Test: m -j
Change-Id: I778e7b4fcb9456a12b418ffd633ea78e29951e84
PLATFORM_SYSTEMSDK_VERSIONS is the list of System SDK versions that the
platform is supporting. Contrary to the public SDK where platform
essentially supports all previous SDK versions, platform support only a
few recent System SDK versions, since some of old System APIs are
gradually deprecated, removed from the following SDKs and then finally
deleted from the platform. This will be part of the framework manifest.
The list can be specified by setting PLATFORM_SYSTEMSDK_MIN_VERSION. If
it is set to an old version number, then System SDKs from the version
to the current version (PLATFORM_SDK_VERSION) are considered to be
supported by the platform. If PLATFORM_SYSTEMSDK_MIN_VERSION is not set,
only the latest System SDK version is supported.
Next, BOARD_SYSTEMSDK_VERSIONS is the list of System SDK versions that
the device is using. This is put to the device compatibility matrix
device is using. The device and the platform is considered as compatible
only BOARD_SYSTEMSDK_VERSIONS in the device compatibility matrix are
in the PLATFORM_SYSTEMSDK_VERSIONS in the framework manifest.
When BOARD_SYSTEMSDK_VERSIONS is set, a Java app or library in vendor or
odm partitions which didn't specify LOCAL_SDK_VERSION is forced to use
System SDK. Also, the build system does the additional integrity check
to ensure that LOCAL_SDK_VERSION is within BOARD_SYSTEMSDK_VERSIONS or
PLATFORM_SYSTEMSDK_VERSIONS (if BOARD_SYSTEMSDK_VERSIONS isn't set).
Bug: 69088799
Test: m -j
Test: BOARD_SYSTEMSDK_VERSIONS=P m -j
Change-Id: Id38f02b4be86710411be22bc28109e6894f8a483
Follow the Make change in I9b6081edfdd2c3e9a450ae8a39c4e32c3d2cda92
to explicitly pass the OpenJDK 8 bootclasspath when targeting <= 1.8.
Bug: 70862583
Test: java_test.go
Test: javap -c -p out/soong/.intermediates/external/guava/guava/linux_glibc_common/javac/classes/com/google/common/hash/AbstractStreamingHashFunction\$AbstractStreamingHasher.class | grep ByteBuffer.flip
shows java/nio/Buffer return type in signature.
Change-Id: Ief66bbf6e3a4220b3afb2e02009bd0157d4c7fae
The kotlinc build rules were missing dependencies on the jars in
the classpath.
Test: TestKotlin in java_test.go
Change-Id: I56681785289f942b1070751b7dc5944e7a995b7f
Add a common_first multilib type and use it for java.Binary
so that the java part is compiled as a "common" arch type
but the wrapper script is installed as a "linux_glibc" arch
type. This allows java_binary to be used as a tool dependency
for a genrule.
Bug: 68397812
Test: TestJavaBinary
Change-Id: I809060839ce8878300da3fb76426ceb1ea6b0e8e
Add a java_genrule that has the right multilib flags to be a
dependency of a java rule. Make java libraries implement
SourceFileProducer so that their classes jar can be used as an
input to a java_genrule. Allow libs and static_libs dependencies
to be a java_genrule.
Test: TestJarGenrules
Change-Id: Ib1b31ef9c0b7e72eeed2c9ecc4ce8a1088e0b1c9
Instead of passing all the options to testJavaWithEnvFs, split it
up into testConfig, testContext, and run. Tests that don't need
any special options can continue to use testJava, more complicated
tests can call the three functions manually. This gives more
flexibility in complicated tests for the next patch.
Test: soong java tests
Change-Id: Ifd5dcb40cf08e4cbf69bf8e02c5698adbfbcdcb3
The system_$(VER) is added for vendor, similar to sdk.
Bug: 67724799
Test: build
Merged-In: I2545c92707591ca278066870c74e9f49e9825855
Change-Id: I2545c92707591ca278066870c74e9f49e9825855
(cherry picked from commit b8baff1fa3)
Update app support enough to build framework-res.apk, link
framework.jar against its generated files, and export it to
make.
Bug: 69917341
Test: m checkbuild tests docs
Change-Id: I7db29cd1f5fabb22e844483ecc7c38abfedbbe0a
Use aapt2 instead of aapt to compile Android app resources.
Also generate all files into srcjars instead of individual
sources.
Test: m checkbuild
Change-Id: I5a67991a0daf0017e8159b46fcff7d5564a91468
Move the java test resources from res to java-res to avoid confusion
with Android app resources that are implicitly expected in res.
Also allow tests to provide extra files.
Test: java_test.go
Change-Id: I13349a21da5c6d449cd23947c2628efbed3eb230
kotlinc expects -classpath, not --classpath.
Also add a test that uses only .kt files to exercise the code when
there are no java sources.
Test: java_test.go
Change-Id: Ifa5a007b460b40ea2188d0907570fbdca6c48da7
Ninja doesn't support depfiles on a rule with multiple outputs.
Use a single output and put all the rest as implicit outputs.
Bug: 68057449
Test: java_test.go
Change-Id: Ia544493b1b3b51b185c865149d8f3e0eb3c57ee2
The android_*stubs_current modules don't yet exist, so fall back to
the prebuilt jars for now.
Test: m checkbuild
Change-Id: Iabd32b30954b3f4a6d9a779fde52a032b684807e
If sdk jars(android_stubs_current, etc) are compiled using soong java
modules, we have to filter them when running Java build with Turbine.
TODO: provide more unit-tests.
Test: m clean && m -j32; go test java_test
Change-Id: Iad7c241b0e8b0ca760950733f513124b56c84564
Make all the jar intermediates called modulename.jar, and put each
in a subdir for the tool that generated it. This will simplify
using the jars as inputs to genrules and resources.
Test: java_test.go
Change-Id: If00e16bd7df5a4ba24ebc4b68c9ccf2cfda49544
Allow java libraries to specify .kt sources, precompile them with
kotlin, and then pass them in the classpath to javac.
Bug: 65219535
Test: java_test.go
Change-Id: Ife22b6ef82ced9ec26a9e5392b2dadacbb16546f
Adds a java_system_modules module type that (when
EXPERIMENTAL_USE_OPENJDK9 is set to true) converts a list of
java library modules and prebuilt jars into system modules,
and plumbs the system modules through to the javac command
line.
Also exports the location of the system modules to make
variables, as well as the name of the default system module.
Test: TestClasspath in java_test.go, runs automatically as part of the build
Bug: 63986449
Change-Id: I27bd5d2010092422a27b69c91568e49010e02f40
java_resource_dirs was using a file list file that was generated
at ninja time to get the list of files to include, which meant
there were no dependencies on the files to cause res.jar to get
rebuilt. Switch to using a glob at soong time instead. This
is substantially similar to a glob in java_resources, except that
java_resource_dirs strips the listed directories off the paths
that end up in the jar.
Test: TestResources in java_test.go
Change-Id: I4b9b38f7b6b38a013cbb4e211187e7282a6795c0
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
Arch specific properties were not being applied to modules
with OS set to Common.
Test: java_test.go
Change-Id: I8f1b49ca51b0cf96f78006dfcd121672e581d9c5
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
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
Follow the make change in I87aee34940937dbde33a977f55d1faf2c8054561
to use classes before desugar in the classpath.
Test: java_test.go
Change-Id: I1054f4aea1eb349b6f687e1af0adb92a944fd8c5
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
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
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
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
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
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
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
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
And make it work like bazel's java_import, using a "jars" property
instead of "srcs", and allowing multiple jars to be listed.
Test: soong tests
Change-Id: Ida2ace6412bd77b4feb423646000a1401004e0ea
The java prebuilt tests weren't registering the prebuilts mutators,
which hid an issue where prebuilts modules weren't getting renamed
to avoid collisions with source modules of the same name, which
ended up causing the prebuilt module to try to add a dependency
on itself.
Test: java_test.go
Change-Id: I3327d27533591cb08a4b8b8b5e1668a6f72be8df
Prefixing names in the java package with "java" is redundant, inside
the java package it is clear that they refer to something java
related, and outside the package they will be referred to with a
java. prefix.
Test: java_test.go
Change-Id: I9eb8eecb7ac5f6fbf8e87f5c219b3f50dbd18c87