diff options
Diffstat (limited to 'cc')
-rw-r--r-- | cc/library.go | 11 | ||||
-rw-r--r-- | cc/ndk_library.go | 7 |
2 files changed, 15 insertions, 3 deletions
diff --git a/cc/library.go b/cc/library.go index 6acd7ae56..21615121d 100644 --- a/cc/library.go +++ b/cc/library.go @@ -500,6 +500,10 @@ func createStubsBazelTargetIfNeeded(ctx android.Bp2buildMutatorContext, m *Modul Deps: baseAttributes.deps, Api_surface: proptools.StringPtr("module-libapi"), } + if _, isNdk := ctx.ModuleFromName(m.Name() + ".ndk"); isNdk { + stubSuitesAttrs.Included_in_ndk = proptools.BoolPtr(true) + } + ctx.CreateBazelTargetModule(stubSuitesProps, android.CommonAttributes{ Name: m.Name() + "_stub_libs", // TODO: b/303307456 - Remove this when data is properly supported in cc rules. @@ -3023,6 +3027,13 @@ type bazelCcStubSuiteAttributes struct { Soname *string Deps bazel.LabelListAttribute Api_surface *string + + // Unless the library is in the NDK, module-libapi stubs should *not* include the public symbols + // Soong uses a global variable to determine if the library is in the NDK + // Since Bazel does not have global analysis, create an explicit property + // This property is only relevant if `api_surface = module-libapi` + // https://cs.android.com/android/_/android/platform/build/soong/+/main:cc/library.go;l=1214-1219;drc=7123cc5370a38983ee6325b5f5f6df19f4e4f10b;bpv=1;bpt=0 + Included_in_ndk *bool } type bazelCcHeaderAbiCheckerAttributes struct { diff --git a/cc/ndk_library.go b/cc/ndk_library.go index 49365598f..df775de3e 100644 --- a/cc/ndk_library.go +++ b/cc/ndk_library.go @@ -594,9 +594,10 @@ func ndkLibraryBp2build(ctx android.Bp2buildMutatorContext, c *Module) { symbolFileLabel := android.BazelLabelForModuleSrcSingle(ctx, proptools.String(ndk.properties.Symbol_file)) attrs := &bazelCcStubSuiteAttributes{ // TODO - b/300504837 Add ndk headers - Symbol_file: proptools.StringPtr(symbolFileLabel.Label), - Soname: proptools.StringPtr(sourceLibraryName + ".so"), - Api_surface: proptools.StringPtr(android.PublicApi.String()), + Symbol_file: proptools.StringPtr(symbolFileLabel.Label), + Soname: proptools.StringPtr(sourceLibraryName + ".so"), + Api_surface: proptools.StringPtr(android.PublicApi.String()), + Included_in_ndk: proptools.BoolPtr(true), } if sourceLibrary, exists := ctx.ModuleFromName(sourceLibraryName); exists { // the source library might not exist in minimal/unbuildable branches like kernel-build-tools. |