Convert apex_available (for supported modules) to bazel tags.

The tags will then be read by an aspect applied from apex attributes to
validate that the deps are explicitly opt-in to the appropriate apex.

The semantics of this is the same as the Soong apex_available property.

This also adds the "base_apex_name" attr to override_apex conversion so
that apex_available checks continue to work on the non-Google and non-Go
apex names.

Test: presubmits
Fixes: 218841706
Change-Id: I19b3637da9aa47573b252d74f62b601fbdc3784d
This commit is contained in:
Jingwen Chen
2022-11-29 12:07:45 +00:00
parent cdea74d96c
commit c4c34e1eab
8 changed files with 134 additions and 34 deletions

View File

@@ -205,13 +205,13 @@ func bp2buildProto(ctx android.Bp2buildMutatorContext, m *Module, protoSrcs baze
protoAttrs.Deps.SetValue(protoInfo.Proto_libs)
name := m.Name() + suffix
tags := android.ApexAvailableTags(m)
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{
Rule_class: rule_class,
Bzl_load_location: "//build/bazel/rules/cc:cc_proto.bzl",
},
android.CommonAttributes{Name: name},
android.CommonAttributes{Name: name, Tags: tags},
&protoAttrs)
var privateHdrs bool