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:
@@ -448,11 +448,18 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
|
||||
Bzl_load_location: "//build/bazel/rules/cc:cc_library_shared.bzl",
|
||||
}
|
||||
|
||||
tags := android.ApexAvailableTags(m)
|
||||
ctx.CreateBazelTargetModuleWithRestrictions(staticProps,
|
||||
android.CommonAttributes{Name: m.Name() + "_bp2build_cc_library_static"},
|
||||
android.CommonAttributes{
|
||||
Name: m.Name() + "_bp2build_cc_library_static",
|
||||
Tags: tags,
|
||||
},
|
||||
staticTargetAttrs, staticAttrs.Enabled)
|
||||
ctx.CreateBazelTargetModuleWithRestrictions(sharedProps,
|
||||
android.CommonAttributes{Name: m.Name()},
|
||||
android.CommonAttributes{
|
||||
Name: m.Name(),
|
||||
Tags: tags,
|
||||
},
|
||||
sharedTargetAttrs, sharedAttrs.Enabled)
|
||||
|
||||
createStubsBazelTargetIfNeeded(ctx, m, compilerAttrs, exportedIncludes, baseAttributes)
|
||||
@@ -2914,7 +2921,8 @@ func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Mo
|
||||
Bzl_load_location: fmt.Sprintf("//build/bazel/rules/cc:%s.bzl", modType),
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name()}, attrs)
|
||||
tags := android.ApexAvailableTags(module)
|
||||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: module.Name(), Tags: tags}, attrs)
|
||||
}
|
||||
|
||||
// TODO(b/199902614): Can this be factored to share with the other Attributes?
|
||||
|
Reference in New Issue
Block a user