Commit graph

853 commits

Author SHA1 Message Date
Treehugger Robot
5bec8d41ea Merge "Clean up some bp2build technical debt" 2022-05-23 18:01:04 +00:00
Colin Cross
6c04c66b7e Merge "Don't call dexpreopter methods on host modules" 2022-05-19 20:46:23 +00:00
Colin Cross
61df14acce Don't call dexpreopter methods on host modules
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-17 13:15:39 -07:00
Liz Kammer
3bf97bd1c0 Clean up some bp2build technical debt
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-13 19:47:48 -04:00
Sam Delmerico
79985819fe convert java_resources with bp2build
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-10 14:32:52 +00:00
Treehugger Robot
be4c7eda08 Merge "Revert "Don't add uses_libs/optional_uses_libs to the manifest_fixer."" 2022-05-04 15:19:37 +00:00
Ulya Trafimovich
f5d91bb3b4 Revert "Don't add uses_libs/optional_uses_libs to the manifest_fixer."
This reverts commit 0b1c70efbc.

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-05-04 12:10:06 +01:00
Vinh Tran
3ac6daf47c bp2build converts java_version property to javacopts attribute
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-28 18:52:48 -04:00
Sam Delmerico
24da73c032 convert logtags in java srcs
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-08 14:43:18 +00:00
Treehugger Robot
ef03b3d8ba Merge "support errorprone javacflags" 2022-04-05 17:46:08 +00:00
Sam Delmerico
489831660c convert java_import jars with arch variants
Bug: 220168131
Test: go test ./bp2build -run TestJavaImport
Test: b build '...'
Change-Id: Ib485e6905e7be9d199af5295b23131c226fd6e96
2022-03-31 21:00:24 +00:00
Sam Delmerico
58614c0414 support errorprone javacflags
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-31 14:38:07 +00:00
Sam Delmerico
77267c7d9c add plugins to javaLibraryAttributes
Test: go test ./bp2build
Change-Id: I8e4c3f373c62c60ea5013cd8c585915a366c1f81
2022-03-30 19:19:13 +00:00
Sam Delmerico
5f83b491b4 convert java_import_host with bp2build; enable jetifier
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-30 19:19:13 +00:00
Sam Delmerico
c016143602 emulate java_library static_deps with Bazel exports
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-30 18:58:38 +00:00
Colin Cross
9bb9bfb349 Don't pass static libs to r8
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-18 20:48:27 +00:00
Sam Delmerico
e91d0303f2 bp2build supports arch variant srcs for java_library
Bug: 209577426
Test: build/bazel/ci/bp2build.sh
Change-Id: I6799bda904d286616e580f2395601ce4f764180f
2022-03-07 16:15:56 +00:00
Sam Delmerico
881d72022a bp2build java_libraries depend on Android SDK
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-03-07 15:50:42 +00:00
Sam Delmerico
c768102bce convert java proto libraries with bp2build
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-15 21:04:59 +00:00
Romain Jobredeaux
e8acade177 Use common java library attributes for android_app bp2build converter.
Change-Id: I4dc7600fbe80eddc54a7fadd6418d6911af0b7f2
Test: go test ./bp2build
2022-02-02 12:18:37 -05:00
Sam Delmerico
ca1701f518 Merge changes I09902215,I4f86780c
* changes:
  convert java_plugin with bp2build
  convert java static dependencies
2022-02-02 14:27:32 +00:00
Sam Delmerico
fde9fb5c9c convert java static dependencies
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-02-01 22:59:04 +00:00
Treehugger Robot
97cffec54e Merge changes from topic "sdk_repo_license"
* changes:
  Generate sdk_repo notice files from license metadata
  Annotate more java dependencies for licensing
  Track transitive packaged license deps of containers
2022-01-31 23:34:59 +00:00
Romain Jobredeaux
428a366703 Basic bp2build converter for java_import.
This only supports the `jars` property/attribute.

Test: b build external/error_prone:error_prone_core_jars
Bug: 215229744
Change-Id: If0d9c8c4e9c1c560d35a501c20bef9361ef45e15
2022-01-29 09:44:37 -05:00
Colin Cross
ce56425a6b Annotate more java dependencies for licensing
Annotate more dependencies as runtime linked or toolchain.

