From 4238c65a17d7b4e29e3370d166e991f24c24d30b Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Fri, 9 Sep 2022 01:38:47 +0000 Subject: Converters for contributions to systemapi and vendorapi The module types in scope of this conversion are 1. cc_library and cc_library_shared (non-null llndk or stubs prop) 2. cc_library_headers (all) For (2), we need some postprocessing on the results of the parser bp2BuildParseBaseProps. This is necessary because arch and os specific API exports need to be flattened and added to the generateed API headers target along NoConfigAxis e.g. ``` The api equivalent of cc_library_headers ( name = "lifoo", deps = select({ "//build/bazel/platforms/arch:arm": ["arm_deps"], "//build/bazel/platforms/arch:arm64": ["arm64_deps"], }), ) should be cc_api_library_headers ( name = "lifoo", deps = ["arm_deps", "arm64_deps"], ) ``` For (1), we also need to generate 1:many header api targets so that arch-specific deps can propagate arch metadata to the top-level api_domain rule Test: go test ./bp2build Test: go test ./cc Change-Id: Ie40cba1ac8e89f290b3d926c190d5e93abd52859 --- android/module.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'android/module.go') diff --git a/android/module.go b/android/module.go index 68d9f8e75..c099e6d15 100644 --- a/android/module.go +++ b/android/module.go @@ -915,9 +915,16 @@ type commonProperties struct { type CommonAttributes struct { // Soong nameProperties -> Bazel name Name string + // Data mapped from: Required Data bazel.LabelListAttribute + // SkipData is neither a Soong nor Bazel target attribute + // If true, this will not fill the data attribute automatically + // This is useful for Soong modules that have 1:many Bazel targets + // Some of the generated Bazel targets might not have a data attribute + SkipData *bool + Tags bazel.StringListAttribute Applicable_licenses bazel.LabelListAttribute @@ -1305,7 +1312,12 @@ func (attrs *CommonAttributes) fillCommonBp2BuildModuleAttrs(ctx *topDownMutator platformEnabledAttribute.Add(&l) } - attrs.Data.Append(required) + if !proptools.Bool(attrs.SkipData) { + attrs.Data.Append(required) + } + // SkipData is not an attribute of any Bazel target + // Set this to nil so that it does not appear in the generated build file + attrs.SkipData = nil moduleEnableConstraints := bazel.LabelListAttribute{} moduleEnableConstraints.Append(platformEnabledAttribute) -- cgit v1.2.3-59-g8ed1b