Export information about java dependencies through a Provider
instead of accessing the module directly.
Test: java_test.go
Test: no changes to build.ninja
Change-Id: Ifc5d566bf6f6ebc0ad399e948effaa1ef6a22876
hilt_android requires seven separate annotation processors, which
is only feasible to support using exported_plugins to avoid having
to list all seven in every module that uses it. Unfortunately they
all set generates_api: true. Turbine is already disabled for modules
that directly use a plugin that sets generates_api: true, because
turbine doesn't run annotation processors. Also add support for
disabling turbine if a module transitively uses a plugin that
generates APIs via exported_plugins.
Bug: 173397767
Test: TestExportedPlugins
Change-Id: If70354a3dd67efb4ce88bc9c934d41ccb6241b28
The old representation consisted of a list of libraries (UsesLibraries),
a list of optional libraries (OptionalUsesLibraries) and a mapping from
library name to its build/install paths (LibraryPaths). The separation
into lists and map was necessary because of special handling of
compatibility libraries, which is now unified with normal libraries.
The new representation is a mapping from target SDK version to a tree
structure ClassLoaderContext. Each node of the tree represents a library
and contains library name, build/install paths and a slice of
subcontexts for dependencies. The same library may occur in the tree
multiple times in case it is a dependency of multiple libraries. The
order in which libraries are added matters (the resulting tree shape may
be different).
Test results have to be updated, as the resulting <uses-library> list is
reodered (previously it was a sorted list of map keys, and now it is
formed by a depth-first preorder traversal of the class loader tree).
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Bug: 168686456
Change-Id: I11be8cd2967f004fd58753d7c5fb99fed179cd63
Previously only the names were collected, and later used in the
manifest_fixer to add missing <uses-library> entries to the manifest.
Now we also need to collect build-time and on-device paths, to be used
in class loader context for dexpreopt. This commit only collects paths,
but does not pass them to dexpreopt yet.
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I34b229ee68f16ba215ba03770feadb4d890ec2bf
Test: lunch aosp_cf_x86_phone-userdebug && m
Test: Cherry-pick in internal master and check that on-device path to
com.google.android.dialer.support.jar now is on /product partition
(as it should be) and not on /system:
$ oatdump \
--instruction-set=x86 \
--oat-file=out/target/product/vsoc_x86/product/priv-app/GoogleDialer/oat/x86/GoogleDialer.odex \
| grep '^classpath' \
| grep -o '[^[]*com.google.android.dialer.support.jar'
/product/framework/com.google.android.dialer.support.jar
Bug: 132357300
Change-Id: Idf279ac713b9b29ff3a29f1b072bc1d57f48db26
This reverts commit b0dc851ff4.
Reason for revert: relanding original change. Build failures were
caused by a race with another CL: https://r.android.com/1320920
Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: Ic9016582dae7773b4d4f84a63425f1ef7a5d061f
This is a prerequisite change before adding DexJarInstallPath.
Test: lunch aosp_cf_phone-userdebug && m
Change-Id: I033e08b8bb06c0a844a6bbbfcdc48ce33e9c95cf
This change fixes a bug that jacoco-report-classes-all.jar does not
include info for APK-in-APEX such as the MediaProvider apk in
com.android.mediaprovider APEX.
Firstly, LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR is correctly set also for
the APKs included in APEXes. Secondly, the Make modules for the embedded
APKs are now built with soong_app_prebuilt.mk to correctly import the
jacoco file into the Make world.
Bug: 147296855
Test: execute the following command in internal master.
$ choosecombo cf_x86_phone userdebug
$ NINJA_ARGS="-t path out/target/product/vsoc_x86/jacoco-report-classes-all.jar out/target/common/obj/ETC/MediaProvider.com.android.mediaprovider_intermediates/jacoco-report-classes.jar" EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true m
The result shows that there is a path as follows:
out/target/product/vsoc_x86/jacoco-report-classes-all.jar
out/target/product/vsoc_x86/apex/com.android.mediaprovider/priv-app/MediaProvider/MediaProvider.apk
out/target/product/vsoc_x86/obj/ETC/MediaProvider.com.android.mediaprovider_intermediates/package.apk
out/target/common/obj/ETC/MediaProvider.com.android.mediaprovider_intermediates/jacoco-report-classes.jar
Change-Id: I52d11534a34eb35219bfafca4453e75a1b701c0e
The behaviour is similar to go/be#java_library.exported_plugins. Plugins added to exported_plugins of library X are not applied to the library itself, but rather to libraries that directly depend on the library X.
Test: m checkbuild
Bug: 139740873
Change-Id: I4042bd482ad9cb12d6fbaac51f039d38b1b7a428
The arch variants are hardcoded in every module type. Refactor
them out into a Target.Variations() method in preparation for
splitting the arch mutator into two, which will require using
different variations.
Test: m checkbuild
Change-Id: I28ef7cd5168095ac888fe77f04e27f9ad81978c0
The jars containing the merged header classes from transitive
static dependencies were stripping all of META-INF/. Kotlin
puts metadata in META-INF that is used to map the package to
the static class that contains the package-level functions.
This also exposed that the metadata in META-INF is always
called "name.kotlin_module", so a library that contains
kotlin files with a dependency that also contains kotlin files
would shade the metadata file. Use a unique name instead.
Fixes: 131709692
Test: m checkbuild
Change-Id: I5cd276e563206e37c4c0d90fe9f346e9396f88c0
Robolectric coverage needs a srcjar that sometimes needs to
include sources of dependencies. Track the arguments and
dependencies necessary to jar the sources.
Test: TestIncludeSrcs
Change-Id: I9979d2b8350923a2237e743c232e6e548f54ba3b
Robolectric needs to reference some modules declared with
java_host_for_device and java_device_for_host from Make for now.
Bug: 122331577
Test: m checkbuild
Change-Id: I09b3848edb120f2c3ee16b449b937b650f59811b
java_device_for_host and java_host_for_device allow treating a
device module as a host module and vice versa. They will be useful
for converting layoutlib and robolectric to Soong, as these modules
run device java code on the host.
Bug: 117920228
Test: device_host_converter_test.go
Change-Id: Ia9a371fb41a97bc16338097f3ce8b40099744167