Commit graph

367 commits

Author SHA1 Message Date
Liz Kammer
3a0355f99c Merge "export common bp2build testing functions" 2022-08-04 18:11:16 +00:00
Cole Faust
7071a05c93 bp2build support for .asm files
Bug: 233948256
Test: ./build/bazel/ci/bp2build.sh
Change-Id: I387c2aeb36df004f0e1838a08a4f28b38503d6ed
2022-08-03 13:34:15 -07:00
Usta Shrestha
b7e4b08e46 Merge "Cosmetic Changes plus log errors" 2022-08-02 21:33:51 +00:00
Usta Shrestha
db46a9bbb8 Cosmetic Changes plus log errors
Test: N/A
Bug: N/A
Change-Id: I39e622a93270c922bdbea27ca79632a606431a2c
2022-08-02 20:24:57 +00:00
Jingwen Chen
7810e17e54 Export default apex version from updatable_modules.go to Bazel's
apex_toolchain through soong_injection.

This is necessary to keep both Bazel and Soong in sync.

Test: presubmit
Bug: 238723069
Fixes: 238153998

Change-Id: Ibf4a8ed91d358dc7800c10e4112485a52f0606bb
2022-08-02 10:11:36 +00:00
Sam Delmerico
3177a6e1e0 export common bp2build testing functions
bp2buildTestCase
attrNameToString
runBp2BuildTestCase
makeBazelTargetNoRestrictions

The testing framework defined in the bp2build package can only be used
from within the package because many common testing functions are
private to the package. This prevents modules defined in Soong
plugins (e.g. system/tools/aidl/build) from testing bp2build conversions.

Test: go test ./bp2build
Change-Id: Ia867081327c5181d04687b13c4550e68e6a11f86
2022-08-01 14:49:31 -04:00
Alix Espino
2f384a7432 Merge "Implement bp2build for linker_config" 2022-07-29 18:19:00 +00:00
Alix
1be00d4e48 filter unknown clang cflags in bp2build
filtering out no longer useful flags in bp2build conversion

Test: cc_library_shared_conversion_test
Bug: 231995978
Change-Id: I5172f6d07a8928291bbc11bd8802678b33cc5b1f
2022-07-29 12:17:25 +00:00
Sasha Smundak
0fd93e0756 Output informational messages only when BP2BUILD_VERBOSE is set.
Test: manual
Change-Id: Ieeb00a002e07b04449d70614ce205c47c1dd7bce
2022-07-18 13:34:44 -07:00
Liz Kammer
45faf8f427 Implement bp2build for linker_config
Pair: agespino
Bug: 211666695
Test: TODO
Change-Id: I479bcd7c53b1c57563fb4277ec39ad70b16030b8
2022-07-08 16:09:40 +00:00
Treehugger Robot
281d421f41 Merge "Remove alternative stl names in bp2build" 2022-07-01 14:54:20 +00:00
Trevor Radcliffe
130d98f8b2 Merge "Add support and tests for export_*_lib_headers" 2022-06-30 17:30:16 +00:00
Trevor Radcliffe
2be7f54b45 Add support and tests for export_*_lib_headers
There are 3 different properties about exporting headers in Soong:

1. export_static_lib_headers
2. export_shared_lib_headers
3. export_header_lib_headers

The static and header cases are already supported in bp2build but
do not have tests. This CL adds support for the shared case and
adds tests for all cases.

Fixes: 236268577
Test: Unit tests
Change-Id: Idfb788271e607919d4ac6bc0e4eb4e6ff8f78e8d
2022-06-29 15:25:01 +00:00
Liz Kammer
7128d38da5 Remove alternative stl names in bp2build
Test: bp2build.sh
Change-Id: Ie2bdac79306f9a5b50331f808f00187e172e46ab
2022-06-27 17:20:17 -04:00
Colin Cross
2bce04f76f Merge "Add linux_musl arm+arm64" 2022-06-27 18:37:07 +00:00
Colin Cross
a9b2aacf07 Add linux_musl arm+arm64
Add toolchains to support cross compiling to aarch64-linux-musl and
arm-linux-musleabihf.

Bug: 236052820
Test: build arm and arm64 musl sysroots
Change-Id: I47a9322929baff2492c6e8db989ece01fcbeb133
2022-06-24 13:46:36 -07:00
Trevor Radcliffe
fb6c522420 Remove implementation_deps from cc_library headers
Don't add implementation_deps to cc_library_headers in bp2build

Fixes: 236404654
Test: unit tests, USE_MIXED_BUILDS=1 m
Change-Id: I0f6a35c10284f261b6a8b7a4831655d5fa084977
2022-06-21 22:34:11 +00:00
Yu Liu
57c1edc4d9 Merge "Support cc code coverage for mixed build" 2022-06-13 18:57:50 +00:00
Treehugger Robot
ab12f792c0 Merge "Allowlist apexer for bp2build" 2022-06-13 00:05:53 +00:00
Jingwen Chen
b732d7c765 bp2build: convert apex.logging_parent.
Test: CI
Fixes: 235559958

