Commit graph

87 commits

Author SHA1 Message Date
Colin Cross
b63d7b3af7 Remove infrastructure to run bp2build
Bug: 315353489
Test: m blueprint_tests
Change-Id: Idcf6377d389b94c39e4e6ff4b8efa8a9f9e78b17
2023-12-08 13:51:07 -08:00
Colin Cross
8ff105860d Remove ConvertWithBp2build implementations
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.

Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-08 13:51:05 -08:00
Colin Cross
d788b3e6cb Merge aconfig files per-module
Passing the list of all transitive aconfig files to Make causes extra
Kati analysis runs when dependencies are changed in Android.bp files.
Since Make is going to merge them anyways, merge them per-module and
pass a single aconfig file to Make for each module.

Fixes: 313698230
Test: m out/target/product/vsoc_x86_64/system/etc/aconfig_flags.pb
Change-Id: Ifde4826bc93bc06e40338f72b4cb39eed26ca08d
2023-12-07 04:17:37 +00:00
Colin Cross
7e2e794333 Fix soong for go test ./...
Fix various issues that prevent building or running tests with the
Go tools:

Remove testing/test_spec_proto/go.mod.  There's already a go.mod at
the top level, and adding testing/test_spec_proto/go.mod breaks
compiling with the Go tools in IntelliJ or from the command line.

Fix go vet issues when trying to print []DataPath.

Fix aconfig_conversion_test.go and add it to Android.bp so it runs
in presubmit.

Test: go test ./...
Change-Id: I18af2f05631446fe507744a2951e4b02c7ab59be
2023-11-17 21:28:39 +00:00
Vinh Tran
7515994523 Add bp2build converter for rust_ffi_static
Test: go test
Change-Id: Ibf0bb2687073f8650da4ca27c1f57e68a93025d4
2023-10-19 11:22:51 -04:00
Alix
42d7ac96bc TestJavaHostGeneral Fix
This fixes "expected 2 bazel modules in "." but did not find any"
error that the test was getting.

Test: got test ./bp2build
Change-Id: I376c7c9974d301fc85894ecf2b0838c863a74a47
2023-10-11 22:39:27 +00:00
Jingwen Chen
6528999872 Revert^2 "bp2build converter for android_test_helper_app."
2395286cda

Change-Id: I698c1e62b87f3d8338d8d207d06f62ec680d71c9
2023-09-21 15:16:59 +00:00
Jingwen Chen
38b7be9d29 Merge "Revert "bp2build converter for android_test_helper_app."" into main 2023-09-21 15:14:29 +00:00
Jingwen Chen
2395286cda Revert "bp2build converter for android_test_helper_app."
Revert submission 2757525-android_test_helper_app

Reason for revert: broke builds

Reverted changes: /q/submissionid:2757525-android_test_helper_app

Change-Id: I0e5f55078221d7f2151f1bbaa55bebdf5051c03c
2023-09-21 15:12:19 +00:00
Jingwen Chen
72e22018c3 Merge "bp2build converter for android_test_helper_app." into main 2023-09-21 15:09:06 +00:00
Jingwen Chen
2848be4236 bp2build converter for android_test_helper_app.
This module converts simply to an android_binary, but with testonly = True.

Test: new unit tests
Test: new example app
Fixes: 283518652
Change-Id: If6b7661c32caa7dada6d492cce106d96236f6205
2023-09-20 14:31:17 +00:00
Liz Kammer
9a97a8f62a Implement bp2build for java_sdk_library_import
Test: go test bp2build conversion tests
Test: enable modules build from prebuilt and m nothing
Bug: 300640274
Change-Id: I8c015aec546d052bef6c42869e12db4e87d39780
2023-09-19 15:58:22 -04:00
Vinh Tran
ce40b92c84 Implement bp2build converter for fdo_profile
Ignore-AOSP-First: ag/24746588, in the same topic, is in an internal repo. This CL will be cherry-picked to AOSP afterward.
Test: go test
Bug: 277091218
Change-Id: I389d9535ea176991a1faa9beb46352b93363acd2
Merged-In: I389d9535ea176991a1faa9beb46352b93363acd2
2023-09-15 10:45:17 -04:00
usta
72c6c6c8be Bp2build-convert droiddoc_exported_dir
Bug: 283299388
Test: `m bp2build` and manual inspection
Change-Id: Ieec2094e446bb030f30103a7e1a06e35cbdcc72e
2023-09-14 12:06:54 -04:00
Cole Faust
999881376b Merge "Delete ApiBp2build soong_build mode" into main 2023-09-06 18:04:25 +00:00
Chris Parsons
73f411b72c Delete ApiBp2build soong_build mode
This feature is obsolete.

