Commit graph

5825 commits

Author SHA1 Message Date
Yike Zhang
fd7870f231 Merge "Give cc_test rule information to determine the test types" into main 2023-08-18 17:28:05 +00:00
Treehugger Robot
c21f48def3 Merge "Fix replacements of namespace module srcs in genrule" into main 2023-08-18 02:10:13 +00:00
Spandan Das
f62e80a127 Fix replacements of namespace module srcs in genrule
expandSrcsForBazel always prefixed : in OriginalModuleName. The
exceptions to this are filegroups that appear in a different soong
namespace. For these cases, we were not correctly substituting the soong
module name with the equivalent bazel label.

Test: go test ./bp2build
Change-Id: If090f3f8819835177c1f4d191b3eef6bb6e30ace
2023-08-17 22:50:07 +00:00
yike
fdca7fe03b Give cc_test rule information to determine the test types
There are three types of tests, deviceless tests, device-driven tests
and host-driven device tests. But currently we don't have information
to get the type of a test and can't generate test targets on desired
types.

Test: b test //platform_testing/tests/example/native:hello_world_test
Test: b test //packages/modules/adb:adbd_test
Bug: 296312548
Change-Id: I3f022ef769636d508e055477623a4d1a6a1d9044
2023-08-17 21:28:47 +00:00
Spandan Das
2a8f9009c2 Allowlist external/gflags in bp2build
This is a transitive dep of some tests in internal

Change-Id: Ie716309ee8430b84600876e18b7bed02736672bb
Test: TH
2023-08-16 17:51:14 +00:00
Treehugger Robot
f768e6e27e Merge "Bp2build product variables on non-arch-variant module types" into main 2023-08-15 21:51:31 +00:00
Cole Faust
ed940008ac Bp2build product variables on non-arch-variant module types
Mostly so that genrules can have their command qualified on a product
variable.

Bug: 295910468
Test: m nothing
Change-Id: I28cc18a1b3b00368f4768a1326259a656ce970ec
2023-08-15 11:59:24 -07:00
Yu Liu
3625faffc7 Merge "Denylist jemalloc5_stresstests since it is run by a special script." into main 2023-08-15 16:34:26 +00:00
Liz Kammer
d365cc4d86 Merge changes from topic "bazel_module_labels" into main
* changes:
  Set Bazel_module for (un)converted sysprop libs
  Make ShouldConvertWithBp2build avail in loadhooks
2023-08-15 14:11:25 +00:00
Spandan Das
215adb43d3 Fix possible orphaned proto_library targets
This is a fix for aosp/2693190 that handled .proto files that end up in
different bazel packages. It did it by creating proto_library targets in
the correct bazel package.

Changing the granularity causes issues if the the new proto_library in
the subpackage imports a .proto file from a parent package or a
different package. e.g.
```
tmp
├── foo.proto
└── subdir/import_foo.proto # contains an `import "foo.proto"`
└── subdir/Android.bp # package boundary
├── Android.bp # contains a cc_library with foo.proto and
# subdir/import_foo.proto
```

At ToT, the ProtoInfo we provide to CcProtoGen is correct, but the
proto_library in subdir/BUILD will not compile because it does not have
a dep on the proto_library in ./BUILD

This CL creates a workaround by adding `manual` to the proto_library
targets. This CL is based on the assumption that the buildable unit in
bp2build is cc_library_*, and not proto_library necessarily (atleast
till we do a manual/automated cleanup)

Test: Created an integration test in build/bazel
Test: go test ./bp2build
Bug: 292583584
Bug: 246997908
Change-Id: I73120be2411967cb144f37ed4417f76ecf1a6ffa
2023-08-14 19:17:39 +00:00
Treehugger Robot
95e8fe9e1e Merge "Check in BUILD files in prebuilts/rust and external/bazelbuild-rules_rust" into main 2023-08-14 15:34:06 +00:00
Liz Kammer
c86e094e13 Make ShouldConvertWithBp2build avail in loadhooks
Test: Soong go tests
Change-Id: I65af040152107ce50b1a97efcee9364f28bad08b
2023-08-14 11:03:05 -04:00
Zhi Dou
1f82aea323 Merge "Support default-permission in aconfig_declarations" into main 2023-08-14 14:12:27 +00:00
Vinh Tran
fe1ecfc989 Check in BUILD files in prebuilts/rust and
external/bazelbuild-rules_rust

