aboutsummaryrefslogtreecommitdiff
path: root/java/java.go
Commit message (Collapse)AuthorAgeFilesLines
...
* | Don't use java_library for java_import neverlinkLiz Kammer2023-10-171-15/+28
|/ | | | | | | | | 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
* Merge changes from topic "stub_validation" into mainJihoon Kang2023-10-161-2/+41
|\ | | | | | | | | | | * changes: Add current api check as validation for from-text stub generation Disable full_api_surface_stubs for some java_api_library modules
| * Add current api check as validation for from-text stub generationJihoon Kang2023-10-131-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Handle java_resources as depsLiz Kammer2023-10-121-2/+5
| | | | | | | | | | Test: CI && unit tests Change-Id: I51f3c7d876c3cc25cb0459d933e1a510cfb5bf13
* | Change openjdk9 specific props in bp2build/SoongLiz Kammer2023-10-121-4/+10
|/ | | | | | | | JDK17 is the default java version, adding these props conditionally openjdk9 is no longer relevant Test: CI Change-Id: I5d80fd22f474cedf389d1e295620cfc17bc327a0
* Merge "Change java_test_host to support cov variant." into mainYu Liu2023-10-111-0/+4
|\
| * Change java_test_host to support cov variant.Yu Liu2023-10-101-0/+4
| | | | | | | | | | | | 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
* | Introduce system_modules property to java_api_libraryJihoon Kang2023-10-091-8/+28
|/ | | | | | | | | | | | | | | 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
* Collect transitive source files for java modulesAnton Hansson2023-09-281-0/+3
| | | | | | | | | | 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
* Merge changes from topics "remove_api_files", "remove_naming_convention" ↵Jihoon Kang2023-09-251-40/+16
|\ | | | | | | | | | | | | | | into main * changes: Remove naming conventioned based file sorting in java_api_library Remove api_files property from java_api_library
| * Remove naming conventioned based file sorting in java_api_libraryJihoon Kang2023-09-221-23/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Remove api_files property from java_api_libraryJihoon Kang2023-09-211-23/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Pass java_library libs and static_libs to java_*_proto_libraryZi Wang2023-09-221-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Have ConvertWBp2build use Bp2buildMutatorContextChris Parsons2023-09-201-8/+8
|/ | | | | | | | | | | | | 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
* Refactor bp2build tests for allowlist v2Chris Parsons2023-09-191-1/+0
| | | | | | | | | | | | | | | | | | 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
* Merge changes I8466db71,I83180699 into mainTreehugger Robot2023-09-181-17/+60
|\ | | | | | | | | | | * changes: Sort api files by api surface in java_api_library Add java_api_contribution_import module type
| * Sort api files by api surface in java_api_libraryJihoon Kang2023-09-181-17/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Add java_api_contribution_import module typeJihoon Kang2023-09-151-0/+28
| | | | | | | | | | | | | | | | | | | | 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
* | Always drop deps from java_library with no srcsZi Wang2023-09-151-20/+10
| | | | | | | | | | | | | | | | | | This is the follow up from aosp/2750763 Test: CI and added unit test Bug: 285952385 Change-Id: I64703ee4fa742b718ffb43f2af1b6ab43ddeb606
* | Do not append deps to exports when java_library has only proto srcsZi Wang2023-09-131-3/+1
| | | | | | | | | | | | | | | | | | This is to address the comment in aosp/2748099 Test: CI Bug: 285952385 Change-Id: I0bc8c76e2bc9ee113ced8642e0ab93a95799211c
* | Merge "Utilize `-quiet` flag in java_api_library" into mainJihoon Kang2023-09-131-0/+1
|\ \
| * | Utilize `-quiet` flag in java_api_libraryJihoon Kang2023-09-131-0/+1
| |/ | | | | | | | | | | | | | | | | | | | | 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
* / Bp2build: handle the case where java_library has only proto srcsZi Wang2023-09-121-7/+25
|/ | | | | | | | | | | | | | | | 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
* Do not convert resource dirs without resourcesLiz Kammer2023-09-081-1/+1
| | | | | | | | 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
* Do not convert java libraries with core_platformLiz Kammer2023-09-081-0/+5
| | | | | Test: go bp2build tests Change-Id: I2769c0d589c304caeb24a8ecba38a4a5ee6c63e5
* Merge "Remove unnecessary options when generating stubs from signatures" ↵Treehugger Robot2023-08-311-8/+6
|\ | | | | | | into main
| * Remove unnecessary options when generating stubs from signaturesPaul Duffin2023-08-311-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add do not convert for sdk_version unsetLiz Kammer2023-08-291-0/+5
|/ | | | | | | | | | 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
* Merge "support for multiple filegroups and resource_dirs" into mainAlix Espino2023-08-281-18/+56
|\
| * support for multiple filegroups and resource_dirsAlix2023-08-251-18/+56
| | | | | | | | | | | | Test: tests in bp2build and b build //external/emma:emma Change-Id: I57e60389aec926c55d01818a6a3b1ec33e9c53b8
* | Merge "java_library support for building headers-only" into mainMark White2023-08-231-0/+1
|\ \ | |/ |/|
| * java_library support for building headers-onlyMark White2023-08-221-0/+1
| | | | | | | | | | | | | | | | | | 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
* | Merge "export_proguard_spec for libs deps" into mainTreehugger Robot2023-08-181-20/+20
|\ \ | |/ |/|
| * export_proguard_spec for libs depsSam Delmerico2023-08-181-20/+20
| | | | | | | | | | | | | | | | | | | | | | 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
* | Add `previous_api` property to `java_api_library` moduleJihoon Kang2023-08-141-0/+9
| | | | | | | | | | | | | | | | | | | | | | `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
* | Move scopeOrderedSourceFileNames as outside varJihoon Kang2023-08-111-5/+5
| | | | | | | | | | | | | | | | | | 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
* | Sort api files by api scope in java_api_libraryJihoon Kang2023-08-111-0/+24
|/ | | | | | | | | | | | 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
* Merge "Stop using single-hyphen metalava options" into mainTreehugger Robot2023-08-091-1/+0
|\
| * Stop using single-hyphen metalava optionsPaul Duffin2023-08-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `-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
* | Add unconverted reason for jarjar incompatibility.Liz Kammer2023-08-041-5/+19
|/ | | | | Test: m bp2build Change-Id: I112b84fa53f57b9df2bd1e1616012fe55b48001e
* Merge "Handle xsd config more like other partitions" into mainLiz Kammer2023-07-261-18/+13
|\
| * Handle xsd config more like other partitionsLiz Kammer2023-07-241-18/+13
| | | | | | | | | | | | | | | | | | 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
* | Merge "Move android_library resource handling to Bazel's ↵Treehugger Robot2023-07-261-1/+1
|\ \ | |/ |/| | | ResourceProcessorBusyBox" into main
| * Move android_library resource handling to Bazel's ResourceProcessorBusyBoxColin Cross2023-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "java_test macro needs srcs and deps to create .jar for ↵Zi Wang2023-07-211-1/+4
|\ \ | | | | | | | | | tradefed_test_suite" into main
| * | java_test macro needs srcs and deps to create .jar for tradefed_test_suiteZi Wang2023-07-171-1/+4
| | | | | | | | | | | | | | | | | | | | | Test: java_test_host_conversion_test.go and TH Bug: 280452825 Change-Id: Ibf0c7eed415fc58a4d228f0347ab125fdc4466e4
* | | Track transitive usage of aconfig flags and add LOCAL_ACONFIG_FILES to ↵Joe Onorato2023-07-201-2/+13
| |/ |/| | | | | | | | | | | | | Android-<product>.mk Bug: 283910439 Test: m nothing (runs soong tests) Change-Id: I59f9bef7b7c502565d531a5685c002a177e0a77c
* | Merge "make android.InList generic" into mainSam Delmerico2023-07-191-1/+1
|\ \
| * | make android.InList genericSam Delmerico2023-07-181-1/+1
| | | | | | | | | | | | Change-Id: Ic166216cb473371a5e34cd97a068ca35f5534740
* | | Merge "Fix stem to be propagated to output jar name in java_library" into mainJihoon Kang2023-07-181-0/+4
|\ \ \ | |_|/ |/| |