This makes a large number of codepaths "dead code" (such as
module-specific implementations of ApiBp2build functionality). These
will be deleted in a followup CL.

Bug: 284029211
Test: Presubmits
Change-Id: Ib53b99f1fe8c24380d219caf44e9bb3b96724fa0
2023-09-05 17:09:51 -07:00
Liz Kammer
267f1f71b5 Add rust bp2build tests to soong tests
Test: m nothing
Change-Id: I19a11cc2055725bfa5dfea5dd5215c18ffec3a21
2023-09-01 12:08:19 -04:00
Jason Wu
6d8d44af24 bp2build converter for sh_test followup
Test: m nothing
Bug: 283486885
Change-Id: Ib8229e75dfcd9fd251fb1a83485cf5f88bdc3afb
2023-08-22 23:07:33 -04:00
Cole Faust
f055db60d4 Create build settings for all product config variables
Bug: 269577299
Test: Presubmits
Change-Id: Id8b7d65d657fa20ad8591e58d5173445b0e4f4df
2023-07-25 11:47:20 -07:00
Spandan Das
ea2abba3a9 Partial bp2build conversion of bootstratp_go_package
This module type does not implement android.Module, and therefore we
cannot write a conventional bp2build converter for this module type.
Instead this has been special-cased inside bp2build/build_conversion.go.

Because of the above, we also do not have access to useful functions
available in the ctx object of ConvertWithBp2build. This includes
1. Finding the package (directory) of a dep. This requires getting a
   handle of the underlying module from its name (string). To solve, we
   do a pre-visit to collect this information. This did not increase the
   wall time. On my machine, `m bp2build --skip-soong-tests` takes ~14s
   before and after this CL
2. Converting srcs to labels. This requires glob and package boundary
   resolution. This CL introduces a partial implementation for this
   function. (glob patterns are not used in go tools)

For (1), I considered creating a `ModuleFromName` on
`blueprint.Context` instead of a pre-run, but this increased the time to ~27s.

Test: unit tests
Test: TH
Bug: 284483729

Change-Id: Ifeb029103d14947352556dba295591dd7038b090
2023-07-11 22:03:26 +00:00
Jihoon Kang
346a117921 Create bp2build converter for platform_compat_config module type
This change adds bp2build converter for platform_compat_config module
type and its corresponding test case.

Bug: 269202028
Test: bp2build unit tests
Change-Id: I17d560c8f0e725efe69e151685d003c3dcb11f2f
2023-06-06 19:35:36 +00:00
Spandan Das
230c312f83 Deprecate api bp2build of ndk_library and ndk_headers
To support export of NDK APIs in multi-tree, we added functionality to
generate Bazel targets of ndk related Soong module types. Since this use
case does not exist anymore, deprecate this to prevent bitrot

The removed code includes
- `ConvertWithApi2Build` implementation of these libraries, which
  generates the Bazel targets in the synthetic `api_bp2build` workspace
- (api) bp2build unit tests for these module types

Test: go build ./cc
Bug: 284029211
Change-Id: Id3278fa119e0ab87f31f39a3783197a81b655e43
2023-05-31 03:44:51 +00:00
Vinh Tran
3d16990b29 Implement bp2build converter for aidl_library
Test: go test
Bug: 278704136
Change-Id: Ia9c3772257af58e1de9041ba465130740b555fe4
2023-05-11 11:39:43 -04:00
Cole Faust
d82f036b89 bp2build support for python_test(_host)
There was a request for using b with python tests. bp2build python
tests exactly the same way as python binaries so that they can be
used with `b`.

Bug: None
Test: go test
Change-Id: Id68a6a73572745a4885b3e5bb1b8452e36baa982
2023-04-13 16:10:59 -07:00
Romain Jobredeaux
e7370eabe4 Bp2build converter for java_host_for_device.
Change-Id: I70a345c641bbed3223dc6222062fb6948f7dc6cb
Bug: 276710283
Test: Presubmit
2023-04-04 19:49:17 -04:00
Cole Faust
b85d1a15cc Bp2build support for multiple product configs
Create a
build/bazel/product_config/generated/products/<product_name>/BUILD
file that contains the platform definitions needed for
a particular product. Currently we just create it for the
current lunch target, but the idea is that eventually when
all product config is in starlark, all the products will
have their platform definitions in the tree at once.