Test: N/A
Change-Id: I115f77a77e23cbc9181d6f2fe7f8081f7fd89ce3
2023-08-11 14:38:18 -04:00
Juan Yescas
83a740e888 Merge "soong: Add product variable DevicePageSizeAgnostic" into main 2023-08-11 05:45:44 +00:00
Zhi Dou
3f65a416b8 Support default-permission in aconfig_declarations
Aconfig provides new argument, default-permission, for create-cache.
When buld aconfig_declarations, aconfig_declarations will read the value
from release configuration to pass this value to aconfig.

Bug: 294417368
Test: presubmit
Change-Id: Id55dab1d757e2366a62449c73e2497cc958c5e78
2023-08-10 21:54:59 +00:00
Treehugger Robot
34a1c57b05 Merge "fix protos in another dir + a module that uses it" into main 2023-08-10 20:53:56 +00:00
Treehugger Robot
1824463396 Merge "Remove pdk product variable" into main 2023-08-10 20:47:50 +00:00
Liz Kammer
7dc6bcbd58 fix protos in another dir + a module that uses it
Protos in another directory were using import prefix, which was
prepending the repository-relative path with the value, instead, we want
to strip the prefix of the directory of the module the protos were used
in such that they can be referenced at the appropriate relative path.

Reference on import_prefix:
https://bazel.build/reference/be/protocol-buffer#proto_library.import_prefix

Test: b build //packages/modules/adb:libfastdeploy_host
Change-Id: If050b0f5fc5103bd9cc5a99703bd604325aa4204
2023-08-10 14:19:39 -04:00
Yu Liu
cb91632951 Denylist jemalloc5_stresstests since it is run by a special script.
Bug: 290909930
Test: CI
Change-Id: Iaae8542186fa843b0ed3c2dc951507b0d13ebb45
2023-08-10 10:58:01 -07:00
Cole Faust
8dc9e917aa Remove pdk product variable
It has no effect.

Test: Presubmits
Change-Id: Ia15cd99ce083294a119203c416046e43d20bf87f
2023-08-10 10:20:03 -07:00
Yu Liu
b6e0a64bf1 Denylist a couple art modules that depend on unconverted modules.
Bug: None
Test: bp2build.sh
Change-Id: If2d86cbc0abf9f832cc825c2915cb3bb62fd8d08
2023-08-10 00:09:29 +00:00
Juan Yescas
0106560e34 soong: Add product variable DevicePageSizeAgnostic
The product variable DevicePageSizeAgnostic will determine
whether AOSP is kernel page size agnostic or not.

Test: source build/envsetup.sh
      lunch aosp_cf_arm64_phone_pgagnostic
      m
      cat out/soong/build.aosp_cf_arm64_phone_pgagnostic.ninja | grep __BIONIC_NO_PAGE_SIZE_MACRO
Bug: 289419664
Change-Id: I33a1a4f1967d7e78432b7b8d90357d16b2002dcc
2023-08-09 16:46:07 -07:00
Treehugger Robot
2478d70ead Merge "Update allowlist for framework" into main 2023-08-09 20:14:51 +00:00
Liz Kammer
877b846707 Update allowlist for framework
Test: bp2build.sh
Change-Id: I8801dba735a0daf3c03b30bee8365d4ec998e4c2
2023-08-09 13:11:50 -04:00
Yu Liu
4fa1bfe169 Merge "Allowlist some more cc_test modules after the runfiles support" into main 2023-08-09 16:05:39 +00:00
Spandan Das
846ce68a2f Handle enabled: false via conditions_default
In this Android.bp file
```
my_cc_defaults {
  enabled: false,
  soong_config_variables: {
    my_bool_variable: {
       conditions_default: {enabled: false},
    }
  }
}
```
The inner enabled: false is a no-op because the top-level enabled is
false. Currently, bp2build will raise an exception for this Android.bp
file.

