Commit graph

4776 commits

Author SHA1 Message Date
Paul Duffin
bf4de041de java_sdk_library_import: Copy all prebuilt properties to child modules
Previously, only the prefer property was copied from the
java_sdk_library_import module to its child modules which meant that if
the use_source_config_var property was used to control the prefer
property that the child modules would never be used. That can cause
build breakages when building against prebuilts as some parts of the
build will use prebuilt files from java_sdk_library_import and some
will use source files from the corresponding java_sdk_library.

This change copies the use_source_config_var property too.

It also adds tests to verify that dependencies on child modules of a
java_sdk_library use the prebuilt child modules of the corresponding
java_sdk_library_import. That revealed a bug with the handling of stub
sources where the prefer property was set after creating the module
which has also been fixed.

Bug: 249192297
Test: m nothing
      # Cherry pick into branch broken by previous behavior and make
      # sure that it fixes it.
Change-Id: I5719c257f8457bcb2238bc7965215512a20f1095
2022-09-28 13:58:52 +01:00
Treehugger Robot
8c45f98c3e Merge "File paths to allow "./" prefix" 2022-09-26 21:02:34 +00:00
Usta Shrestha
d558031e0c File paths to allow "./" prefix
bazel_path conversion would treat "./" as a package boundary
  which would be incorrect

Bug: b/243072036
Test: unit test build_conversion_test.go and `m libc`
Change-Id: I0fc44d2fd7a4270442c8755219a11fd585244c5c
2022-09-26 14:44:15 -04:00
Paul Duffin
bfdca96828 Add sdk:"keep" tag support
Fields tagged with `sdk:"keep"` will keep the value even if it would
normally be cleared because it was common across a number of structs.
This will allow a module type to specify the same value across all
structs populated directly from variants and have it be copied into all
common property structs without clearing it from the variant specific
structs.

Bug: 248258460
Test: m nothing
Change-Id: I147d946b11fd8766a7d875d9206e8f5034f585d6
2022-09-26 18:28:56 +01:00
Paul Duffin
02e25c85eb Rename sdk field tag "keep" to "ignore"
"ignore" is a better description of the effect that this tag has on the
optimization that is done as part of the sdk snapshot generation.
"keep" implies that something special is done with the field during the
optimization process but actually the optimization process completely
ignores the property, just as it does with unexported fields.

Bug: 248258460
Test: m nothing
Change-Id: Idfdfd87f927d641d4d301cbbde72b463c89155bf
2022-09-26 18:23:25 +01:00
Alix Espino
394a12b315 Merge "Implement bp2build for prebuilt_etc_xml" 2022-09-26 17:18:56 +00:00
Vinh Tran
32a98a5d55 Convert genDir to RULEDIR in gensrcs's cmd
Test: CI
Change-Id: I5ecc19dc73559bb518871080737b28a649edc162
2022-09-23 14:18:20 -04:00
Yu Liu
7574afb67f Merge "Allowlist libcode2_hidl@1.0/1.1/1.2" 2022-09-23 16:05:44 +00:00
Jingwen Chen
a5ecb37d64 Remove apexer.required workaround for aapt2.
Add a filter for cyclic references in required module names in bp2build.

Test: CI
Bug: 247985196
Bug: 225291837
Fixes: 234748998
Change-Id: Id1cfd0b2e5f217cdb01218ec3bbe11d5070cc9df
2022-09-23 06:41:35 +00:00
Jingwen Chen
f50817d511 Add zip2zip alias and allowlist unblocked rdeps.
Test: presubmit
Change-Id: Ia4eb3e6af5cf43dc5c1d924cbf7dcf812f4b8703
2022-09-23 02:29:02 +00:00
Jingwen Chen
4a7bf608b2 Add a soong_zip alias to prebuilts and allowlist all blocked rdeps.
This is an improvement over directly referencing the prebuilt because
bp2build can now emit BUILD files that contain a dep to
//build/soong/zip/cmd:soong_zip even though we're not converting the
soong_zip module.

It helps to make progress despite not having go rules support to
convert/build soong_zip. This unblocks many modules, like genrules and
gensrcs that use soong_zip in tools. soong_zip doesn't change often, so
it's not risky to depend on the prebuilt instead of source version.