Bug: 207445310
Test: m checkbuild
Change-Id: Ia5dc3321a1e476b16058eee94d6dc494fe1e933e
2022-01-28 15:42:06 -08:00
Sam Delmerico
af20c7cad1 Merge "build device binary for java_test_host" 2022-01-27 14:30:39 +00:00
Sam Delmerico
b3342ce580 build device binary for java_test_host
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-26 19:57:27 +00:00
Sorin Basca
18ecf61090 Revert^2: "Setting Java 11 as the default version"
Reverted Change: I2f9866deff41406aede24758f6eda5e5808c7f29

Reason for revert: Post-submission failure have been fixed.

Test: presubmit
Bug: 195387473
Change-Id: If5db1614ef455e2f1eae1d36cf514e13e7aab993
2022-01-24 13:31:05 +00:00
Sorin Basca
8d3e0bb25e Revert "Setting Java 11 as the default version"
Revert submission 1944928-default-java11

Reason for revert: Post-submit failures
Reverted Changes:
Ia9a0aa2a4:Setting Java 11 as the default version
Ibf5d10521:Setting Java 11 as the default version

Fixes: 215504708
Fixes: 215502091
Fixes: 215502091
Change-Id: I2f9866deff41406aede24758f6eda5e5808c7f29
2022-01-20 15:37:11 +00:00
Sorin Basca
171c2103b8 Setting Java 11 as the default version
Test: m
Change-Id: Ia9a0aa2a4aa02d7b67ad8e1cb6083d33c3d75e70
2022-01-18 09:05:34 +00:00
Jooyung Han
01d80d8b4b Make android_app.stem overridable
override_android_app can set "stem" property to set the APK name.

Bug: 193504286
Test: m (soong test)
Change-Id: I9ad66ea28bd1b030cb2c588d1f070d72e62ab1c7
2022-01-11 13:07:44 +09:00
Sam Delmerico
4e27229b61 Convert javacflags -> javacopts for java_binary_host
This has already been done for java_library modules, we need to add
similar support for java_binary_host.

Bug: 213456294
Test: go test ./bp2build
Change-Id: Idf7b631f3afe9f59e50f9e45bcbdc29fb5923cc6
2022-01-06 21:00:46 +00:00
Sorin Basca
9347ae3ba0 Adding option to include sources only for Java 11 builds
Bug: 207852002
Test: m
Test: EXPERIMENTAL_TARGET_JAVA_VERSION_11=true m
Change-Id: I554a79798ea7f1dd4a96b09f761090f83a009cb4
2021-12-20 21:33:14 +00:00
Colin Cross
c68db4b305 Remove InstallBypassMake and ToMakePath
InstallBypassMake and ToMakePath are obsolete, remove them.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273
2021-12-15 15:22:53 -08:00
Wei Li
bafb6d6612 Add the initial implementation of bp2build converter for java_library,
java_library_host, java_binary_host and cc_library_host_shared so
signapk tool can be built with Bazel.

Test: b build //build/bazel/examples/apex/minimal:build.bazel.examples.apex.minimal
Test: jarsigner -verify -verbose build.bazel.examples.apex.minimal.apex
Bug: 209876137
Bug: 196204358
Bug: 210158864
Bug: 210159074
Bug: 210158872
Change-Id: I855884159d25e69d8f9623792c376da820a1eb4c
2021-12-14 17:23:19 -08:00
Treehugger Robot
f4c2bf6559 Merge changes from topic "revert-1918946-revert-1899703-AMWIVCREEV-CCTEXIRRRV"
* changes:
  Revert^2 "Add dependency license annotations"
  Revert^2 "Build license metadata files in Soong"
2021-12-11 03:32:18 +00:00
Colin Cross
65cb314c92 Revert^2 "Add dependency license annotations"
abe2a4b7bf

Change-Id: Ibcd16b5b779a4e6d4372dab9d21de76abae9ca9c
2021-12-10 23:05:02 +00:00
Colin Cross
67938c2925 Merge changes from topic "revert-1899703-AMWIVCREEV"
* changes:
  Revert "Build license metadata files in Soong"
  Revert "Add dependency license annotations"
2021-12-10 23:04:45 +00:00
Colin Cross
abe2a4b7bf Revert "Add dependency license annotations"
Revert submission 1899703