However, it does not need to. `productVariableConfigEnableLabels` runs
only if the top-level enabled is false. If it sees enabled: false via
conditions_default, it should just ignore it since it is a no-op.

Test: go test ./bp2build
Bug: 210546943
Change-Id: I816f209eaf21de65ddfbc2893e5255be94bcaa11
2023-08-08 16:54:34 +00:00
Joanne Chung
1d7964a941 Merge "Revert "Export NewPrebuiltBuildTool"" into main 2023-08-08 03:20:00 +00:00
Spandan Das
479e39f8fb Handle nil enabled values
If enabled does not appear inside `soong_config_vars`, we can ignore it.

Bug: 210546943
Test: go test ./bp2build

Change-Id: I9e4d51c3b683f262921449634f827915ce87dc8d
2023-08-08 02:19:38 +00:00
Joanne Chung
14e0956931 Revert "Export NewPrebuiltBuildTool"
Revert submission 2696994-art-check-cfi

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_main-without-vendor&target=sdk-sdk_mac-next&lkgb=10623159&lkbb=10623764&fkbb=10623764, bug b/294917304

Reverted changes: /q/submissionid:2696994-art-check-cfi

Change-Id: Id4adc1266c3f643b8c312f390e708d148a161314
2023-08-08 02:14:40 +00:00
Spandan Das
09f6b1390c Merge changes I8ca452aa,I437fc890,If9446700 into main
* changes:
  Handle .proto files in different package for filegroups
  Handle .proto files that end up in a different package
  Allow creation of BazelTargets in a different directory
2023-08-08 00:51:52 +00:00
Spandan Das
df3ec82b62 Handle .proto files in different package for filegroups
Followup to aosp/2693190, this CL adds the support to filegroups.
<mod>__bp2build_converted is now an alias to a proto_library
target <mod>_proto. This proto_library will be created in a different
package if the .proto file exists in a different package.

Test: bp2build unit tests
Test: TH
Bug: 292583584
Change-Id: I8ca452aacf1a86dfc9e218464e38aab89afa5a29
2023-08-07 21:39:05 +00:00
Treehugger Robot
541c1cab00 Merge "Export NewPrebuiltBuildTool" into main 2023-08-07 19:27:44 +00:00
Spandan Das
c53767e434 Handle .proto files that end up in a different package
Bazel poses a strict requirement that .proto files and proto_library
must be in the same package. This CL handles this automatically by
creating the proto_library in a separate dir/package if necessary

Implementation details
- Partition the `srcs` by package. `srcs` has been computed using
  `transformSubpackagePath`, so the information about packages is
  available at this point
- Create a proto_library in each package by using
  `CommonAttributes.Dir`. Collect all these additional libraries
  and put them in `info.Proto_libraries` so that they get added as deps
  of (cc|python|...)_proto_library
- Add an import_prefix to the proto_library in subpackages relative to
  the current directory. This relies on the assumption that every src is
  beneath the current directory (Soong will complain if a path in
  Android.bp contains ../)

filegroup module type uses a separate code-path to create proto_library.
This will be handled in the next CL in stack.

Test: bp2build unit tests
Test: TH
Test: Built the failing internal module mentioned in
b/292583584#comment1

Bug: 292583584

Change-Id: I437fc89092321b26c5f0511387cde9e84084d6f9
2023-08-07 19:18:03 +00:00
Spandan Das
3131d679f2 Allow creation of BazelTargets in a different directory
The current API restricts creation of targets to the directory of the
visited soong module. This CL proposes adding a `Dir` property in
`CommonAttributes` that can be used to create a bazel target in
a specific dir. The use case for this is to dynamically create
additional targets for proto_library that are adjacent to .proto files
(Bazel poses a strict requirement about proto_library being in the
same package as the .proto file, but Soong does not)

Usage is restricted to dirs that have an existing Android.bp file. There
are some places in bp2build where we use existence of Android.bp/BUILD
on filesystem to curate a compatible fully qualified path (e.g. headers).
If we use `CommonAttributes.Dir` to arbritraily create BUILD
files, then it might render those curated labels incompatible.