Bug: 194644518
Bug: 248222296

Test: bp2build CI
Change-Id: Idef0c27ec0fb43a9097d750ec72fba00644c9f2a
2022-09-23 02:28:36 +00:00
Treehugger Robot
eaf5eda15b Merge "Fix package boundary in glob expansion with checked in BUILD files." 2022-09-23 01:25:36 +00:00
Jingwen Chen
0eeaeb8ef7 Fix package boundary in glob expansion with checked in BUILD files.
For directories without an Android.bp file, if they contain a merged
checked in BUILD file, it becomes a package boundary in the symlink
forest. However, the current glob expansion is only aware of Android.bp
files, but not merged BUILD files, so it generates glob expansions
incorrectly for files that cross the package boundary.

This CL fixes that by making the package boundary function aware of the
keepExistingBuildFile allowlist. See the new test cases for example.

Also stop using the same global bp2buildConfig for every test case to
allow each test to define their own bp2build allowlists.

Bug: 185358476
Test: new unit tests

Change-Id: Ifcd1283480a09a642ef4343e5bbc599583524577
2022-09-22 23:22:49 +00:00
Spandan Das
b79d1aee38 Merge changes from topic "api_export"
* changes:
  Allowlist conversion of api providing module types
  Multi-tree API bp2build converter for ndk_library
2022-09-22 20:49:16 +00:00
Alix
5918d649a4 Implement bp2build for prebuilt_etc_xml
Bug: 237039154
Test: xml_conversion_test.go & bp2build
Change-Id: I1f2c57b9532138f73041d8fc08feea3f66b2ebbc
2022-09-22 20:17:19 +00:00
Yu Liu
bf7c03ef66 Allowlist libcode2_hidl@1.0/1.1/1.2
Bug: 232544295
Test: Manual
Change-Id: Iaeae1d348a0756e63e0c16ebd0759528543c057f
2022-09-22 12:12:26 -07:00
Vinh Tran
fd446d6dba Allowlist com.android.neuralnetworks
Bug: 246958825
Bug: 232486397
Test: b build //packages/modules/NeuralNetworks/apex:com.android.neuralnetworks
Change-Id: I0f818911cc99505e95239e0aa782e3ed3b5b1da7
2022-09-22 14:45:42 +00:00
Vinh Tran
f19b658803 bp2build to convert $(genDir) to $(RULEDIR) in genrule's cmd
`statslog.cpp` with cmd `"$(location stats-log-api-gen) --cpp $(genDir)/statslog.cpp"` produces `out/.intermediates/frameworks/proto_logging/stats/stats_log_api_gen/statslog.cpp/gen/statslog.cpp`. Hence, $(genDir) is equivalent to `<package-dir>/<module-name>/gen`.

Currently, bp2buld converts `$(genDir)` to `$(GENDIR)`. In Bazel, `$(GENDIR)` is only the base of the generated code (e.g. `bazel-bin`).

```
genrule(
    name = "statslog.cpp",
    cmd = "$(location :stats-log-api-gen) --cpp $(GENDIR)/statslog.cpp",
    outs = ["statslog.cpp"],
    tools = [":stats-log-api-gen"],
)
```
produces `bazel-bin/statslog.cpp` but expects to have `bazel-bin/frameworks/proto_logging/stats/stats_log_api_gen/statslog.cpp`.

By converting to `$(RULEDIR)` which is `bazel-bin/frameworks/proto_logging/stats/stats_log_api_gen`.

There had not been any genrule module allowlisted with genDir
yet. So this should not cause any issue with modules converted before
this CL.

Bug: 247536535
Test: go tests
Test: presubmit builds and tests
Change-Id: I65c6aafadab6b180b7ef700427e041547ae7e98a
2022-09-22 08:57:14 -04:00
Spandan Das
d58630f5fc Allowlist conversion of api providing module types
The allowlisted modules will be used to gather the contributions to the
publicapi surfce

