Commit graph

4953 commits

Author SHA1 Message Date
Paul Duffin
4c0765a669 Support running bp2build tests in fixtures
Previously, the fixture test infrastructure was hard coded to
initialize itself in preparation for invoking the PrepareBuildActions()
method. That meant it could not be used for testing the bp2build and
apiBp2build modes which required different initialization and called a
different method.

This change extracts that behavior into a FixtureTestRunner and adds an
implementation that allows it to test the above two modes. It then uses
that to implement the runBp2BuildTestCaseWithSetup method.

The TestPrebuiltLibraryAdditionalAttrs was the only test which broke as
it supplied an invalid path to the MockFS (it does not support using a
trailing / to represent an empty build directory). So, it was modified
to add a couple of files inside those directories instead.

Test: m nothing
Change-Id: I6798a4f761160af8d1bfed81d46de9628bda3eb9
2022-12-02 11:14:17 +00:00
Treehugger Robot
a36589c4ca Merge changes Ia4016240,Iba586155
* changes:
  Allow choosing which soong_build invocations to run in the debugger
  Show module type in a module section of the Android-TARGET.mk
2022-12-02 10:36:07 +00:00
Jingwen Chen
8ec23f846d Merge "Convert apex_available (for supported modules) to bazel tags." 2022-12-02 07:22:10 +00:00
Sasha Smundak
5c4729df93 Show module type in a module section of the Android-TARGET.mk
The first line of each section will be
```
include $(CLEAR_VARS)  # <module type>
...
```

Bug: 257037252
Test: treehugger
Change-Id: Iba586155b682fe4e1e5817d8397eda8f9d9c8789
2022-12-01 21:12:11 -08:00
Treehugger Robot
591c5ee0fb Merge "Print error code when bazel invocation fails" 2022-12-02 00:10:02 +00:00
Liz Kammer
f843436455 Merge changes Ia165e4be,I63fe74fb
* changes:
  Update sanitize to not modify user properties
  Extend sanitize_test.go
2022-12-01 22:10:18 +00:00
Sasha Smundak
0e87b186cb Print error code when bazel invocation fails
Also, fix compiler warnings about deprecated ioutil.WriteFile/ReadFile
and about redundant variables

Test: treehugger
Change-Id: Iaf8f89b0e991dae8c5da403d4a1ec3a270f1ae29
2022-12-01 13:37:48 -08:00
Kevin Dagostino
dfc72a8ca2 Merge "Use existing BUILD files for test-related tools." 2022-12-01 07:32:59 +00:00
Jingwen Chen
c4c34e1eab Convert apex_available (for supported modules) to bazel tags.
The tags will then be read by an aspect applied from apex attributes to
validate that the deps are explicitly opt-in to the appropriate apex.

The semantics of this is the same as the Soong apex_available property.

This also adds the "base_apex_name" attr to override_apex conversion so
that apex_available checks continue to work on the non-Google and non-Go
apex names.

Test: presubmits
Fixes: 218841706
Change-Id: I19b3637da9aa47573b252d74f62b601fbdc3784d
2022-12-01 06:25:25 +00:00
Christopher Parsons
e2da96f892 Merge "Revert "Revert "Add tzdata do the Bazel mixed build prod mode allowlist.""" 2022-11-30 20:02:52 +00:00
Sam Delmerico
d0b3cd0733 Merge "fallback to nonmixed builds for unsupported builds" 2022-11-30 19:40:59 +00:00
Yu Liu
734fefdf90 Merge "Support abi check in bazel." 2022-11-30 17:57:42 +00:00
Treehugger Robot
d0cd326415 Merge "Add more cases to vendor-installed module" 2022-11-30 17:19:25 +00:00
Christopher Parsons
ff4cceb7bc Revert "Revert "Add tzdata do the Bazel mixed build prod mode allowlist.""
This reverts commit f8ab0321e3.

Reason for revert: Fixed underlying bugs (aosp-riscv and llvm breakages)

Change-Id: Ib7fe8e39af5bbe40bac615c815307ad9f05e83d3
2022-11-30 15:44:15 +00:00
Sam Delmerico
5150d0d309 fallback to nonmixed builds for unsupported builds
Bug: 253664931
Change-Id: I8026d0412b8dd62f55edf776f72747209ce2e955
2022-11-30 10:36:48 -05:00
Treehugger Robot
f219c0fc87 Merge "Revert "Allowlist build files in external/python/absl-py"" 2022-11-30 07:47:26 +00:00
Kevin Dagostino
3e2da94e2d Use existing BUILD files for test-related tools.
Allowlist BUILD files of test-related tools so that they appear in the final bp2build workspace. This is required for Bazel test rules that are dependent on these projects.

Test: b build //prebuilts/runtime/... //tools/asuite/atest:atest-tradefed  //tools/asuite/atest/bazel/reporter/...
Change-Id: Ie34658706efe6ca7657c935528df8daef61bfc0c
2022-11-30 06:07:59 +00:00
Cole Faust
762c2def20 Revert "Allowlist build files in external/python/absl-py"
Revert submission 2308141-colefaust_run_b_from_out_folder