Test: go test ./bp2build

Change-Id: If9446700457eddfb389be9d9bde39087f67daa60
2023-08-07 19:17:03 +00:00
David Srbecky
54bfc7aad6 Export NewPrebuiltBuildTool
Test: m check_cfi
Change-Id: Id150d8f785b9b8df5aa3f8f5e2ca9b59225df16a
2023-08-07 16:05:34 +00:00
Vinh Tran
4d293f3dd6 Merge "Revert^2 "Allowlist build files in rules_python"" into main 2023-08-04 20:01:34 +00:00
Cole Faust
fc47771bdd Merge "Make bp2build-generated selects() based on product config build settings" into main 2023-08-03 20:09:30 +00:00
Vinh Tran
f5e598130e Revert^2 "Allowlist build files in rules_python"
a851ba0627

Change-Id: I4c4de3fef792eafbe3190a11668d7410e3a3cc44
2023-08-03 19:47:30 +00:00
Cole Faust
87c0c33a65 Make bp2build-generated selects() based on product config build settings
...instead of based on constraint settings.

Bug: 269577299
Test: m nothing and ./build/bazel/ci/bp2build.sh
Change-Id: Ib9caec79c92b8fd304e46be841de5612bd1637e3
2023-08-03 10:12:09 -07:00
Cole Faust
7997b3bb1c Merge "Make the bazel sandwich ignore targets that don't exist" into main 2023-08-03 16:52:41 +00:00
Spandan Das
fac9d8e71d Merge "Special-case go modules in convertedToBazel" into main 2023-08-03 16:45:49 +00:00
Spandan Das
6485242321 Special-case go modules in convertedToBazel
This function is called in getOtherModuleLabel, and is used to mark the
otherModule as an unconvertedDep. This meant that if a soong module `A`
depends on soong_zip, it would add soong_zip as unconverted dep of `A`.
All go modules have been converted in bp2build, so this CL special
cases go_package and go_binary in this function.

Bug: 294098662
Test: printf metrics in build_conversion.go# GenerateBazelTargets, and
made sure that the string "has unconverted.*soong_zip" does not appear

Change-Id: I8d1d0876c581f9b2eb72dafcb3a28bd5577bbb4c
2023-08-02 22:11:37 +00:00
Cole Faust
16d10942c5 Make the bazel sandwich ignore targets that don't exist
So that things can be allowlisted that aren't in all branches, or
that aren't present in tests.

Then remove the example partition from the soong integration tests
so that we don't need to pull all of the tools needed to build
partitions into that test.

Bug: 265127181
Fixes: 294220392
Test: ./build/soong/tests/run_integration_tests.sh and m bazel_sandwich
Change-Id: I66fb1ad1c2eee815bfb9700595a26e74e54c6214
2023-08-02 11:45:43 -07:00
Treehugger Robot
1ee2d0979d Merge "Allowlist jinja and deps" into main 2023-08-02 07:48:39 +00:00
Spandan Das
77ce127886 Allowlist jinja and deps
jinja is a dep of some python_test_host

Test: TH
Change-Id: I0ac2141e0ae5dd11b0f0fd1bc0ef5cdcc0c335f1
2023-08-02 04:54:12 +00:00
Treehugger Robot
c5cfe50f1f Merge "Revert^2 "Initial implementation of the bazel sandwich"" into main 2023-08-02 04:11:10 +00:00
Yike Zhang
91ad7f2e91 Merge "Convert merge_annotation_zips_test to b test" into main 2023-08-02 03:52:57 +00:00
Yu Liu
9cb66d0fc1 Allowlist some more cc_test modules after the runfiles support
Bug: 285899393
Test: local
Change-Id: I5b347bb30bbf22f7d31374a1c7bfcf98270436d0
2023-08-01 20:32:30 -07:00
Yu Liu
7cd9280bc1 Merge "Remove the MixedBuildsDisabledList that is not used anywhere." into main 2023-08-02 03:25:55 +00:00