Bug: 249685973
Test: Presubmits
Change-Id: I08c82ff28dcf62f09d3b1d2e3186a6b961e12f6e
2023-01-05 12:49:14 -08:00
Spandan Das
87c149dccb Merge "Create (API) bp2build converters for droidstubs" 2022-12-29 17:58:45 +00:00
Spandan Das
0b555e323b Create (API) bp2build converters for droidstubs
- The converter runs for api_bp2build, not bp2build workspace
- Since droidstubs is an internal module created by java_sdk_library,
  the conversion encompasses the latter as well
- Since droidstubs do not have an api_surface attribute, this conversion
  uses naming convention to infer the api_surface represented by the api
  file e.g. *stubs.source -> publicapi, *stubs.source.system -> systemapi)
- Also adds an SdkIntraCore enum to represent the API surface provided
  by one core module to another

There is also ongoing work to check in java_api_contribution modules in
Soong. Once we have that, we can update this converter to operate on
that module type instead

Test: go test ./bp2build
Change-Id: Ia85828e04c738d9ffcc524856d7c3034ee29bbf9
2022-12-28 23:58:52 +00:00
Colin Cross
c5075e917e Add bp2build support for cc_prebuilt_object
Add bp2build support for cc_prebuilt_object to allow buiiding
musl crt objects that use prebuilt clang_rt.crtbegin and
clang_rt.crtend.

Bug: 259266326
Test: //extenral/musl:libc_musl builds
Change-Id: Ic2b0375bc6e7336d31c9e2cf51bdc2ea894185aa
2022-12-09 13:58:58 -08:00
Sasha Smundak
8bea267caf Implement bp2build for the package module
* We are interested mostly in the conversion the `default_applicable_licenses`
  attribute, as `default_visibility` cannot be handled until every module's
  `visibility` is handled.
* Several referenced license modules had to be manually enabled for
  conversion, and likewise a few trivial Android.bp containing only
  package and license modules.
* As Bazel allows only a single `package` rule, the package rules in a
  manually converted BUILD.bazel files were removed (in
  external/protobuf and prebuilts/clang/host/linux-x86 trees).
* The converted package rule is emitted before the `load` statements per
  Bazel documentation.

Bug: 190817312
Test: treehugger
Change-Id: If8bf6fee1580177de3bb402923615bcd48923ed2
2022-09-14 13:49:27 -07:00
Sasha Smundak
a93c62b375 Implement bp2build for the license_kind module
Bug: 190817312
Test: treehugger
Change-Id: Id5bc9c1b7c5386d26ce0ebc33f63bc2665de7d54
2022-09-14 13:49:27 -07:00
Sasha Smundak
9d2f1743d2 Implement bp2build for the license module
Also, add ExpectedRuleTarget type to simplify bp2build testing

Bug: 190817312
Test: treehugger
Change-Id: Id3a642680d3518d36360ba957919a6fc96222672
2022-09-14 13:49:18 -07:00
Spandan Das
1d243da558 Merge "bp2build for ndk_headers" 2022-09-01 17:22:50 +00:00
Jingwen Chen
537242c6f1 Convert cc_test targets with bp2build.
Starting with libutils_test, adb_test, libcutils_test, (and ~47 other host_supported tests).

Test: $ b build --config=android_x86_64 //system/core/libutils:libutils_test && adb push bazel-bin/system/core/libutils/. /data/tmp/libutils_test_files/ && adb shell /data/tmp/libutils_test_files/libutils_test
Test: presubmits with newly converted cc_test targets
Test: $ b test //system/... --config=linux_x86_64 --verbose_failures --test_output=errors --keep_going --build_tests_only

Fixes: 242038415

Change-Id: I10051aadb880c3aabeba6d7fb079523e6fb4ac43
2022-09-01 14:59:15 +00:00
Spandan Das
0773a60302 bp2build for ndk_headers
Create bp2build converters for the following module types
- ndk_headers
- versioned_ndk_headers

Details
- Partial bp2build conversion. Only `cc_api_headers` targets will be
  generted within the scope of this CL