Reason for revert: Breaks CI due to more instances of the bazel shutdown issue
Reverted Changes:
I51c28e232:Allowlist build files in external/python/absl-py
I9e6530d95:Cd into the bazel workspace instead of using --pac...

Change-Id: Ice47ef2baaef9976546f9562dc7dd9b19b383d59
2022-11-30 05:16:30 +00:00
Krzysztof Kosiński
b35b88ee82 Merge "Revert "Add tzdata do the Bazel mixed build prod mode allowlist."" 2022-11-30 00:19:17 +00:00
Krzysztof Kosiński
f8ab0321e3 Revert "Add tzdata do the Bazel mixed build prod mode allowlist."
This reverts commit ff387e55fc.

Reason for revert: breaks aosp-riscv target
https://android-build.googleplex.com/builds/submitted/9347261/aosp_riscv64-userdebug/latest/view/logs/build_error.log

Change-Id: I789d0af91ab18185fbbe68616c6e10f59be4169c
2022-11-29 23:16:13 +00:00
Treehugger Robot
00652e7570 Merge "Disable bazel for riscv_64" 2022-11-29 22:58:59 +00:00
Chris Parsons
428c30f89a Disable bazel for riscv_64
This product is experimental and unsupported for Bazel at this time

Test: lunch aosp_riscv64-userdebug && m nothing
Test: lunch aosp_arm64-userdebug && m nothing
Change-Id: I761afb9524f1008f9d5472d2de19bb84342e9e29
2022-11-29 15:35:56 -05:00
Cole Faust
5d4f066ec9 Merge "Allowlist build files in external/python/absl-py" 2022-11-29 20:03:20 +00:00
Yu Liu
56ccb1aecd Support abi check in bazel.
Bug: 253498204
Test: Manual and unit test.
Change-Id: Id23c4f772f67c4ba05704eaad77322133474b42b
2022-11-29 11:25:10 -08:00
Igor Foox
6463871fd9 Merge "Add tzdata do the Bazel mixed build prod mode allowlist." 2022-11-29 18:09:23 +00:00
Kiyoung Kim
f160f7ffa8 Add more cases to vendor-installed module
Current InstallInVendor only checks vendor property, but there are more
properties to check if the module will be installed in the vendor. This
change adds two more cases (soc_specific and proprietary) to the
function.

Bug: 233294155
Test: N/A
Change-Id: Ic3cb4c52f5097cdcc6231c0e85a62ce3ad6094b3
2022-11-29 10:58:08 +09:00
Treehugger Robot
efc1bc7f2f Merge "Improve mixed builds error messages" 2022-11-28 22:06:21 +00:00
Cole Faust
93dc19d39d Allowlist build files in external/python/absl-py
Needed because we import absl-py in our bazel.workspace file.
It only worked before in b, not mixed builds, because b was
run from the real android tree instead of out/soong/workspace.

Bug: 234449134
Bug: 249685973
Test: Presubmits
Change-Id: I51c28e23260bed7ca7d4968fd823f52f0d26a0ab
2022-11-28 12:00:00 -08:00
utzcoz
4283bf300b Remove unused rules for platform-robolectric-4.4-prebuilt
platform-robolectric-4.4-prebuilt was removed by
https://android-review.googlesource.com/c/platform/prebuilts/misc/+/2298317,
and soong's special rules for platform-robolectric-4.4-prebuilt is not
needed anymore.

Test: m

Signed-off-by: utzcoz <utzcoz@gmail.com>
Change-Id: I3304aa1061d8b945b03cfe1a91f466ceb6ca1260
2022-11-28 07:53:20 +00:00
Igor Foox
ff387e55fc Add tzdata do the Bazel mixed build prod mode allowlist.
Bugs:  b/258504104
Test: Ran a local build and checked build metrics and ninja file,
presubmits.

Change-Id: Ifdefdaebc13188e036b0b9cd55fbdcdfbdc8e11f
2022-11-27 21:48:40 -05:00
Treehugger Robot
378124baf1 Merge "Allow stubs implementation to be omitted" 2022-11-24 11:12:18 +00:00
Usta (Tsering) Shrestha
3caa38827c Merge "volatile-status.txt to be translated to an order-only dep in build.ninja" 2022-11-23 15:31:16 +00:00
Cole Faust
2ced8c8a57 Prevent duplicated license_kinds
Bazel fails when there are duplicate license_kinds.

Bug: 260148018
Test: go test
Change-Id: I47a27d37d66be947e4a744cd04a3cdcc0b000de4
2022-11-22 17:43:40 -08:00
Cole Faust
97d1527dd2 Improve mixed builds error messages
When a target does not have a certain provider we need,
currently we just fail at the dictionary lookup. Change
it so that we fail with a message that tells us what
target had the issue.

Bug: 260131489
Test: Presubmits
Change-Id: I99fd018835c14eba0d4db54ba2769b2da1b278f6
2022-11-22 14:38:24 -08:00
usta
fdb3e34df7 volatile-status.txt to be translated to an order-only dep in build.ninja
Bug: b/260092986
Test: 1. `out/soong/build.ninja` has `bazel-out/volatile-status.txt` as order-only dep 2. `touch Android.bp && m --bazel-mode-staging aapt2` updates bazel-out/volatile-status.txt but aapt2 is not rebuilt