Change-Id: I7b578c67eedb0379603bcf2fc029d03facfbbb0f
2022-06-10 08:38:03 +00:00
Cole Faust
01243368d7 Allowlist apexer for bp2build
This also introduces a workaround for the fact that
apexer depends on aapt2, but aapt2 doesn't build
with bp2build yet. Aapt2 is removed from apexer's
requirements during bp2build.

Bug: 204244290
Test: ./build/bazel/ci/bp2build.sh
Change-Id: I837597ce035c7d5c06e1a3957166583a7a94b5c7
2022-06-09 13:28:25 -07:00
Jingwen Chen
1f0b70e7c0 Merge changes Ib9a08167,I925e98d5
* changes:
  Use prebuilt_etc for prebuilt modules in bp2build test, instead of pretending with a cc_library.
  Only override prebuilts property if the override_apex.prebuilts is explicitly specified (not nil).
2022-06-09 06:50:00 +00:00
Jingwen Chen
81c67d3904 Use prebuilt_etc for prebuilt modules in bp2build test, instead of
pretending with a cc_library.

Test: CI
Change-Id: Ib9a081670e072a0e7378289f677063a978d0a62d
2022-06-08 16:10:19 +00:00
Jingwen Chen
df165c9e85 Only override prebuilts property if the override_apex.prebuilts is
explicitly specified (not nil).

This allows the base apex's prebuilts to be surfaced to the override
apex target.

Discovered when com.google.android.adbd's prebuilts didn't contain its
init.rc module.

Bug: 222588072
Test: CI
Change-Id: I925e98d53f7d9208652c629799ab568521ba7dfe
2022-06-08 16:03:03 +00:00
Jingwen Chen
fb237088e3 Actually run gensrcs_conversion_test.
And fix expected bazel target generation -- makeBazelTarget generates a
target_compatible_with, which is not in the expected attrs, causing
tests to fail.

Test: CI
Change-Id: Iddb9b6a7edf99d1f11043b4e77fdd3f256f3d7f2
2022-06-08 14:57:04 +00:00
Yu Liu
8d82ac58b4 Support cc code coverage for mixed build
Bug: 231322627
Test: Manual tests and unit tests
Change-Id: I786042af0d612192c54c3572f63a86a47174a242
2022-06-06 12:29:25 -07:00
Treehugger Robot
335071dad2 Merge "Convert override_apex.package_name with bp2build." 2022-06-06 14:59:07 +00:00
Liz Kammer
ace70d857e Merge "Do not hardcode default/experimental c{pp}std" 2022-06-06 13:40:17 +00:00
Jingwen Chen
9b7ebca187 Convert override_apex.package_name with bp2build.
Bug: 216414792
Test: CI and new bazel/bp2build tests
Change-Id: I3974970cdd555b3912798e79e61d61786a4ff677
2022-06-06 10:08:53 +00:00
Liz Kammer
62ac8a0707 Merge "Handle restricting to device only builds" 2022-06-02 20:29:27 +00:00
Vinh Tran
b69e1aec66 Modify ConvertWithBp2build mutator to convert gensrcs to Bazel rule
Test: b build --platforms=//build/bazel/platforms:linux_x86
//art/runtime:art_operator_src

Change-Id: I942d68e17968327cc77f379edce9b73416e6c4fd
2022-06-01 16:00:28 -04:00
Liz Kammer
dfeb120324 Handle restricting to device only builds
By default, most module types are only enabled for device. Converting
this behavior and host_supported/device_supported properties allows us
to skip building incompatible targets.

Test: soong tests
Test: bp2build.sh
Change-Id: If1da523b4cc8c4cbf2bb26da063d9923b662cc32
2022-05-31 17:46:48 -04:00
Liz Kammer
a5a29de677 Do not hardcode default/experimental c{pp}std
Prevent bugs like b/232866078 by using the same values across Bazel and
Soong

Test: bp2build.sh
Change-Id: If257f9f5f8e8a70bbf3a8cf5479758c703c25c3f
2022-05-27 09:38:03 -04:00
Cole Faust
53b62098d0 Add bp2build converter for python protobuf files
Bug: 196084681
Test: b run //build/bazel/examples/python/protobuf:build_bazel_examples_python_protobuf_main --config=linux_x86_64
Change-Id: I4d806902d262351231f64686a5d24513a25d9749
2022-05-26 15:54:23 -07:00
Trevor Radcliffe
ef9c900ec3 Generate genlex rules from bp2build for cc targets
This change will cause bp2build to generate genlex targets any
time a .l or .ll file is present in the srcs for a cc target and
add those genlex targets to the srcs attribute of the original
target.