Test: TH
Change-Id: I49df3a734c7ab21f21020a8cf8ddfaf7b6fa9717
2022-09-21 19:58:18 +00:00
Spandan Das
81593891ee Create api_domain module type and its bp2build converter
This module does not have any build actions in Soong yet. It will be
converted to a Bazel target using bp2build, and API export will be run
on the generated Bazel target

Test: go test ./bp2build
Test: TH
Change-Id: I76df32bd9f23b60e746b2700af07668a2ed74844
2022-09-21 19:49:46 +00:00
Spandan Das
1278c2cb24 Multi-tree API bp2build converter for ndk_library
This is a partial bp2build conversion that only emits the
cc_api_contribution target of ndk_library. We also need to convert this
to cc_stub_suite eventually to enable building vendor/product API
domains with Bazel

Also create an enum for the three known Multi-tree API surfaces (will
likely be expanded in the future)

Test: go test ./bp2build
Test: b cquery //bionic/libc:libc.ndk.contribution --output=starlark
--starlark:expr="providers(target)"

Change-Id: Idb24871ba20aae132b61eb31ef35c917cacae9e1
2022-09-21 19:49:46 +00:00
Alix Espino
62b75f4e4a Merge "Revert^2 "deletion of clang_cflags & clang_asflags from Soong"" 2022-09-21 19:28:11 +00:00
Treehugger Robot
4669ea4d19 Merge "Allowlist deps of minadbd." 2022-09-21 15:28:38 +00:00
Vinh Tran
70e079c6ad Merge "Reallowlist libneuralnetwork's deps in bp2build" 2022-09-21 15:24:14 +00:00
Jingwen Chen
adc07fa995 Allowlist deps of minadbd.
Remaining blockers are:

* android.hardware.health@1.0_interface: blocking 15 modules
* android.hardware.health@2.0_interface: blocking 12 modules
* android.hardware.health_interface: blocking 8 modules
* android.hardware.health@2.1_interface: blocking 8 modules
* android.hardware.health@1.0: blocking 8 modules
* android.hardware.health@2.0: blocking 7 modules
* android.hardware.health@2.1: blocking 5 modules
* android.hardware.health-translate-ndk: blocking 4 modules
* libhealthshim: blocking 3 modules
* libhealthhalutils: blocking 3 modules
* librecovery_utils: blocking 2 modules
* libminadbd_services: blocking 1 modules

Test: bp2build.sh
Bug: 243025934
Change-Id: Ic39666ee2d9f573726d6ed7ef9c45ac4975baa3a
2022-09-21 13:13:48 +00:00
Paul Duffin
4930389405 Merge "Exclude unsupported libraries from sdk snapshot" 2022-09-21 12:43:47 +00:00
Vinh Tran
583a07d159 Reallowlist libneuralnetwork's deps in bp2build
Reverting a revert aosp/2221842 and disabling converted filegroups that are srcs of unconverted gensrcs because of b/247782695.

Bug: 232486397
Test: CI
Change-Id: Ifc5ee7ed6f96ef8081a779e374ad7ac5ecbb947a
2022-09-20 21:31:49 +00:00
Treehugger Robot
e53c7ea256 Merge "Revert "Allowlist libneuralnetworks's dependencies"" 2022-09-19 23:24:11 +00:00
Vinh Tran
414946c466 Revert "Allowlist libneuralnetworks's dependencies"
Revert submission 2216878-libneuralnetworks

Reason for revert: failing mixed_droid.sh
Reverted Changes:
I77c8d4736:Allowlist libneuralnetworks's dependencies
I5f98038ec:Remove conversion of backend.rust to Bazel

Change-Id: Ib7147b4afdbdd69d635eb1bb8ed2e725396fdae7
2022-09-19 20:20:52 +00:00
Liz Kammer
bda5850a71 Merge changes from topic "libbuildversion-directly"
* changes:
  Allowlist aapt2 deps.
  Add libbuildversion in converion instead of macro
2022-09-19 18:33:49 +00:00
Vinh Tran
59c33ac85a Merge "Allowlist libneuralnetworks's dependencies" 2022-09-19 17:59:21 +00:00
Liz Kammer
09d831ec86 Allowlist aapt2 deps.
Test: bp2build.sh
Change-Id: Ie54a4f3b9e362ce1c5b6ee884318d970b0b10f1c
2022-09-19 11:57:12 -04:00
Vinh Tran
c3fd556fd7 Allowlist libneuralnetworks's dependencies
Except for statslog_neuralnetworks.cpp and statslog_neuralnetworks.h which are blocked by b/247536535.