Change-Id: I1fa23437fea14e0d25b68d75010e964dff34766d
2022-11-22 17:12:30 -05:00
Liz Kammer
92c725994f Extend sanitize_test.go
Test: go test soong cc tests
Change-Id: I63fe74fb837e25f63074fb918a573f8b421562f1
2022-11-22 11:46:34 -05:00
Alan Stokes
73feba3330 Allow stubs implementation to be omitted
When defining a stubs library, allow specifying that the
implementation library does not need to be installed. This allows for
cases where the implementation is deployed in some non-standard way -
e.g. inside a Microdroid virtual machine.

Without this, we get build errors like: "TARGET module
com.android.compos requires non-existent TARGET module: libvm_payload".

Default behavior is unchanged. The change is protected by an allowlist
to limit usage to the immediate use case.

Bug: 243512108
Test: builds; soong tests pass
Test: Remove allowlist, see build failure
Change-Id: Iaae75f2e93b842f5944a7518cc95069d62c5a638
2022-11-22 16:00:02 +00:00
Treehugger Robot
dd33a493fb Merge "use CommonAttributes for Tags in protos filegroups" 2022-11-22 15:46:59 +00:00
Spandan Das
6960ac12ac Add jarjar's deps to bp2build allowlist
jarjar switched its deps from prebuilts to source (aosp/2305413). Add
the source directory to the allowlist. This should fix broken bp2build
presubmits

Test: b build //external/jarjar
Change-Id: Ic7f37ea0ac167dc3b0f605ca0e67f8740652e0b1
2022-11-22 04:58:06 +00:00
Sam Delmerico
e9b33f70ae use CommonAttributes for Tags in protos filegroups
The Tags attribute is now available in CommonAttributes, and if we use
that one, we won't get errors with conflicting definitions of the
attribute if a global Tags value is added via CommonAttributes.

Test: m bp2build
Change-Id: I422ed817b84e6808ef60fe3599fe84332bc51d8e
2022-11-21 16:25:20 -05:00
Paul Duffin
6fcb32258a Merge "Revert "Improve error reporting when depending on prebuilt implementation jar"" 2022-11-21 17:20:03 +00:00
Paul Duffin
7ed6ff8c76 Revert "Improve error reporting when depending on prebuilt implementation jar"
This reverts commit c61783b20d.

Bug: 257969510
Reason for revert: b/255275437 - breaks checkbuild target

Change-Id: I01f88053cc24dbc1a4eb5c009f15473bdff3d565
2022-11-21 10:57:30 +00:00
Usta (Tsering) Shrestha
1ad62c7073 Merge "ShouldKeepExistingBuldFileForDir look up by dir" 2022-11-19 03:55:46 +00:00
Sasha Smundak
4975c82666 Provide Bazel timing breakdown for the mixed builds
Instead of single event in the build metrics
```
| soong_build.mixed_build.bazel          | 1:17.1 |
```
it will now show:
```
| soong_build.mixed_build.bazel          | 1:17.1 |
| soong_build.mixed_build.bazel.cquery   |   51.9 |
| soong_build.mixed_build.bazel.aquery   |   23.1 |
| soong_build.mixed_build.bazel.symlinks |    2.1 |
```

Test: treehugger
Change-Id: I84a7dda6e3122860da9aaa98bfa6afe33d392dcf
2022-11-16 18:44:08 -08:00
Wei Li
c33c2e732a Merge "Fix the following issues in bazel_handler:" 2022-11-16 23:45:47 +00:00
Sam Delmerico
775f2cb3cd Merge "export neverallow include dir list to Bazel" 2022-11-16 20:52:17 +00:00
Wei Li
cbd181c8e8 Fix the following issues in bazel_handler:
1) Convert coverage path wildcard to regex values for --instrumentation_filter to Bazel.
2) Handle the error properly when aquery commmand returns error.

Bug: 258397103
Test: CIs
Change-Id: Ie7485c2c45f2eb0e1ca0dc60478aae04ab151b61
2022-11-16 08:59:23 -08:00
Alix Espino
3044987181 Merge "bp2build for java_library with .kt srcs or common_srcs" 2022-11-16 15:40:55 +00:00
Usta Shrestha
ea9996411d ShouldKeepExistingBuldFileForDir look up by dir
instead of scanning every entry in the map for prefix-match, search each ancestor of the dir

Bug: N/A
Test: bazel_test.go#TestShouldKeepExistingBuildFileForDir()
Change-Id: I7c9afa456cca5a70624ae1e9c9b96c43b0110c1e
2022-11-15 21:39:37 -05:00
Sam Delmerico
46d08b4e39 export neverallow include dir list to Bazel
Bazel needs to recreate the neverallow behavior for absolute includes,
so export the list of include dirs to soong_injection.

Bug: 250931909
Test: aosp/2302925
Change-Id: I3bd345ea4cfb3181f07e4570466f2fc8c5fe32da
2022-11-15 17:33:21 -05:00