Reason for revert: b/210158272
Reverted Changes:
I142c19284:Reuse license metadata files from Soong
Ife89b8f23:Add dependency license annotations
I8e7410837:Build license metadata files in Soong

Change-Id: I51f33ae67311a3cff00d3e581d24c9a3411b7131
2021-12-10 23:02:41 +00:00
Colin Cross
b435744fdc Merge changes from topic "soong-license-metadata"
* changes:
  Add dependency license annotations
  Build license metadata files in Soong
  Escape Host*Variable contents
2021-12-10 21:43:49 +00:00
Sorin Basca
eb59a6d3ea Merge "Adding experimental option to target Java 11" 2021-12-10 13:57:51 +00:00
Colin Cross
b674b43656 Add dependency license annotations
Add annotations to dependency tags that are dynamic or classpath
linkage.

Bug: 207445310
Test: m checkbuild
Change-Id: Ife89b8f234aa40c380c721eda7dd18cab697fbb3
2021-12-08 15:08:59 -08:00
Sorin Basca
8ef3e6fd02 Adding experimental option to target Java 11
Bug: 195387073
Test: m
Test: EXPERIMENTAL_TARGET_JAVA_VERSION_11=true m
Change-Id: Ifd7ce6218a2761a8eaf79af7d91210da2fa581aa
2021-12-07 17:46:34 +00:00
Artur Satayev
fb0a7234d7 Merge changes Ieb9aef29,I6985ebb6
* changes:
  Propagate min and max sdk versions to classpaths.proto configs.
  Introduce max_sdk_version device property.
2021-12-02 14:53:48 +00:00
satayev
0a420e771a Introduce max_sdk_version device property.
Artifacts that go into apexes should only be active on certain SDK
versions. There is now a need to upper bound the range to support
expressiong statements like "this jar should only run on platforms
30-31".

Bug: 190818041
Test: presubmit
Change-Id: I6985ebb671841cdd9f0f37f916267ac5ed76e4f4
2021-12-01 17:51:22 +00:00
Sorin Basca
c0244da203 Adding configuration support for Java 11
Bug: 195387073
Test: m
Change-Id: Ibf26f35b83b300acacae800f9962a00916869412
2021-11-26 17:26:33 +00:00
Colin Cross
3108ce17b0 Add dependency from hostdex installed module to Make intermediates
The art tests rely on a dependency existing from
out/host/linux-x86/framework/core-oj-hostdex.jar to
out/host/common/obj/JAVA_LIBRARIES/core-oj-hostdex_intermediates/classes.jar,
override LOCAL_SOONG_INSTALLED_MODULE for the hostdex modules so that
soong_java_prebuilt.mk adds the dependency.

Test: art/tools/buildbot-build.sh --host && art/tools/run-libcore-tests.sh '--mode=host' '--variant=X64' --debug
Change-Id: I9412147fc66d5e5f0dae52d522868a37251f781e
2021-11-10 14:38:50 -08:00
Colin Cross
24cc4be60b Move java module installation into Soong
Move java module installation rules into Soong by overriding
InstallBypassMake.  Update the locations that find host java tools
to look in the Make installation directory instead of the Soong
installation directory, which will no longer be used.

Bug: 204136549
Test: m checkbuild
Change-Id: I5af6d764c97e7ddb5ee121fc9830166c25d831b1
2021-11-05 14:24:51 -07:00
Colin Cross
1d0eb7a9d0 Fix ctx.InstallFile calls for java modules
Call ctx.InstallFile on the primary install file last so that the
primary install file can depend on the extra install files, and so that
the primary install file can be inferred from the last installed file.

Add missing ctx.InstallFile calls for the dexpreopt and hostdex outputs.

Fix the install subdirectory for modules installing to the testcases
directory.

Bug: 204136549
Test: m checkbuild
Change-Id: I7edd7647be27439d3ca0ecc589ca5e89d4ba8474
2021-11-05 14:20:28 -07:00
Paul Duffin
9804da0544 Dedup use of "prebuilt_"
Bug: 177893770
Test: m nothing
Change-Id: I664ee4d9c3aafda3de0a3f8985ee23f25db38680
2021-10-26 10:43:23 +01:00