Commit Graph

1005 Commits

Author SHA1 Message Date
Spandan Das
deaba3de51 Ignore test apexes from bp2build generated tags
Soong does not enforce apex_available on the contents of test apex. To
prevent special-casing test apexes in the apex validation aspect in
Bazel, drop the test apexes from the tags altogether.

( The core problem I am trying to solve is making sure that stub
libraries in Bazel have a single apex available. apex validation happens
to be a nice side benefit)

Bug: 277651159
Test: go test ./bp2build
(cherry picked from https://android-review.googlesource.com/q/commit:39b6cc53369a6ec132b58d99514cd7a2ea499efd)
Merged-In: Ibb3cfedb5c0f2cda0464bf3758c70b67cb5885d1
Change-Id: Ibb3cfedb5c0f2cda0464bf3758c70b67cb5885d1
2023-06-06 14:09:24 +00:00
Romain Jobredeaux
f958f61007 Merge "Bp2build support for sdk_version and java_version." am: a3c029e7d5 am: f8ebe7f3e8 am: e9ab0a3cef
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2454209

Change-Id: I37aac3f2bc75d86d40dc673cb0a43c475abd41cb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-13 22:32:40 +00:00
Romain Jobredeaux
a3c029e7d5 Merge "Bp2build support for sdk_version and java_version." 2023-04-13 20:53:07 +00:00
Romain Jobredeaux
2eef2e13e9 Bp2build support for sdk_version and java_version.
This CL adds java_version and sdk_version support to bp2build
converters for
   - java library
   - java binary
   - android library
   - android binary
   - android library import

Although java import doesn't support java_version and sdk_version, the
neverlink java_library wrapper around a java_import must specify a
sdk_version when targetting a device. "none" is used by convention.

Change-Id: I22a69dea2e351858368df69ed6a703b568d613ea
Bug: 215230098
Test: Presubmits
2023-04-11 21:05:48 -04:00
Jihoon Kang
5d1c489f52 Merge "Update java_api_library in testing modules" am: 3bfba4c723 am: 7cec47c124 am: 81e8a21ee4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2523975

Change-Id: I936b1c9851140426a9cf8e2d4f3a91068c774246
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-06 01:06:50 +00:00
Jihoon Kang
3bfba4c723 Merge "Update java_api_library in testing modules" 2023-04-05 23:27:50 +00:00
Romain Jobredeaux
f2bcb862f3 Merge "Support arch variants in java's StaticLibs in bp2build" am: b2539d08ed am: 090223b966 am: d2c9df6b93
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2521437

Change-Id: If15fb36748be5ee25aa5783dc1c04437e8edc910
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-05 15:18:17 +00:00
Romain Jobredeaux
eb711b9f7c Support arch variants in java's StaticLibs in bp2build
Test: Presubmits
Bug: 276901800
Change-Id: I6058a726833ef10a5f470946e2d265b20fa547ce
2023-04-04 19:50:13 -04:00
Jihoon Kang
c0a24205a7 Update java_api_library in testing modules
The full api surface java_api_library modules are currently defined as
java_library modules instead of java_api_library modules. This change
corrects this and modifies the DepsInfo of java_api_library so that it
can be compatible in tests.

Test: go ./java
Change-Id: I540b5a930f506ce5f7663ab6e07c6df49af15cf9
2023-04-04 22:52:37 +00:00
Jihoon Kang
a9e89fa323 Merge "Add dep_api_srcs property to java_api_library module" am: 91a86d4112 am: 6f8a62b72a am: 22bd36e459
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2485976

Change-Id: I18de957424949775bfa3a6fec6534d37bb0d4f86
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-04-04 00:58:19 +00:00
Jihoon Kang
01e522cac5 Add dep_api_srcs property to java_api_library module
Users can pass the jar-file creating module via dep_api_srcs property in
java_api_library to create the jar file not by compiling the stubs
generated from metalava but by extracting and zipping the class files
from the jar file of the input module.

Test: m android-non-updatable.stubs.from-text
Bug: 273381329
Change-Id: Id1b75179111cc7ff45faaff58388db1347bb18e5
2023-04-03 17:53:40 +00:00
Treehugger Robot
f5b59e98d4 Merge "rename aidl/library.bzl to aidl/aidl_library.bzl" am: 840d49a564 am: 0110b797e8 am: 2caef94970
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2515436

Change-Id: Ibe1ef9d638b20f38753b767d24674bc97b6c337d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-31 20:10:39 +00:00
Sam Delmerico
e55bf08de2 rename aidl/library.bzl to aidl/aidl_library.bzl
Test: b test --config=android //build/bazel/...
Change-Id: I7e22ee5ffa391ddaf43a3eec17812be78f2d86ab
2023-03-31 09:48:27 -04:00
Treehugger Robot
ffddc94522 Merge "Modify Soong to utilize from-text android.jar in build" am: bc2906efef am: e518bf7c3d am: 5746993043
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2411272

Change-Id: Ibb008c511597b5746bc9c70c9368c4a3fe3322da
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-30 17:43:57 +00:00
Treehugger Robot
bc2906efef Merge "Modify Soong to utilize from-text android.jar in build" 2023-03-29 20:31:20 +00:00
Spandan Das
e81fad3c7a Merge "Compile stubs to .dex" am: 709dbd08a0 am: bfbca5848b am: 0f9f20e2b4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2503215

Change-Id: I09c3798da462c1ad09f1ce4b0de064f34130ab48
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-29 00:27:00 +00:00
Spandan Das
709dbd08a0 Merge "Compile stubs to .dex" 2023-03-28 22:56:41 +00:00
Jihoon Kang
1bff0349d4 Modify Soong to utilize from-text android.jar in build
Context
- from-text android.jar files are built using Metalava, and these can be
  utilized in `decodeSdkDep` so that any modules that depends on APIs
  can be compiled using from-text android.jars
- This change removes dependency on source java files when compiling
  stub android.jar files

Implementation
- Modify java_api_library module to create system modules using the
  generated android.jar
- Replace modules in decodeSdkDep to link against java_api_library
  modules
- Add --build-from-text-stub flag to hide the feature behind a flag

Test: m --build-from-text-stub
Bug: 271154441
Change-Id: I104df595edc65c0006820d5ae5b15f1fb167e190
2023-03-28 21:53:45 +00:00
Spandan Das
3362f1161a Merge "Update max_sdk_version from SdkSpec to ApiLevel" am: 5aade5f52d am: 8620bbd365 am: ab45f70472
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2494321

Change-Id: I8a5cdfd8bc72400954d9b5a3621ec4d832aeb421
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-28 20:11:16 +00:00
Spandan Das
5aade5f52d Merge "Update max_sdk_version from SdkSpec to ApiLevel" 2023-03-28 19:17:48 +00:00
Treehugger Robot
78da5815e2 Merge "Add apex_available aidl + aidl&lang libraries" am: 8fdb210be2 am: 67c5d36be5 am: 663faa6f80
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2507365

Change-Id: I3f3dc62bcd62e1a8901536ad4849285c00c86d50
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-25 02:18:12 +00:00
Liz Kammer
2b3f56ed22 Add apex_available aidl + aidl&lang libraries
Test: b build com.android.neuralnetworks com.android.media.swcodec
Change-Id: I008b915b22e4c8c2cf1f0aee6cfdaf17374cb3a9
2023-03-24 15:14:53 -04:00
Spandan Das
1c03772aa9 Merge "Update target_sdk_version from SdkSpec to ApiLevel" am: f5d3906505 am: 569b1d2730 am: c52b576571
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2494320

Change-Id: I26868afda4e3e7b715b754b1aad48e7f6d0b6333
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-24 02:03:47 +00:00
Spandan Das
cb368ea88a Compile stubs to .dex
Although stubs are not installable on device, we need to compile .dex to
support hiddenapi metadata generation.

Bug: 271443071
Test: Built out/soong/hiddenapi/hiddenapi-stub-flags.txt with
aosp/2487266
(There is still some delta due to missing signatures in child classes)
(Will address them in a followup CL)
Change-Id: Iac1330c449934085a479c487a1489aa1695a75ee

Change-Id: I1baa9c0f45eb8fc93f5c3177389ea5a2b7ca0a0b
2023-03-23 20:41:22 +00:00
Spandan Das
a26eda7f2c Update max_sdk_version from SdkSpec to ApiLevel
max_sdk_version signifies device version and does not need an sdkKind to
describe it fully. Update the type and cleanup existing usages. As a
side benefit, we also get better error handling since users can no
longer enter something like `public_30` as a valid max_sdk_version in bp
files

Bug: 208456999
Test: no change in ninja file (this should be a no-op)
Test: TH
Change-Id: I304b5ad802bde200137d8e225182828dfd6f7227
2023-03-23 19:38:56 +00:00
Spandan Das
ca70fc40bd Update target_sdk_version from SdkSpec to ApiLevel
target_sdk_version signifies device version and does not need an sdkKind to
describe it fully. Update the type and cleanup existing usages. As a
side benefit, we also get better error handling since users can no
longer enter something like `public_30` as a valid target_sdk_version in bp
files

Test: m nothing
Test: no change in ninja files (this should be a no-op)
Bug: 208456999

Change-Id: I3c19245e29184bd9e5660ad8981966f64dfa9424
2023-03-23 19:31:17 +00:00
Spandan Das
7ab0894ea4 Merge "Update min_sdk_version from SdkSpec to ApiLevel" am: ddfab60014 am: f1058758db am: a14f1b45cb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2503257

Change-Id: I02d90d724f78eec72e7e7d6f80c2c2d15e25e9f7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-23 18:38:52 +00:00
Spandan Das
8c9ae7ed67 Update min_sdk_version from SdkSpec to ApiLevel
This relands aosp/2457063. The original change broke T and U since those
branches still contain soong modules of type (kind+level). Those soong
modules have been cleaned up now

Test: Used go/abtd to test T and U branches with this change

Bug: 208456999
Change-Id: I0ef7933c055f88cb512a02108f1173e51156ef1c
2023-03-22 20:15:45 +00:00
Spandan Das
f4149e51ce Merge changes from topic "revert-2457063-EKFSKANQWZ" am: cd05792d06 am: d3d9c4ae59 am: 12992d3db9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2499159

Change-Id: I952f4fc41b91be9e3bd8145be9fe1d81abe2642c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-21 03:18:38 +00:00
Spandan Das
b74d1e1d91 Revert "Update min_sdk_version from SdkSpec to ApiLevel"
Revert submission 2457063

Reason for revert: Broken udc-dev

Reverted changes: /q/submissionid:2457063

Change-Id: Id6349fc1318877044af713c914a0afd437d3d2d5
2023-03-21 01:36:47 +00:00
Spandan Das
11524735b0 Merge changes Ie6ae7e26,I2fd822a2,Iddd497df,Iee5a936e,I628b443c am: ea93f64f03 am: 03ea4670b3 am: 235ed9f779
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2457063

Change-Id: I13484740359c98c077d7c11a0ee4043bdae0ef20
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-21 01:18:46 +00:00
Spandan Das
e773739787 Update min_sdk_version from SdkSpec to ApiLevel
min_sdk_version signifies device version and does not need an sdkKind to
describe it fully. Update the type and cleanup existing usages. As a
side benefit, we also get better error handling since users can no
longer enter something like `public_30` as a valid min_sdk_version in bp
files

Will do a similar cleanup for targetSdkVersion and maxSdkVersion in a
followup CL

Test: m nothing
Test: no change in ninja files (this should be a no-op)
Bug: 208456999

Change-Id: Ie6ae7e267d093c5e4787e82685daaca1021d202e
2023-03-20 16:51:32 +00:00
Alix Espino
671172b003 Merge "Create helper function for BazelTargetModuleProperties in java/android" am: 2eb2ecfec0 am: bc5cacedf5 am: 8d2b140206
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2494323

Change-Id: Ifac07263d11e8ffe155911b90428a704789a2f61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-17 19:05:54 +00:00
Romain Jobredeaux
5923a576fb Merge "Create an intermediate java library for every java_binary target" am: d3d2be2636 am: e9cee4bcf0 am: 2552659d92
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2494319

Change-Id: Ie3d807b9d160bc8a0712ccda3f788580747becf9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-17 14:24:20 +00:00
Alix
3254002a7c Create helper function for BazelTargetModuleProperties in java/android
Prevents inconsistent load locations from being added for java_library,
android_library, kt_jvm_library targets that are generated in multiple
places.

Change-Id: I66ae5af137d7dff3f6fa6660dee539cf9ab22b9e
Test: go test ./bp2build
2023-03-16 21:29:01 +00:00
Romain Jobredeaux
f5f6073ff5 Create an intermediate java library for every java_binary target
We're already doing this for kotlin libraries as java_binary does not
support kotlin sources.

Change-Id: I4967b3aca21dac8e0eaf54d48cc35d57a4c4923e
2023-03-16 21:11:30 +00:00
Alix Espino
7a8eb6a09f Merge "bp2build kotlinCFlags" am: d184706daa am: 54bfcc938f am: ea66e1bd5d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2486117

Change-Id: Iecf554834e09c97103b054c8726d63715e42395e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-14 20:02:17 +00:00
Alix
f848bf8225 bp2build kotlinCFlags
for java_library, java_binary, android_app & android_library

Change-Id: Ia8dec7e7d497eb41b2d8dcd8c44c3090d1d3b4bd
Bug: 271265771
Test: go test ./bp2build
2023-03-14 13:57:22 +00:00
Alix Espino
5ae61b6e2b Merge "Update load statements in java.go bp2build" am: 686df31852 am: fd11e9ee5b am: ebf4fd11e1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2480297

Change-Id: I77aa18166e04c11e5197298508c0cc5bc1cc23f9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-13 17:34:10 +00:00
Alix Espino
686df31852 Merge "Update load statements in java.go bp2build" 2023-03-13 15:27:15 +00:00
Alix
82acaf545f Update load statements in java.go bp2build
load statements will all now point to rules.bzl files and won't have to
be constantly updated.

Bug: 271612705
Test: CI
Change-Id: I663b9730f1b5b333682ea301ce4d9a505626faaa
2023-03-13 15:27:01 +00:00
Romain Jobredeaux
91dc849eed Merge "Call ResolveExcludes after arch-based sources computation in java.go" am: 8062140a16 am: 81771ec3d5 am: b42297540a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2478276

Change-Id: I5282958274ca012100eefb5f32e7a1e03f8db93c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-09 17:30:42 +00:00
Romain Jobredeaux
8062140a16 Merge "Call ResolveExcludes after arch-based sources computation in java.go" 2023-03-09 14:40:58 +00:00
Alix Espino
c1dd43e6e4 Merge "Created kotlinAttributes struct" am: eb33a1d474 am: f8cf202b64 am: f736aab4fc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2475004

Change-Id: I5fc5c80b09dbe2904fda3f6c09605b18adc241ec
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-08 22:25:55 +00:00
Romain Jobredeaux
3eaf747ae5 Call ResolveExcludes after arch-based sources computation in java.go
TEST: go test
Change-Id: I93a8ae5e0842dab03f73b0edb32841755d2ea435
2023-03-08 16:34:17 -05:00
Alix
75db7840ab Created kotlinAttributes struct
makes it clearer which attributes are kotlin specific
embedded within javaCommonAttributes since both
java_* and android_* use kotlin.

Change-Id: Ib7c9b912a9901cd1c3d150ab1e0a79011d8e07de
Test: go test ./bp2build
2023-03-08 17:15:10 +00:00
Alix Espino
b0b1af3b18 Merge changes from topic "ktResourceStrip" am: 09907dab55 am: 956e77d412 am: f0dcf6eec7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2470481

Change-Id: I95dc8e8f8c60dc8e0ef268b0f5a1385d46948a72
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-07 20:44:05 +00:00
Alix
33cbf2d461 resource_strip_prefix support for kotlin srcs am: 4d56abf937 am: 9ba68b0ba3 am: 6722869b6c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2470480

Change-Id: I5421779dd471cfc592b75fe418bb9fd2f0cca903
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-07 20:44:01 +00:00
Alix
5afd9fad98 code cleanup for bp2build java_binary with kt srcs
there is now support for resoure_strip_prefix in kt_jvm_library targets.

Test: built AnalyzerKt and updated go ./bp2build tests
Change-Id: I4a6fe45276d45519186b6f40a02db990511d6def
2023-03-03 23:07:51 +00:00
Alix
4d56abf937 resource_strip_prefix support for kotlin srcs
change load locations for kt_jvm_library to be the macro

Change-Id: Id50fcb1f880013fe57647a065cd6b7149d7c5d91
Test: built kotlinx_coroutines locally and compared jar file to soong
Bug: 268519061
2023-03-03 19:38:28 +00:00