summaryrefslogtreecommitdiff
path: root/java/java.go
AgeCommit message (Collapse)Author
2022-10-28Bp2build Java libs for java_binary -> java_import edge Alix
Since Bazel's java_import requires a jars attribute to be specified, the generated neverlink-duplicated module is of type java_library Change-Id: I14a866dfc583507a9462add50d95060cbfe540c5 Bug: 244210934 Test: m bp2build, go test ./bp2build, manual inspection of generated Build and jar files
2022-10-05Merge "Specify jnilib partition in Android-<target>.mk" Jihoon Kang
2022-10-04Specify jnilib partition in Android-<target>.mk Jihoon Kang
Context - Android-<target>.mk currently does not contain information about partition for its dependent unembedded jni libraries, but only lists the name of the unembedded jni libraries. - If an android_app module depends on an unembedded jni library that is located in a different partition, make cannot find the library. Implementation - Create a string field partition in jniLib struct. - Add variable "LOCAL_SOONG_JNI_LIBS_PARTITION_<target>", an array of mappings of the name of the jni library to its partition. Bug: 154162945 Test: m Change-Id: I6b8e1272ff59dc70e3dd6ce8c6c8e4686dad76df
2022-09-30Change deptag for sdk deps to help distinguish Liz Kammer
Test: m nothing before and after and diff build.ninja files Change-Id: Idc4c7f86d3e626bd1ee2f90ae3c6fb755644a605
2022-09-09add jacocoagent by default to Java modules Sam Delmerico
On coverage builds, R8 will fail to properly optimize and fail the build if ignore_warnings: false, because jacoco injects dependencies on jacocoagent classes, but the jacocoagent library is not part of the classpath libraries passed in to R8 in its arguments. Instead we can add jacocoagent as a libs dependency for these modules so that it will get pulled into the r8 flags. Bug: 243903417 Test: m Change-Id: Icc24cc260b896fc800125a0318308d823ccf7a83
2022-08-25convert .aidl srcs for java_library Sam Delmerico
Test: go test ./bp2build Test: b build //frameworks/base/services/tests/servicestests/aidl:servicestests-aidl Test: enable //packages/modules/NetworkStack/common/networkstackclient && disable restriction on Android SDK in javaLibraryBp2Build && b build //packages/modules/NetworkStack/common/networkstackclient:ipmemorystore-aidl-interfaces-V10-java Change-Id: Ifb817daf09a3983ea1c84948ed9f02a79f95784b
2022-08-19Add hidden API properties to java_sdk_library modules Paul Duffin
Previously, hidden API properties were only allowed on bootclasspath_fragment and platform_bootclasspath module types. This change allows them to be specified on java_sdk_library modules too. It involves the following changes: 1. Add the properties to the java.Module. 2. Populate and provide a HiddenAPIPropertyInfo struct from java_sdk_library modules. 3. Modify bootclasspath_fragment to merge information gathered from its content libraries as if it was specified on the fragment itself. Bug: 240406019 Test: m nothing packages/modules/common/build/mainline_modules_sdks.sh # Ran the previous command with and without this change to make # sure that this change does not change the sdk snapshot # contents. Change-Id: I64eb71c2039ddc14cf380689d0cec7ec221f5b88
2022-08-17Merge "Move common test_options properties into the android package" Zhenhuang Wang
2022-08-17Move common test_options properties into the android package Zhenhuang Wang
Multiple modules (e.g. java, cc, python, rust) define the `test_options` field. Extract the common properties in test_options to share across different test rules. Bug: 240928948 Test: `refreshmod` and diff with original module-info.json Change-Id: I404a7a157b4ccaa53d800ee2217559ff695bd825
2022-08-11Add lint test property Cole Faust
Some libraries are only used for tests, but are not test module types. These modules get warnings about @VisibleForTesting usages when they really shouldn't. Expose a test flag that module authors can use to make lint treat a module as test code. Bug: 235339747 Test: Manually tested applying it to SystemUI-tests Change-Id: I1356749a669dc80a7725605d7159da27c9a211b4
2022-08-08Bp2Build converter for android_library_import and android_library. Romain Jobredeaux
Minor refactor of android_app converted to account for common attributes between library and app. Test: go test Test: ../bazel/ci/bp2build.sh Change-Id: I60b06eef6d2b9bc2d91f8b83522747ebbe76bbb6 Bug: 215230093 Bug: 215230095
2022-07-26add java_import to mixed build Sam Delmerico
Bug: 220168131 Test: go test ./java -run TestImportMixedBuild Test: USE_BAZEL_ANALYSIS=1 m CtsManagedProfileApp && verify jars are included from execroot/__main__ directory Test: build/bazel/ci/mixed_droid.sh Change-Id: I6d35a2389ea35525d532efc8474c71d2c8825646
2022-07-15Merge "Use implementation jar for updatable-media in snapshot for S" Paul Duffin
2022-07-15Use implementation jar for updatable-media in snapshot for S Paul Duffin
While enabling prebuilts in T we hit b/229932396 which was caused by some parts of the build depending on the prebuilt updatable-media jar which used to be a full implementation jar but which is now an invalid jar as the snapshot must not be including implementation details. We fixed the issue in T but we are hitting the same problem in S with the M-2022-07. That is the first train in which the prebuilt updatable-media module provides an invalid jar, prior to that it was always providing an implementation jar. This change tweaks the sdk snapshot generation code to use an implementation jar for updatable-media in the S snapshot to avoid partners having to cherry pick changes similar to those needed to fix b/229932396 in T. Bug: 239121291 Test: packages/modules/common/build/mainline_modules_sdks.sh # Check that S media snapshot includes implementation jar. # Check that S art snapshot includes invalid jar. # Check that T media snapshot includes invalid jar. Change-Id: Ib49484d00a60b4ed7f8268e04f9c10a3498edb56
2022-07-14Merge "Propagate max_sdk_version to manifest_fixer" William Loh
2022-07-07Merge "Use the current java version for -jvm-target" Cole Faust
2022-07-05Stop exporting systemserverclasspath_fragment when targeting S Paul Duffin
Previously, when targeting the S release the generated sdk snapshot would contain prebuilt_systemserverclasspath_fragment modules even though they were only added in T. This allows SdkMemberTypes to specify the set of target build releases they support and ignores them when targeting an unsupported target build release. Test: m nothing packages/modules/common/build/mainline_modules_sdks.sh # Check that the for-S-build snapshots do not include SSCPFs. Bug: 237718221 Change-Id: I2df08c2fcebf9b866695d691572a9d3783758b17
2022-06-28Use the current java version for -jvm-target Cole Faust
This is a partial revert of aosp/541879. In that cl, the kotlin jvm version was always set to 1.8 because that's what the kotlin complier supported at the time, but now it supports more versions: $ ./external/kotlinc/bin/kotlinc -jvm-target foo error: unknown JVM target version: foo Supported versions: 1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16, 17 Bug: 69160377 Bug: 236431222 Test: Treehugger Change-Id: I273e0b4d1f484013889e17c60bc1b299a3f975a1
2022-06-28Propagate max_sdk_version to manifest_fixer William Loh
If max_sdk_version is included in Android.bp that value will now be propagated to manifest_fixer.py. This value will then be used to override any maxSdkVersion attribute set on permission or uses-permission tags in the android manifest if maxSdkVersion="-1". Bug: 223902327 Test: add max_sdk_version to Android.bp for test app Test: create permission in test app manifest with maxSdkVersion="-1" Test: run test to check maxSdkVersion=max_sdk_version Change-Id: Ic533ef2a41b9ecc9ee68c69399026df47ee945b7
2022-06-22Fix normalize string for Java 17 Sorin Basca
Bug: 233029164 Test: EXPERIMENTAL_TARGET_JAVA_VERSION_17=true \ EXPERIMENTAL_USE_OPENJDK17_TOOLCHAIN=true m Change-Id: Ic436f813ae19cbdb089c63421ffde70a9cdbd83d
2022-06-06add multilib data_device_bins properties Sam Delmerico
Some targets need to be able to specify the specific architecture for a data_device_bin module. This commit adds new properties to allow specification of first, both, 32, or 64 multilib properties. Bug: 231448797 Bug: 232408185 Test: go test ./java -run TestDataDeviceBinsBuildsDeviceBinary Change-Id: I457cf4b1a9ccb28b46042f874c96bd0a87009fab
2022-05-24Add experimental option to target Java 17 Sorin Basca
Bug: 233029164 Test: EXPERIMENTAL_TARGET_JAVA_VERSION_17=true \ EXPERIMENTAL_USE_OPENJDK17_TOOLCHAIN=true m Change-Id: I80a9ba9eb356a460c1036e711e793c2ca6620f53
2022-05-23Merge "Clean up some bp2build technical debt" Treehugger Robot
2022-05-19Merge "Don't call dexpreopter methods on host modules" Colin Cross
2022-05-17Don't call dexpreopter methods on host modules Colin Cross
Only call the dexpreopter methods on device modules so broken dexpreopt configs don't break host-only unbundled builds. Bug: 207813628 Test: tradefed branch builds Change-Id: I41deb765a29c5cef9130a4d26aad7f956f75cdd5
2022-05-13Clean up some bp2build technical debt Liz Kammer
Previously we ran mutators in bp2build mode to add dependencies, now we look up modules by name directly. Remove workarounds to allow bp2build mode to not fail when adding/handling dependencies. Test: m bp2build Change-Id: Ibf6fd905150cac306e5c395902ef28f609f4df2a
2022-05-10convert java_resources with bp2build Sam Delmerico
Test: b build --platforms=//build/bazel/platforms:linux_x86 //external/jarjar:jarjar-binary and try to use on a jar Change-Id: Id6f4e6937687fd575360fbacaeda55c41922636e
2022-05-04Merge "Revert "Don't add `uses_libs`/`optional_uses_libs` to the ↵ Treehugger Robot
manifest_fixer.""
2022-05-04Revert "Don't add `uses_libs`/`optional_uses_libs` to the manifest_fixer." Ulya Trafimovich
This reverts commit 0b1c70efbcbb0c8408f44964923f5b156d025936. The reverted commit was based on the idea that uses-libraries that are explicitly specified in build files should not be implicitly added to the manifest, as that would mean that anything added to the build files will flow to the manifest. Although this logic is correct, it prevents propagation of uses-libraries from dependencies, which is wrong: if a library has an explicit uses-library property in Android.bp, this property is expected to be propagated to the library's dependencies. Failing to do so would mean that every user of that library has to add uses-library property to their build files, which doesn't scale (see b/214255490 for example). Bug: 214255490 Test: lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd \ && adb wait-for-device && adb root \ && adb logcat | grep -E 'ClassLoaderContext [a-z ]+ mismatch' # empty output, no errors at boot Change-Id: I6f420e76a89aa2f37be99f877711736640f2c361
2022-04-28bp2build converts java_version property to javacopts attribute Vinh Tran
This CL also converts `external/rappor` (which already set `java_version` to `1.7`) to be bazelable to testify the changes. Results from `b build //external/rappor && cat bazel-bin/external/rappor/librappor.jar-0.params`: https://paste.googleplex.com/5518725462622208. Test: go test ./bp2build/... Bug: 227618664 Change-Id: I8d370d4639f70fba51e6de6ceb7bcb5ace9ccd91
2022-04-08convert logtags in java srcs Sam Delmerico
Some java_* modules contain .logtag files in their srcs, but we should separate these out into their own targets. Test: enabled QuickSearchBox and build Change-Id: I595722ca59686d450ff522987a15ce283d3607e0
2022-04-05Merge "support errorprone javacflags" Treehugger Robot
2022-03-31convert java_import jars with arch variants Sam Delmerico
Bug: 220168131 Test: go test ./bp2build -run TestJavaImport Test: b build '...' Change-Id: Ib485e6905e7be9d199af5295b23131c226fd6e96
2022-03-31support errorprone javacflags Sam Delmerico
Soong has a separate property specifically for errorprone javacflags that we need to add to the Bazel javacopts. Test: go test ./bp2build Change-Id: I5299f45793d2b05a6a71b94dd17ceb797f407846
2022-03-30add plugins to javaLibraryAttributes Sam Delmerico
Test: go test ./bp2build Change-Id: I8e4c3f373c62c60ea5013cd8c585915a366c1f81
2022-03-30convert java_import_host with bp2build; enable jetifier Sam Delmerico
Also, add java_imports that were blocked by jetifier binary. b/221082840 was blocking the build of jetifier which these java_imports depended on. That bug is now resolved, so we can unblock these targets. Bug: 220168131 Test: b build //packages/apps/Car/libs/car-ui-lib/car-ui-androidx/... Test: build/bazel/ci/bp2build.sh Change-Id: I89a32bde30c133a44aeb7826afa11d4140433f5d
2022-03-30emulate java_library static_deps with Bazel exports Sam Delmerico
In Soong, java_library can specify static_deps which are dependencies that get aggregated into the final jar (akin to static linking). This is useful because it allows dependencies higher up in the chain to compile against the APIs exported by transitive dependencies. Bazel does not support this functionality directly, but it can be emulated via the exports attribute which makes any targets listed in the attribute public to targets further up the chain. Bug: 217236083 Bug: 219908977 Test: b build //external/error_prone:error_prone_core Test: b build //external/bouncycastle:bouncycastle-host Test: b build --platforms=//build/bazel/platforms:linux_x86 //prebuilts/sdk/tools/jetifier/jetifier-standalone:jetifier Change-Id: I2867e3f816de720a6f4bd9ff7a847d1b0c2da2d6
2022-03-18Don't pass static libs to r8 Colin Cross
r8 gets the static libs in the program jar, it shouldn't also get them as library jars. Keep a separate classpath for dexing that includes libs but not static_libs. Bug: 222468116 Test: m checkbuild Test: TestD8 Test: TestR8 Change-Id: Icca3393f496cbcadcc633f3b156761e6c145f975
2022-03-07bp2build supports arch variant srcs for java_library Sam Delmerico
Bug: 209577426 Test: build/bazel/ci/bp2build.sh Change-Id: I6799bda904d286616e580f2395601ce4f764180f
2022-03-07bp2build java_libraries depend on Android SDK Sam Delmerico
Soong adds an implicit dependency on the Android SDK for all java_libraries (and related modules). This feature becomes apparent after converting arch-variant srcs for android_apps, so we should suport this for now. Eventually, we will want to replace this forced dependency with a Bazel toolchain workaround. Test: build/bazel/ci/bp2build.sh Change-Id: Ic28e8c7690f69294b4bdcb9bb78a6f1f031fe97e
2022-02-15convert java proto libraries with bp2build Sam Delmerico
Allow java_libraries that depend on protobufs to be converted with bp2build. Bug: 215230097 Test: build/bazel/ci/bp2build.sh Change-Id: I3ce52389e7e4e82755605ee277c1e527a6aebc6b
2022-02-02Use common java library attributes for android_app bp2build converter. Romain Jobredeaux
Change-Id: I4dc7600fbe80eddc54a7fadd6418d6911af0b7f2 Test: go test ./bp2build
2022-02-02Merge changes I09902215,I4f86780c Sam Delmerico
* changes: convert java_plugin with bp2build convert java static dependencies
2022-02-01convert java static dependencies Sam Delmerico
This commit enables conversions of java_library_static and adds the static_deps Soong attribute to Bazel deps for all Java libraries. Currently, Soong handles static dependencies for Java differently, and Bp2build may need to address that later (see b/217236083). Bug: 215229742 Test: go test ./bp2build Change-Id: I4f86780c634dca0a2cfb9294084b14e139cc2375
2022-01-31Merge changes from topic "sdk_repo_license" Treehugger Robot
* changes: Generate sdk_repo notice files from license metadata Annotate more java dependencies for licensing Track transitive packaged license deps of containers
2022-01-29Basic bp2build converter for java_import. Romain Jobredeaux
This only supports the `jars` property/attribute. Test: b build external/error_prone:error_prone_core_jars Bug: 215229744 Change-Id: If0d9c8c4e9c1c560d35a501c20bef9361ef45e15
2022-01-28Annotate more java dependencies for licensing Colin Cross
Annotate more dependencies as runtime linked or toolchain. Bug: 207445310 Test: m checkbuild Change-Id: Ia5dc3321a1e476b16058eee94d6dc494fe1e933e
2022-01-27Merge "build device binary for java_test_host" Sam Delmerico
2022-01-26build device binary for java_test_host Sam Delmerico
This commit adds support for a java_host_test that requires a target binary to run. If the binary has host and target variants and is added as a dependency in the `data` attribute, then the host variant is used. Instead, we need a way to force the use of the target variant. Bug: 182919153 Test: add code from aosp/1647282/1 && atest AuthFsHostTest Change-Id: I68a6259b41a5e6809e1b82eec3122ffdf5067f56
2022-01-24Revert^2: "Setting Java 11 as the default version" Sorin Basca
Reverted Change: I2f9866deff41406aede24758f6eda5e5808c7f29 Reason for revert: Post-submission failure have been fixed. Test: presubmit Bug: 195387473 Change-Id: If5db1614ef455e2f1eae1d36cf514e13e7aab993