summaryrefslogtreecommitdiff
path: root/java/java.go
AgeCommit message (Collapse)Author
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
2023-08-31Remove unnecessary options when generating stubs from signatures Paul Duffin
These options are unnecessary because: * `--format` and `--api-overloaded-method-order` only affects the generation of signature files which this does not do. Also changed the build rule description to differentiate from the usual metalava command to make it easier to find in the ninja file. Bug: 296115567 Test: m --build-from-text-stub Change-Id: I7986cba00c364282ddc436d2e69bfb66eda46436
2023-08-29Add do not convert for sdk_version unset Liz Kammer
When sdk_version is unset, the build with fail with Bazel because private APIs are do not build with Bazel at this time. This instead prevents migrating the relevant target to Bazel in bp2build Test: go tests Change-Id: I31dabcf143de7933706d1b734ef21467a01b65e9
2023-08-28Merge "support for multiple filegroups and resource_dirs" into main Alix Espino
2023-08-25support for multiple filegroups and resource_dirs Alix
Test: tests in bp2build and b build //external/emma:emma Change-Id: I57e60389aec926c55d01818a6a3b1ec33e9c53b8
2023-08-23Merge "java_library support for building headers-only" into main Mark White
2023-08-22java_library support for building headers-only Mark White
Flag for java_library modules to build just the Turbine headers and skip building an impl jar. Test: go test java Bug: 289776578 Change-Id: Iad0babf951710476bc32df93c25d17065a14ab84
2023-08-18Merge "export_proguard_spec for libs deps" into main Treehugger Robot
2023-08-18export_proguard_spec for libs deps Sam Delmerico
Add a property to export proguard flags files for libs dependencies. Currently only proguard flags files from static deps are propagated up to reverse dependencies, but it is necessary sometimes to have flags from libs dependencies also be propagated. Bug: 289087274 Test: go test ./java Change-Id: Ic0aa22b086792bf322041aa5780db6c4f4eb2770
2023-08-14Add `previous_api` property to `java_api_library` module Jihoon Kang
`Previous_api` is used to migrate nullness information in metalava (i.e. convert @Nullable and @NonNull to @RecentlyNullable and @RecentlyNonNull for some methods). The input is required to generate loosely equivalent from-text stubs. Test: m && compare nullness annotations between from-source stubs and from-text stubs Bug: 293962901 Change-Id: Ic7a0868415fdb2c65d0d472e527fe73280b7651d
2023-08-11Move scopeOrderedSourceFileNames as outside var Jihoon Kang
This change enables scopeOrderedSourceFileNames to be not computed everytime when the function is called, but instead is computed once. Test: m Bug: 295429988 Change-Id: I33846cdb7a750e44e45049dbd342aa6ab8b70c4c
2023-08-11Sort api files by api scope in java_api_library Jihoon Kang
Recent changes in metalava (aosp/2704325) enforces api files passed as inputs to generate stubs from txt to be sorted in the order from the narrower api scope to the wider api scope. In order to comply with this change, all api files passed as inputs to metalava invocations need to be sorted in the respective order. Test: m out/soong/.intermediates/packages/modules/IPsec/tests/cts/CtsIkeTestCases/android_common/e10894d3da5db41239526c9048962355/javac/CtsIkeTestCases.jar --build-from-text-stub --skip-soong-tests (Failing module from incorrect class hierarchy when building from text stub) Bug: 295429988 Change-Id: I1eb1f4bf8fa34fd7dc8a0e4c04aa056258a975c5
2023-08-09Merge "Stop using single-hyphen metalava options" into main Treehugger Robot
2023-08-09Stop using single-hyphen metalava options Paul Duffin
`-encoding` and `-source` have been deprecated in metalava. `-encoding` actually does nothing apart from check to make sure that the value is `utf-8` (in some case). Metalava always uses `utf-8`. `-source` has been deprecated in favor of `--java-source` as metalava also can consume kotlin and it has its own `--kotlin-source` option. Bug: 295136054 Test: ./gradlew Change-Id: I08e6931958f40022d65d417360e32b72a1d70444
2023-08-04Add unconverted reason for jarjar incompatibility. Liz Kammer
Test: m bp2build Change-Id: I112b84fa53f57b9df2bd1e1616012fe55b48001e
2023-07-26Merge "Handle xsd config more like other partitions" into main Liz Kammer
2023-07-26Merge "Move android_library resource handling to Bazel's ↵ Treehugger Robot
ResourceProcessorBusyBox" into main
2023-07-25Move android_library resource handling to Bazel's ResourceProcessorBusyBox Colin Cross
The R.Java files generated by aapt2 link --no-static-lib-packages cause scaling problems by combining all resources into every package listed in a dependencies' AndroidManifest.xml file. For SystemUI-core this results in 74 R.java files, each with 76k lines, and takes 20 seconds to compile in javac. Both AGP and Bazel have workarounds for this that avoid using the R.java files generated by aapt2, instead generating more efficient R.class files directly based on the R.txt file. Bazel uses the ResourceProcessorBusyBox tool that is already present in our tree to process the resources. Reuse the same tool in Soong to create the R.jar. The more efficient R.class files require modifiying source files that use incorrect packages to refer to resources. Bug: 284023594 Test: TestAndroidResourceProcessor Change-Id: I026073b40dabcfdb10e5d7a52e9348205b0e9a66 Merged-In: I026073b40dabcfdb10e5d7a52e9348205b0e9a66
2023-07-24Handle xsd config more like other partitions Liz Kammer
This is prep work to add additional special handling for genrule generated headers as there will be similar partitioning for those headers. Test: go test soong tests Change-Id: Ib63e7e4f7554b2b7b7bc78b2825b20c05403216a
2023-07-21Merge "java_test macro needs srcs and deps to create .jar for ↵ Zi Wang
tradefed_test_suite" into main
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-07-19Merge "make android.InList generic" into main Sam Delmerico
2023-07-18make android.InList generic Sam Delmerico
Change-Id: Ic166216cb473371a5e34cd97a068ca35f5534740
2023-07-18Merge "Fix stem to be propagated to output jar name in java_library" into main Jihoon Kang
2023-07-17java_test macro needs srcs and deps to create .jar for tradefed_test_suite Zi Wang
Test: java_test_host_conversion_test.go and TH Bug: 280452825 Change-Id: Ibf0c7eed415fc58a4d228f0347ab125fdc4466e4
2023-07-17Merge changes from topics "errProne_bp2build_manually_enabled", ↵ Alix Espino
"error_prone_config" into main * changes: Bp2build for errorprone modules that manually enabled/disabled it Make errorprone a configurable attribute for bazel conversion
2023-07-14Fix stem to be propagated to output jar name in java_library Jihoon Kang
Currently, java_library.stem property is not correctly reflected in the output jar name in java_library when the module specifies java_resource_dirs property. This change fixes the unexpected behavior so that setting the stem property behaves as expected. Test: go test ./java && m Bug: 285843207 Change-Id: I0941fcea83c92f4c42ae415aa6ad9125da5cf57b
2023-07-13Bp2build for errorprone modules that manually enabled/disabled it Alix
Test: go test ./bp2build Change-Id: Ie60c0959ee9ae8ce86c11a8e85a0bc7592f63df8
2023-07-12Merge "AIDEGen: Collect apt generated sources" into main Vadim Spivak
2023-07-12AIDEGen: Collect apt generated sources Vadim Spivak
The Java compiler may generate sources when processing annotations. These sources are currently not included in the IDE project model, which results in unresolved symbols when using Hilt and other annotation processors. These sources are not passed to the Java compiler for compilation, so they cannot be handled like other Java module sources. This change archives the generated sources and appends them to the existing srcjar list in module_bp_java_deps.json. Test: go test . Test: Verified that module_bp_java_deps.json contained srcjar entry Test: with path/to/android_common/javac/anno.srcjar. Test: Verified that IntelliJ can resolve generated symbols after Test: invoking aidegen. Change-Id: I6a3011f9140fd25f785178baee0cd6074ad94600
2023-07-12Remove metalava --no-banner argument Mårten Kongstad
metalava no longer prints an ASCII banner, and has removed its --no-banner argument. Update all call sites accordingly. Test: presubmit Bug: 286023667 Change-Id: I61cf5f1125dfbd93496e6a59eb1ea62886b32046
2023-06-29Extract class files from dep_api_srcs instead of java files Jihoon Kang
Currently, stub java files are extracted from srcjar file provided from dep_api_srcs in java_api_library module generated in java_sdk_library per api scope. However, compiling the java files may lead to difference in the content of the generated class files even if the stub java files are equivalent, as javac may arbitrarily add overridden methods. Thus, create a stub jar file instead of creating a stub srcjar file and compiling it, in order to guarantee stub jar files content equivalence and thus enable hiddenapi during from-text stub build. Note that this change does not fully resolve differences between the full api surface csv and the per sdk_library csv. Instead, it removes the difference caused by methods arbitrarily added by javac. This change also renames dep_api_srcs to full_api_surface_stubs to be more intuitive. Test: rebase on top of aosp/2617274 and `m --build-from-text-stub` Bug: 275570206 Change-Id: I22b6d56624633681f5c3b000370b5782655c7b8d
2023-06-23Merge "Cleanup remaining android.JavaApiLibraryName() references" Treehugger Robot
2023-06-22Use generics for DepSets Colin Cross
Use Go's generics for DepSets so they don't require a type-specific wrapper and reflection. Test: depsets_test.go Change-Id: I22ba0b7d680d37d2cd05230b0f560d166c4dd20b
2023-06-15Cleanup remaining android.JavaApiLibraryName() references Jihoon Kang
Since the name of the java_library generated from sdk_library per api scope does not depend on the build configuration anymore, all dependency switching "magic" via android.JavaApiLibraryName() can be removed. This change also removes from-text-build-specific test cases, as those test cases depend on build configurations. Test: m nothing && m nothing --build-from-text-stub Bug: 287340610 Change-Id: I3bac35259e0cbaa16432a46cb2b128951c9bc075
2023-06-09Make aconfig flags generate a library instead of a srcjar. Joe Onorato
Also add unit tests for the rest of device_config Bug: 283475679 Test: m nothing (soong unit tests) Change-Id: Iee18a1f2f2cbb23e8c8d84c54e903b32be29a693
2023-06-06Update runpath for jni libs Spandan Das
To support stem, cc libraries will be generated in <pacakge_name>/<label.name>. Update RUNPATH of java binaries so that it can find its jni deps Test: bp2build Test: TH Bug: 240563612 Change-Id: Ia2f70f0424a8526ee35856225c1a8cd1067a8570
2023-06-05Merge changes from topics "xsd_config_bp2build_cc_rdeps", ↵ Spandan Das
"xsd_config_bp2build_java_rdeps" * changes: bp2build for cc libraries that use xsd_config as gen srcs bp2build for java libraries using xsd_config srcs
2023-06-02Merge "Support test runnner option in auto generated test configs" Treehugger Robot