Merge "Deprecate api bp2build of ndk_library and ndk_headers"

This commit is contained in:
Spandan Das
2023-05-31 16:01:07 +00:00
committed by Gerrit Code Review
6 changed files with 0 additions and 311 deletions

View File

@@ -4100,8 +4100,6 @@ func (c *Module) ConvertWithApiBp2build(ctx android.TopDownMutatorContext) {
// Aggressively generate api targets for all header modules
// This is necessary since the header module does not know if it is a dep of API surface stub library
apiLibraryHeadersBp2Build(ctx, c)
case ndkLibrary:
ndkLibraryBp2build(ctx, c)
}
}

View File

@@ -19,10 +19,8 @@ import (
"path/filepath"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
"android/soong/android"
"android/soong/bazel"
)
var (
@@ -81,7 +79,6 @@ type headerProperties struct {
type headerModule struct {
android.ModuleBase
android.BazelModuleBase
properties headerProperties
@@ -147,39 +144,6 @@ func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
}
// TODO(b/243196151): Populate `system` and `arch` metadata
type bazelCcApiHeadersAttributes struct {
Hdrs bazel.LabelListAttribute
Include_dir *string
}
func createCcApiHeadersTarget(ctx android.TopDownMutatorContext, includes []string, excludes []string, include_dir *string) {
props := bazel.BazelTargetModuleProperties{
Rule_class: "cc_api_headers",
Bzl_load_location: "//build/bazel/rules/apis:cc_api_contribution.bzl",
}
attrs := &bazelCcApiHeadersAttributes{
Hdrs: bazel.MakeLabelListAttribute(
android.BazelLabelForModuleSrcExcludes(
ctx,
includes,
excludes,
),
),
Include_dir: include_dir,
}
ctx.CreateBazelTargetModule(props, android.CommonAttributes{
Name: android.ApiContributionTargetName(ctx.ModuleName()),
}, attrs)
}
var _ android.ApiProvider = (*headerModule)(nil)
func (h *headerModule) ConvertWithApiBp2build(ctx android.TopDownMutatorContext) {
// Generate `cc_api_headers` target for Multi-tree API export
createCcApiHeadersTarget(ctx, h.properties.Srcs, h.properties.Exclude_srcs, h.properties.From)
}
// ndk_headers installs the sets of ndk headers defined in the srcs property
// to the sysroot base + "usr/include" + to directory + directory component.
// ndk_headers requires the license file to be specified. Example:
@@ -226,7 +190,6 @@ type versionedHeaderProperties struct {
// Note that this is really only built to handle bionic/libc/include.
type versionedHeaderModule struct {
android.ModuleBase
android.BazelModuleBase
properties versionedHeaderProperties
@@ -264,15 +227,6 @@ func (m *versionedHeaderModule) GenerateAndroidBuildActions(ctx android.ModuleCo
processHeadersWithVersioner(ctx, fromSrcPath, toOutputPath, srcFiles, installPaths)
}
var _ android.ApiProvider = (*versionedHeaderModule)(nil)
func (h *versionedHeaderModule) ConvertWithApiBp2build(ctx android.TopDownMutatorContext) {
// Glob all .h files under `From`
includePattern := headerGlobPattern(proptools.String(h.properties.From))
// Generate `cc_api_headers` target for Multi-tree API export
createCcApiHeadersTarget(ctx, []string{includePattern}, []string{}, h.properties.From)
}
func processHeadersWithVersioner(ctx android.ModuleContext, srcDir, outDir android.Path,
srcFiles android.Paths, installPaths []android.WritablePath) android.Path {
// The versioner depends on a dependencies directory to simplify determining include paths

View File

@@ -599,24 +599,3 @@ func apiHeaderLabels(ctx android.TopDownMutatorContext, hdrLibs []string) bazel.
}
return android.BazelLabelForModuleDepsWithFn(ctx, hdrLibs, addSuffix)
}
func ndkLibraryBp2build(ctx android.TopDownMutatorContext, m *Module) {
props := bazel.BazelTargetModuleProperties{
Rule_class: "cc_api_contribution",
Bzl_load_location: "//build/bazel/rules/apis:cc_api_contribution.bzl",
}
stubLibrary := m.compiler.(*stubDecorator)
attrs := &bazelCcApiContributionAttributes{
Library_name: stubLibrary.implementationModuleName(m.Name()),
Api_surfaces: bazel.MakeStringListAttribute(
[]string{android.PublicApi.String()}),
}
if symbolFile := stubLibrary.properties.Symbol_file; symbolFile != nil {
apiLabel := android.BazelLabelForModuleSrcSingle(ctx, proptools.String(symbolFile)).Label
attrs.Api = *bazel.MakeLabelAttribute(apiLabel)
}
apiHeaders := apiHeaderLabels(ctx, stubLibrary.properties.Export_header_libs)
attrs.Hdrs = bazel.MakeLabelListAttribute(apiHeaders)
apiContributionTargetName := android.ApiContributionTargetName(ctx.ModuleName())
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: apiContributionTargetName}, attrs)
}