- Glob expansion. Aligned with other bp2build converters, this impl will
  expand globs in Android.bp so that all .h files are explicitly listed
  in the generated BUILD files. As an extreme example, the size of
  out/soong/workspace/bionic/libc/BUILD will increase from ~170KB to
  ~230KB (33% increase). This makes the BUILD files less readable, and
  `cc_api_headers` section of the BUILD file should probably not be
  checked into the tree in this format

Test: b cquery //bionic/libc:libc_uapi --output=starlark
--starlark:expr="providers(target).get('//build/bazel/rules/apis:cc_api_contribution.bzl%CcApiHeaderInfo')"
Test: go test ./bp2build
Test: go test ./cc

Change-Id: I810d5380f72dc90f4cdf4aa508570f3a80d8d932
2022-08-31 19:40:22 +00:00
Sam Delmerico
105a70418f Revert "add bp2build unit tests for aidl_interface"
This reverts commit 1fa2672be9.

Reason for revert: breaks tradefed branch

Change-Id: I69bba531774031890baece1796df24d5534b93a9
2022-08-29 22:24:10 +00:00
Sam Delmerico
1fa2672be9 add bp2build unit tests for aidl_interface
Bug: 229251008
Test: go test ./bp2build -run TestAidlInterface
Change-Id: Ie7214d5578bc21e348410ca91ea42d7a3190eb3d
2022-08-25 14:47:41 -04:00
Yu Liu
5d866ed81a Move testing.go to srcs from testSrcs.
This is needed so that tests in other packages can depend on it.

Bug: 232520859
Test: Manually run m nothing to verify that all tests passed
Change-Id: Ief64e8d0e4030431b26cb5526c9f8beab94cad23
2022-08-11 13:00:00 -07:00
Romain Jobredeaux
aaf4f5ec8a Merge "Bp2Build converter for android_library_import and android_library." 2022-08-09 17:46:59 +00:00
Romain Jobredeaux
c9b2bba3cd Bp2Build converter for android_library_import and android_library.
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-08-08 11:23:02 -04:00
Sam Delmerico
c9a49dff90 update bp2build tests for cc_yasm + add to CI
This test got missed in the change to export the bp2build testing
functionality because it wasn't listed in the Android.bp file to be run
as tests in CI.

Test: go test ./bp2build
Change-Id: Ic8f16bb0d5d75084592caa4ea3018384c1c7a30c
2022-08-08 10:52:27 -04: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
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
Trevor Radcliffe
54abd2e128 Fix tests for cc_prebuilt_library bp2build
Also, add the tests to Soong

Bug: 225938765
Test: ran tests
Change-Id: Ia26e46d89b8a408eb4b09f93a7ed4f0aa2e37809
2022-04-19 14:54:00 +00:00
Sam Delmerico
24c5603815 refactor bp2build module allowlists into struct
To make testing easier, refactor existing module-global variables into a
struct that can be mocked.

Test: build/bazel/bp2build.go
Change-Id: I9d177677644ea743641a745b1839a3a8b29f902a
2022-04-14 13:31:05 +00:00
Sam Delmerico
d3a1cfa6d1 add all existing bp2build tests to CI
Test: go test ./bp2build
Change-Id: Ic3ef75573cda9ed10c74bf12860269922e197d60
2022-03-07 18:26:33 +00:00
Liz Kammer
72beb34609 Add package for printing starlark formatted data
Bug: 216168792
Test: build/bazel/ci/bp2build.sh
Change-Id: I3a06b19396f7ffe1c638042cda7e731dd840f1d6
2022-02-08 17:32:28 -05:00
Sam Delmerico
cd1b80f067 bp2build converts java_genrule and java_genrule_host
Bp2build currently supports building genrules for cc modules, but does
not support building java_genrule* modules. This commit adds this
functionality.

Bug: 213480907
Test: go test ./bp2build
Change-Id: I473196c5bcf5582ba0c8faa65b5005f81ac973a4
2022-01-21 17:50:40 +00:00
Christopher Parsons
f793ba068c Merge "Add missing test files to build/soong" 2021-12-14 21:56:26 +00:00
Chris Parsons
1de1d4ee02 Add missing test files to build/soong
Test: m nothing
Change-Id: Icd331f0c2ac09caed0d4f885dd2eb6ec2080b681
2021-12-14 15:25:51 -05:00