Bug: 207408632
Test: unit tests
Change-Id: I1bce82c9d3c3d458eae1cef547ffae3d6e975134
2022-05-24 14:42:51 +00:00
Wei Li
40f9873612 Convert the property "manifest" properly for override_apex.
1) When it is not set in base apex, default file name should be set explicitly in bp2build converter of apex
2) The manifest file path should be used as-is when base apex and override_apex is in the same Android.bp
3) The manifest file path should be prepended with package of base apex when base apex and override_apex is in different Android.bp

Bug: 216442475
Test: m nothing
Change-Id: Icd3523ebc31d885f67bea02aec05dbfc77671e87
2022-05-23 17:22:35 -07:00
Cole Faust
bd4c14a7f9 Merge "Add imports property to py_library rules" 2022-05-23 18:55:51 +00:00
Jingwen Chen
d9d096ec7c queryview: don't generate 'for' attributes
'for' is a reserved keyword

Test: CI
Fixes: b/233579439
Change-Id: I7b94250574465353bbd6bfb82a7ea37ce9ae17a3
2022-05-23 09:38:39 +00:00
Cole Faust
b09da7e863 Add imports property to py_library rules
This is to avoid having it hardcoded in a fork of the
py_library rule.

Most import attributes should just be set to ".", but
our previous solution always hardcoded it to ".." instead,
for ndkstubgen. ndkstubgen uses pkg_path: "ndkstubgen",
i.e., it set pkg_path to the name of the folder that
contained the Android.bp file. In this specific scenario,
imports = ".." works. Recreate that behavior here as well,
because we don't handle pkg_path properly yet.

Fixes: 233081071
Test: build/bazel/ci/bp2build.sh
Change-Id: Ib5e6a8edf428c74d4b5947f0ec53a2151001367a
2022-05-19 12:38:27 -07:00
Treehugger Robot
478db1a882 Merge "bp2build: add support for planting unresolved symlinks in the symlink forest." 2022-05-17 19:39:42 +00:00
Jingwen Chen
d4b1dc8b2a bp2build: add support for planting unresolved symlinks in the symlink forest.
In the isDir check, there's a possibility that the Stat check fails
because the path is an unresolved symlink. Verify it with Lstat (which
would succeed, since it doesn't follow links), and treat it like a file
if Lstat succeeds.

Test: new integration test
Fixes: 232370097
Change-Id: I9807ca363a5dbdc20639b489b54627bd2cc1ca60
2022-05-17 12:17:53 +00:00
Elliott Hughes
6741d0eaa9 Now gnu11 is the default, bump experimental to gnu17.
Bug: http://b/232413369
Test: treehugger
Change-Id: I8a2b1eef744c219811c32ad46688437a1ba3f21e
2022-05-12 09:53:11 -07:00
Wei Li
49611b39a9 Merge "Add bp2build converter for override_apex." 2022-05-12 07:22:52 +00:00
Wei Li
1c66fc74d2 Add bp2build converter for override_apex.
Bug: 216442475
Test: m nothing
Change-Id: I2f106d15c1d235583b8b1a8f0ac4b48162ff4fdd
2022-05-11 22:22:04 -07: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
Lukacs T. Berki
e3487c8848 Add a test for correctness of C++ compilation.
This required the following:

- Adding Platform_base_sdk_extension_version to default soong.variables
- Teaching the symlink tree creation code to understand symlinks
- Making finder.go follow symlinks when requested

Adding yet another knob is unfortunate, but I can't allow that
unconditionally because the Android code base contains a number of
symlinks giving rise to infinite directory trees because they point back
to their parent and this seemed preferable to adding complicated logic
like "follow symlink but if only its fully resolved version does not
point under the source tree".

I could be convinced about the latter, though.

Test: Presubmits.
Change-Id: I453f6b7e5334771f5832c700db00f9d24ed1d82f
2022-05-04 09:12:01 +02: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
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
126bd58e72 Handle cc_defaults' shared for cc_library_shared
Akin to testing for cc_defaults' `static`, we introduce
a `shared` sibling to
TestStaticLibrary_SystemSharedLibsStaticEmpty

Bug: 195451854
Test: TestCcLibrarySharedSystemSharedLibsSharedEmpty
Change-Id: I63cb0641d216e8c11586ecf415fa2441e31dd3e5
2022-04-25 17:24:33 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
66e6466e0f Merge changes from topic "b/215723302"
* changes:
  Use prebuilt_file for prebuilt_{etc,usr_share}
  Abstract prebuilt_etc into prebuilt_file
2022-04-21 14:37:46 +00:00
Trevor Radcliffe
2e7c82ea0b Merge "Fix tests for cc_prebuilt_library bp2build" 2022-04-20 14:16:44 +00:00