summaryrefslogtreecommitdiff
path: root/java/device_host_converter.go
AgeCommit message (Collapse)Author
2025-01-10Convert hasCode and aaptLibs to use ModuleProxy. Yu Liu
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: Ie937a236f3c286fb5b2cd439614f09f7a85e884f
2024-10-24Update DepSet references Colin Cross
Update all references to depset to use blueprint/depset, and to use DepSet instead of *DepSet. Bug: 375276086 Test: all soong tests pass Flag: EXEMPT refactor Change-Id: I59a7836d0975366ddc336225fb770ac7e6e0c8ea
2024-09-04Use transitive header jars in classpaths Colin Cross
Skip combining jars into turbine-combined, combined, and withres jars and instead collect transitive jars to use in the classpath and to produce the final dexed jar. This reduces the size of a `m checkbuild` in git_main by 11%, from 1300 KiB to 1154 KiB. It may also improve caching and reduce uplink network bandwidth when building with RBE, as now the classpath inputs to rules are themselves outputs of previous rules and so already in the RBE CAS. The downside is that the classpath inputs to each rule are now much longer, increasing the Soong ninja file size 11%, from 4.6 GiB to 5.1 GiB. This could be mitigated in the future by supporting something like depsets in the generated ninja file to reduce duplication. Bug: 308016794 Test: TestSimple, TestKotlin, TestClasspath Flag: build.RELEASE_USE_TRANSITIVE_JARS_IN_CLASSPATH Change-Id: I2b7b4261375494370da70f98597c8719f1d561cf
2024-08-27Add ctx argument to IDEInfo() Cole Faust
The IDEInfo() methods read properties. To make those properties configurable, we need a context to evaluate them with. Bug: 362579941 Test: m nothing --no-skip-soong-tests Change-Id: I26d4b7084439b3006e50b02277298f74a929e1aa
2024-08-08Add IdeInfo for java module types Spandan Das
This CL adds support for 1. java_system_modules 2. java_system_modules_import 3. java_device_for_host 4. java_host_for_device Bug: 356572093 Test: cat out/soong/module_bp_java_deps.json | jq '."core-all-system-modules"' is no longer null Change-Id: I73affae834df7f6ed961fa757585242f6d388395
2024-08-07Convert JavaInfoProvider to *JavaInfo Colin Cross
Convert JavaInfoProvider to return a *JavaInfo instead of a JavaInfo. This will reduce copying when reading the provider, and also allows JavaInfo to recursively contain a depset of JavaInfos from dependencies. Bug: 308016794 Test: go test ./java/... Flag: EXEMPT refactor Change-Id: Ibf6d9b797f760ad1fe815d59839839fdfad91733
2024-02-13Introduce library property is_stubs_module Jihoon Kang
is_stubs_module property signifies whether the module compiles stubs or not. The information is propagated to the reverse dependencies of the java_library/java_sdk_library modules via JavaInfoProvider as StubsLinkType, a ternary state that provides information about whether the provided jars are compilation of stubs or implementation, or unknown. When java_sdk_library sets StubsLinkType, its state is Unknown as the decision of providing stubs vs implementation jar differs by the reverse dependency. Note that this CL does NOT propagate the property up to its reverse dependencies. This will be done in follow up CLs. Test: m nothing Bug: 310504781 Merged-In: Ic81488dbd1c9af1b5d31a33e5e9441d9f1416dbe Change-Id: Ic81488dbd1c9af1b5d31a33e5e9441d9f1416dbe
2024-01-09Replace panic with ModuleErrorf Spandan Das
This is a followup cleanup for aosp/2876754 and replaces panic with ctx.ModuleErrorf. The latter creates a more expressive build error. Implementation details - export moduleErrorf interface from build/soong/android. This minimal interface will be used as a parameter for `DexJarBuildPath` - Add ModuleErrorf to the function signature of DexJarBuildPath. This parameter only gets used for Import and SdkLibraryImport structs. These two can have duplicate deapexer definitions, and ModuleErrorf will be used to report that error - Create a minimal implementation of `ModuleErrorf` in tests of java and apex Test: m nothing --no-skip-soong-tests Change-Id: I0febec651f40c3f04deb957e64133c94b80fbd78
2023-12-14Convert OtherModuleProvider to generic providers API Colin Cross
Convert all of the callers of OtherModuleProvider/OtherModuleHasProvider to use the type-safe android.OtherModuleProvider API. Bug: 316410648 Test: builds Change-Id: Id77f514d68761a262d9ea830a601dbed804bbbe5
2023-12-14Convert SetProvider to generic providers API Colin Cross
Convert all of the callers of SetProvider to use the type-safe android.SetProvider API. Bug: 316410648 Test: builds Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
2023-12-08Remove ConvertWithBp2build implementations Colin Cross
Remove the ConvertWithBp2build implementations from all the module types, along with the related code. Bug: 315353489 Test: m blueprint_tests Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-09-20Have ConvertWBp2build use Bp2buildMutatorContext Chris Parsons
This no-op refactoring facilitates some upcoming functional changes for "bp2build allowlist v2". The work requires that the bp2build conversion mutator be changed from a TopDown mutator to a BottomUp mutator. Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext makes it easier to make this functional change without touching tens of files and multiple projects. Bug: 285631638 Test: m bp2build Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
2023-07-20Track transitive usage of aconfig flags and add LOCAL_ACONFIG_FILES to ↵ Joe Onorato
Android-<product>.mk Bug: 283910439 Test: m nothing (runs soong tests) Change-Id: I59f9bef7b7c502565d531a5685c002a177e0a77c
2023-04-11Bp2build support for sdk_version and java_version. Romain Jobredeaux
This CL adds java_version and sdk_version support to bp2build converters for - java library - java binary - android library - android binary - android library import Although java import doesn't support java_version and sdk_version, the neverlink java_library wrapper around a java_import must specify a sdk_version when targetting a device. "none" is used by convention. Change-Id: I22a69dea2e351858368df69ed6a703b568d613ea Bug: 215230098 Test: Presubmits
2023-04-04Bp2build converter for java_host_for_device. Romain Jobredeaux
Change-Id: I70a345c641bbed3223dc6222062fb6948f7dc6cb Bug: 276710283 Test: Presubmit
2021-10-13Add android_sdk_repo_host to build platform-tools&build-tools Dan Willemsen
The Android SDK has been built with Make up until now, monolithically, then split up into several sdk-repo zip files for different purposes. The Mac and Windows SDKs really only need to contain the platform-tools and build-tools pieces, but due to this monolithic sdk zip, we had to build the whole SDK first. This adds an `android_sdk_repo_host` module that can build these platform-tools and build-tools zips. Bug: 187222815 Change-Id: I55809e1d7447dd65e22461f921b2b8abb6d5f822
2021-03-05Clear remains of java.Dependency interface. Jaewoong Jung
Test: TreeHugger Change-Id: If9dab2022a308b776d7ad760a61f0db97509b9b2
2021-02-09Convert java.Dependency to JavaInfo provider Colin Cross
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
2020-11-23Remove restriction on exported plugins that generate APIs Colin Cross
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
2020-11-16Rename fields and methods to reflect class loader context changes. Ulya Trafimovich
Test: lunch aosp_cf_x86_phone-userdebug && m Bug: 132357300 Change-Id: Iebfbf2ffdac5ee48476d2aac312b3b8f4471fc85
2020-11-03Rework class loader context implementation. Ulya Trafimovich
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
2020-08-19Collect paths to transitive SDK Java library dependencies. Ulya Trafimovich
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
2020-06-11Use inclusive language in build/soong Colin Cross
Test: m checkbuild Change-Id: Id07890b7cbc2397291a658ca00e86b43c743aafc
2020-06-10Fix on-device paths to used libraries in dexpreopt. Ulya Trafimovich
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
2020-06-04Revert^2 "Rename DexJar interface method to DexJarBuildPath." Ulyana Trafimovich
This reverts commit b0dc851ff4eca650042b52ce4ff06cb7e0312b77. 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
2020-06-04Revert "Rename DexJar interface method to DexJarBuildPath." Ulyana Trafimovich
This reverts commit 562c240185dd4adcbdb75d2924c69657f6ac7cff. Reason for revert: breaks `lunch full-eng && m checkbuild`. Change-Id: Id7c7d6240d98afaf8edd49b6c96cd05534b784cc
2020-06-03Rename DexJar interface method to DexJarBuildPath. Ulya Trafimovich
This is a prerequisite change before adding DexJarInstallPath. Test: lunch aosp_cf_phone-userdebug && m Change-Id: I033e08b8bb06c0a844a6bbbfcdc48ce33e9c95cf
2020-01-08jacoco correctly gathers info from APK-in-APEX Jiyong Park
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
2019-11-26Add exported_plugins to java.Library. Artur Satayev
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
2019-10-16Add method to determine variations from a Target Colin Cross
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
2019-05-14Merge "Fixes typos in device_host_converter.go comments." Treehugger Robot
2019-05-13Fixes typos in device_host_converter.go comments. Jaewoong Jung
Test: TreeHugger Change-Id: Ie786e8fc950c3e9913c9d51f2b88bc036bb17462
2019-05-08Don't hide *.kotlin_module in turbine dependencies Colin Cross
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
2019-05-06Track sources for srcjars across modules Colin Cross
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
2019-04-24Export java_host_for_device and java_device_for_host modules to Make Colin Cross
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
2019-03-05Add modules for converting java modules between host and device Colin Cross
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