Bug: 232486397
Test: CI
Change-Id: I77c8d47364fe33d0869d23f1c1c9eacd73ef7cc6
2022-09-19 11:21:39 -04:00
Jingwen Chen
a37ef6833b Merge "bp2build: Convert cc_test.test_options.tags to cc_test.tags" 2022-09-19 08:28:33 +00:00
Sasha Smundak
31327e9a2d Convert packages/apps/SafetyRegulatoryInfo
Bug: 241593926
Test: treehugger,  m --bazel-mode-dev com.android.adbd
Change-Id: I4517bc7814e54d6697b6ff7b0cd9c8b7085d71d9
2022-09-18 17:10:54 -07:00
Alexander Smundak
efc64e3a03 Merge changes from topic "notice"
* changes:
  Implement bp2build for the `package` module
  Implement bp2build for the `license_kind` module
  Implement bp2build for the `license` module
  Handle nameless modules during bp2build conversion.
2022-09-16 23:22:07 +00:00
Colin Cross
7a2b1a1c56 Merge "Make all Nameless modules have unique names" 2022-09-16 21:23:36 +00:00
Yu Liu
b8af17bdd6 Merge "Fix a bug where deps were missing for converted proto_library" 2022-09-16 16:26:21 +00:00
Treehugger Robot
2eade656df Merge "Remove obsolete com.android.bluetooth apex" 2022-09-16 05:28:06 +00:00
Yu Liu
2a85fb195d Fix a bug where deps were missing for converted proto_library
This is just a partial fix.

Bug: 246997908
Test: Manual build //frameworks/proto_logging/stats:libstats_proto_host_proto
Change-Id: I9e4e62bce22cb68bcd7f917c57f3d1438fcec716
2022-09-15 22:18:48 -07:00
Jingwen Chen
fbff97a84d bp2build: Convert cc_test.test_options.tags to cc_test.tags
zeek@ has been tagging unit tests that cannot run on RBE with
"no-remote". While we don't yet have RBE support with standalone `b
test` yet, we can make sure to propagate the tags now.

Bug: 236973602

Test: new unit test
Change-Id: I6d0648f184626bb01c657068804f99ffb82907a3
2022-09-16 02:32:03 +00:00
Yu Liu
609c3e074f Merge "Support proto modules with external references." 2022-09-15 16:00:32 +00:00
Treehugger Robot
f0e1a25217 Merge "Integrate gen_notice with Make for dist." 2022-09-15 14:50:12 +00:00
Yu Liu
274c5875e5 Merge "Improve error message when a module is double enabled." 2022-09-15 04:53:08 +00:00
Treehugger Robot
534b797cd7 Merge "Allowlist //frameworks/av/media/module/minijail/..." 2022-09-15 00:31:09 +00:00
Yu Liu
10853f90ef Improve error message when a module is double enabled.
Bug: None
Test: Manual
Change-Id: Ie96dd76d628e8ac3f0da06b949e9bfb9a3259dce
2022-09-14 16:15:43 -07:00
Bob Badour
4660a9824c Integrate gen_notice with Make for dist.
Most exempt module types have no output. Support exempt module types
with output by requiring they must be 0p and have no license metadata.

Disallow `licenses: []` property on gen_notice.

Test: m cts dist

Change-Id: Ic992bd6420fa6898495866eac43495002ef4b6c8
Merged-in: Ic992bd6420fa6898495866eac43495002ef4b6c8
2022-09-14 14:21:44 -07:00
William Escande
f03a3b00fe Remove obsolete com.android.bluetooth apex
Also remove the soong hack that allowed us to build during the
transition

Bug: 243054261
Test: build + TH
Merged-In: I60bac1ec687f03a38f38240969a1c38a8e5bf92c
Change-Id: I60bac1ec687f03a38f38240969a1c38a8e5bf92c
2022-09-14 21:09:50 +00: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