summaryrefslogtreecommitdiff
path: root/java/java.go
AgeCommit message (Collapse)Author
2023-12-20Use the correct bootjars when multiple prebuilt apexes exist Spandan Das
hiddenapi and dexpreopt require boot and system server jars from apexes. When building with prebuilts, this comes via java_import/java_sdk_library_import, which acts as a hook for prebuilt_apex/apex_set. If we have multiple apexes in the tree, this hook becomes 1:many. This CL prepares dex_bootjars to select the right deapexerd .jar files when mutliple prebuilts exist. Implementation details - Update prebuilt module types (prebuilt_apex/apex_set) and source apexes to set a map of library name to dex jar path on host. - dex_bootjars will access the path of the .dex jar on host via the provider. These then copied/installed to the right locations. This CL does not drop the old mechanism to get the dex file (i.e. by creating a dep on java_library). Once all mainline modules have been flagged using apex_contributions, the old mechanism will be dropped Bug: 308790457 Test: git_master-art-host:art-gtest https://android-build.corp.google.com/builds/abtd/run/L21500030000926533 Test: git_main:art_standalone_dexpreopt_tests https://android-build.corp.google.com/builds/abtd/run/L99000030000891212 Test: Added a unit test that checks that the right .jar is selected when multiple prebuilts exists Change-Id: I6ef94135b9303a35135810930af4b641df13a583
2023-12-18Move validation from FindDeapexerProviderForModule to rdeps Spandan Das
FindDeapexerProviderForModule raises an exception if multiple apexes in the tree has an export dep on the java module. In prepartation to support multiple prebuilts, move this error check out of FindDeapexerProviderForModule and into rdeps. i.e. raise an exception only if an rdep calls DexJarBuildPath - This should be a no-op for now. - In the short-term future, a java import module will be allowed to have multiple deapexers. An error will be raised if anyone actually tries to depend on the dexjar - In the long-term future, this function will be removed. All processing will be done at the prebuilt apex level and not at the prebuilt java library level Since this check now happens in the moduleCtx of rdeps, add some additional props to unit tests to ensure that it does not exit early on unrelated validation checks (e.g. hidden_api prop is not set) Test: go test ./apex ./java Bug: 308790457 Change-Id: I3323d993c1ea8f43305834cae8e65b6fe41dfefd
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 Provider to generic providers API Colin Cross
Convert all of the callers of Provider/HasProvider to use the type-safe android.ModuleProvider API. Bug: 316410648 Test: builds Change-Id: I73479de1625fa2865b6c73444cd477e50d56dc5a
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-14Convert NewProvider/NewMutatorProvider to generic providers API Colin Cross
Convert all of the callers to NewProvider and NewMutatorProvider to use a generic type parameter instead of an example object. Bug: 316410648 Test: builds Change-Id: Ic9cdafc87336e26730d3fd596df05de0e7267542
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-12-07Add aconfig flag support for android_app Jihoon Kang
This change adds an overrideable property flags_packages to android_app, which is used to list the aconfig_declarations module names that the app depends on. The build action of android_app is modified to pass all flags text file provided by the aconfig_declarations to aapt2 link as --feature-flags arguments. Test: m nothing --no-skip-soong-tests Bug: 306024510 Change-Id: I4924f88b9954950cc1936a472cd7ac70f41add5d
2023-11-30Merge "Add container property to aconfig_declarations." into main Yu Liu
2023-11-29Don't write transitive dependencies to Android-${TARGET_PRODUCT}.mk Colin Cross
Java libraries were writing lists of files that changed whenever transitive dependencies changed to Android-${TARGET_PRODUCT}.mk, causing Kati analysis to rerun whenever a dependency was changed in Soong. In both cases, Make would immediately use the list to write a single output file. Write the files in Soong and pass the path to the file to Make instead, which will both reduce the size of Android-${TARGET_PRODUCT}.mk and skip Kati analysis more often. Bug: 309006256 Test: m checkbuild Change-Id: I5dff16c6fb7cca8c6da927b37c612c7b1d0954e6
2023-11-28Add container property to aconfig_declarations. Yu Liu
Bug: 311155208 Test: Unit test Change-Id: I7b187138856d0144203961e82b6dad5e2f8eed9d
2023-11-17Change deps of ctx.Install* from Paths to InstallPaths Colin Cross
Installed files should only depend on other installed files, change the deps arguments of the ctx.Install* methods from Paths to InstallPaths. Bug: 311428265 Test: builds Change-Id: I1ebef60a943bdbe907744cc43aa985371ac56d32 Merged-In: I1ebef60a943bdbe907744cc43aa985371ac56d32
2023-11-15Merge "Stop collecting path entry for module_bp_java_deps.json from each ↵ Colin Cross
module type" into main
2023-11-15Stop collecting path entry for module_bp_java_deps.json from each module type Colin Cross
The jdepsGeneratorSingleton can get the module path directly, it doesn't need to be collected by each module type that implements IDEInfo. Fixes module types (like android_library) that didn't reach the code that collected the path. Bug: 309835196 Test: out/soong/module_bp_java_deps.json contains path for ExtServices.core Change-Id: If8cb81b4f708e0367f156ade164bee253bf53492
2023-11-15Add proto for Test ownership metadata. Aditya Choudhary
This Cl adds a new rule to Soong to generate test spec metadata. Also, this CL adds a provider in various test module to provide test spec related data to the Soong rule. Will add providers and test code to other Module in the future changes. Provider added for the following test modules in this change: android_robolectric_test, android_test, bootclasspath_fragment_test, java_test, java_test_host, python_test, python_test_host, sh_test,and sh_test_host. Bug: 296873595 Change-Id: I5f89f72d5874bb7838ae357efdb8c6ca208e18a7
2023-11-01Merge "Add the name of the sdk library to dynamically generated java ↵ Spandan Das
modules" into main
2023-10-31Add the name of the sdk library to dynamically generated java modules Spandan Das
The name of the sdk library will be used in source vs prebuilt selection. For soong modules that are not dynamically created from a java_sdk_library, the value will be nil. Bug: 308174768 Test: TH Change-Id: Ic7e9889f00c6184992b663a7124967bb0794d475
2023-10-31transitive r8 flags for installable {android,java}_libraries Sam Delmerico
Only android_apps were actually applying transitive proguard flags files to their r8 invocation. This CL ensures that this also occurs for installable android_libraries and java_libraries. Bug: 302342049 Test: go test ./java Change-Id: Ie94d688d04367ee3d39e7e760fb3003df5829951
2023-10-18Merge changes from topic "revert-2786699-import-sdk-version-none-WYNCDQGHTE" ↵ Treehugger Robot
into main * changes: Revert "Don't use java_library for java_import neverlink" Revert "Do not convert sdk_version: "none""
2023-10-18Merge "Shard Javac" into main Treehugger Robot
2023-10-18Revert "Don't use java_library for java_import neverlink" Liz Kammer
Revert submission 2786699-import-sdk-version-none Reason for revert: b/306220520 Reverted changes: /q/submissionid:2786699-import-sdk-version-none Change-Id: I4fbe5fa54dc11fac898a7f15704833f01b9fa269
2023-10-18Revert "Do not convert sdk_version: "none"" Liz Kammer
Revert submission 2786699-import-sdk-version-none Reason for revert: b/306220520 Reverted changes: /q/submissionid:2786699-import-sdk-version-none Change-Id: I309e269db70d9fedaf010ef44791516392fcb4ea
2023-10-18Shard Javac usta
Test: m nothing Test: allowlist frameworks/opt/calendar to bp2build convert Test: add `javac_shard_size: 2` to calendar-common Test: b //frameworks/opt/calendar:calendar-common Bug: 297356812 Change-Id: Ie22bcf04946f3945952a74a46772b777b1522b70
2023-10-17Do not convert sdk_version: "none" Liz Kammer
These also require system_modules to be set. Wait until we convert system_modules to convert sdk_version: "none" Test: CI Change-Id: I5bbdcb6819709a7c5a7932cb860a0de945f3528e
2023-10-17Don't use java_library for java_import neverlink Liz Kammer
Restricting use of sdk_version = "none" to only the rule types that will correctly handled sdk_version = "none" by also handling system_module attr Test: CI && go tests Change-Id: Ifa1c60ba8f5e3fcb28986cc84cdfaedcbd2d2957
2023-10-16Merge changes from topic "stub_validation" into main Jihoon Kang
* changes: Add current api check as validation for from-text stub generation Disable full_api_surface_stubs for some java_api_library modules
2023-10-13Add current api check as validation for from-text stub generation Jihoon Kang
Currently, there is no build action ensuring that the API text files are up to date, unless a user runs `m checkapi` or `m update-api`. This means that the user must run `m update-api` after making a change that modifies api surface(s), so that the API text file reflects the local change. This adds additional layer of action to developers, and it is not guaranteed that the developer will always run `m update-api` after making an api surface-affecting changes. To prevent such mistake, this change adds droidstub-level api check as validation for from-text stub generation. With this change, the build will fail if the API text file is not up to date and the user must run `m update-api` when making api surface-affecting local changes. The validation is done by adding all droidstubs modules associated with the java_api_contributions passed to java_api_library via `api_contributions` as dependency and setting the current api timestamp files as the validations for the from-text stubs generating build rule. The full api surface libraries will not run the validations to avoid circular dependency. However, all java_sdk_library generated java_api_library modules will run validations, mapped to the droidstubs in the same api domaion. If the user sets the environment variable `DISABLE_STUB_VALIDATION=true`, validation actions are not run. Validation actions run by default. Test: m nothing --build-from-text-stub and run ninja query to verify `check_current_api.timestamp`s are listed as validation \ DISABLE_STUB_VALIDATION=true m nothing --build-from-text-stub and run ninja query to verify that validation actions are not added Bug: 288624417 Change-Id: I329e6438fe8f3ac30d8c6a971d57853ed6b0d150
2023-10-12Handle java_resources as deps Liz Kammer
Test: CI && unit tests Change-Id: I51f3c7d876c3cc25cb0459d933e1a510cfb5bf13
2023-10-12Change openjdk9 specific props in bp2build/Soong Liz Kammer
JDK17 is the default java version, adding these props conditionally openjdk9 is no longer relevant Test: CI Change-Id: I5d80fd22f474cedf389d1e295620cfc17bc327a0
2023-10-11Merge "Change java_test_host to support cov variant." into main Yu Liu
2023-10-10Change java_test_host to support cov variant. Yu Liu
Bug: 279960392 Test: CI and m --skip-soong-tests TARGET_PRODUCT=aosp_x86_64 EMMA_INSTRUMENT=true CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS="external/cronet" mts Change-Id: I4489ed725aee6097e6e340f5f6d06ecaf1c64222
2023-10-09Introduce system_modules property to java_api_library Jihoon Kang
System_modules property provides the jars passed as bootclasspath when compiling the stubs in the java_api_library where its creating java_sdk_library's sdk_version is none, as the jars will not be provided from the full_surface_stub_libs but compiled by itself in the child change. The jar provided by the system_modules will also be passed to metalava to resolve hierarchy coming from outer dependencies. Test: m --build-from-text-stub Bug: 288624417 Change-Id: I8f3b89efa24bceb070d7a37fae3c7334dd7f0868
2023-09-28Collect transitive source files for java modules Anton Hansson
This new entry in the JavaInfoProvider lists all the transitive source files contained within the library. That is, the source files of the module and all its static dependencies. Bug: 151360309 Test: unit test in java_go + some manual testing Change-Id: I7fe3035b9e46774095c0e9196cd77fa1027adf6d
2023-09-25Merge changes from topics "remove_api_files", "remove_naming_convention" ↵ Jihoon Kang
into main * changes: Remove naming conventioned based file sorting in java_api_library Remove api_files property from java_api_library
2023-09-22Pass java_library libs and static_libs to java_*_proto_library Zi Wang
If a java_library module has proto srcs, a java_*_proto_library target will be created for it. Proto sources are generated and then compiled by a java_library target. We need to pass the libs and static_libs of the java_library module to this java_library target so that the compile-time classpath is correct. Test: updated unit tests and CI Bug: 301469542 Change-Id: I05b2efce6fda2223e85728b3c4c7b1815d04c3dd
2023-09-22Remove naming conventioned based file sorting in java_api_library Jihoon Kang
With api_files property being removed from java_api_library, all api files are passed to java_api_library via java_api_contribution, which provide api_surface information. Instead of relying on the naming convention of the api files, java_api_library can utilize this information to sort the api files from narrower api scope to the wider api scope. Test: m --build-from-text-stub Bug: 295429988 Change-Id: Idd832778833c072c6b7e9d1f775533e5f4e2af00
2023-09-21Remove api_files property from java_api_library Jihoon Kang
java_api_contribution provides api_surface information, but files directly passed to java_api_library do not possess such information. Currently, the api surface is assumed via naming convention for api files passed via api_files property, but this is fragile. This change removes the api_files property from java_api_library and enforce all api files to be passed via java_api_contribution Test: m nothing --build-from-text-stub Bug: 300964421 Change-Id: If01d9ed978fe469d4ee0d685582a51629ebecc56
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-09-19Refactor bp2build tests for allowlist v2 Chris Parsons
Allowlist v2 will change bp2build by automatically disabling rdeps of unconvertible modules. Many bp2build tests create bp2build stub modules without an implementation, This CL changes setup of such tests to also contain a BUILD file with "stub implementations" of equivalent targets, to keep these test targets convertible. To verify this change in-place, this CL removes `bp2build_available: false` from these dependencies. This is a test-only change for bp2build tests. Bug: 285631638 Test: m bp2build Change-Id: I489480cbc4158a416b7abf57c35a6e2bc2ad6173
2023-09-18Merge changes I8466db71,I83180699 into main Treehugger Robot
* changes: Sort api files by api surface in java_api_library Add java_api_contribution_import module type
2023-09-18Sort api files by api surface in java_api_library Jihoon Kang
metalava requires api files to be sorted in the narrower api scope to the wider api scope when passed as inputs. Previously, the api files were sorted based on the naming convention, but some api files in prebuilts do not necessarily follow the naming convention (i.e. *-current.txt). Therefore, utilize the api surface information provided by the java_api_contribution provider instead of the naming convention to sort the api files. Test: m nothing Bug: 300175323 Change-Id: I8466db712bff8fef906186bd272d85682877533d
2023-09-15Add java_api_contribution_import module type Jihoon Kang
java_api_contribution_import is a prebuilt module type of java_api_contribution. It's build actions are identical to those of java_api_contribution. Test: m nothing Bug: 300174357 Change-Id: I831806990b37b340af21858eb2bab5de62fdf7a9
2023-09-15Always drop deps from java_library with no srcs Zi Wang
This is the follow up from aosp/2750763 Test: CI and added unit test Bug: 285952385 Change-Id: I64703ee4fa742b718ffb43f2af1b6ab43ddeb606
2023-09-13Do not append deps to exports when java_library has only proto srcs Zi Wang
This is to address the comment in aosp/2748099 Test: CI Bug: 285952385 Change-Id: I0bc8c76e2bc9ee113ced8642e0ab93a95799211c
2023-09-13Merge "Utilize `-quiet` flag in java_api_library" into main Jihoon Kang
2023-09-13Utilize `-quiet` flag in java_api_library Jihoon Kang
java_api_library finds and zips class files based on pattern matching, leading to multiple missing files warnings being printed to console during from-text stub build. This change passes the `-quiet` flag to soong_zip to prevent such warnings from being printed. Test: m --build-from-text-stub and inspect console output Bug: 300166930 Change-Id: I23d49b5e3a29d2127f5e917169620e18a98bc06b
2023-09-12Bp2build: handle the case where java_library has only proto srcs Zi Wang
java_library doesn't accept deps when there are no srcs because no compilation happens, but it accepts exports. The deps from the module are not necessary for compiling the protos, in which case they are unnecessary as deps on the java_library as well since they are not be propagated to any dependencies. So we can put the deps to exports and drop deps here. Test: CI and added unit test Bug: 285952385 Change-Id: Ie54a4ac0db592fb96fede64f0e67df309dca9c1d
2023-09-08Do not convert resource dirs without resources Liz Kammer
Previously we would convert to java_resources when there were no resources and get an error. Test: b build //external/libphonenumber/... --config=android Change-Id: I86f30b993a3ffdb20000f6a4c5261e2c4c74263c
2023-09-08Do not convert java libraries with core_platform Liz Kammer
Test: go bp2build tests Change-Id: I2769c0d589c304caeb24a8ecba38a4a5ee6c63e5
2023-08-31Merge "Remove unnecessary options when generating stubs from signatures" ↵ Treehugger Robot
into main