Rename API surface provided to mainline modules
This API surface is provided by platform and mainline modules to other
mainline modules. Rename it to module-lib API surface to align it with
the terminology in go/android-api-types
Test: go test ./bp2build
Test: go test ./cc
Change-Id: Ieb9f3214e66366fc2ceb6f47e2d6623acb537827
diff --git a/android/api_domain.go b/android/api_domain.go
index bdd4e6f..587ceae 100644
--- a/android/api_domain.go
+++ b/android/api_domain.go
@@ -32,17 +32,18 @@
// TODO(b/246656800): Reconcile with android.SdkKind
const (
- PublicApi ApiSurface = iota
- SystemApi
- VendorApi
+ // API surface provided by platform and mainline modules to other mainline modules
+ ModuleLibApi ApiSurface = iota
+ PublicApi // Aka NDK
+ VendorApi // Aka LLNDK
)
func (a ApiSurface) String() string {
switch a {
+ case ModuleLibApi:
+ return "module-libapi"
case PublicApi:
return "publicapi"
- case SystemApi:
- return "systemapi"
case VendorApi:
return "vendorapi"
default:
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 244ca9c..c11a50d 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -2825,7 +2825,7 @@
expectedBazelTargets := []string{
MakeBazelTarget(
"cc_api_library_headers",
- "libfoo.systemapi.headers",
+ "libfoo.module-libapi.headers",
AttrNameToString{
"export_includes": `["dir1"]`,
}),
@@ -2842,18 +2842,18 @@
"api": `"libfoo.map.txt"`,
"library_name": `"libfoo"`,
"api_surfaces": `[
- "systemapi",
+ "module-libapi",
"vendorapi",
]`,
"hdrs": `[
- ":libfoo.systemapi.headers",
+ ":libfoo.module-libapi.headers",
":libfoo.vendorapi.headers",
]`,
}),
}
RunApiBp2BuildTestCase(t, cc.RegisterLibraryBuildComponents, Bp2buildTestCase{
Blueprint: bp,
- Description: "cc API contributions to systemapi and vendorapi",
+ Description: "cc API contributions to module-libapi and vendorapi",
ExpectedBazelTargets: expectedBazelTargets,
})
}
@@ -2872,8 +2872,8 @@
stubs: {symbol_file: "a.map.txt"},
}`,
expectedApi: `"a.map.txt"`,
- expectedApiSurfaces: `["systemapi"]`,
- description: "Library that contributes to systemapi",
+ expectedApiSurfaces: `["module-libapi"]`,
+ description: "Library that contributes to module-libapi",
},
{
bp: `
@@ -2894,10 +2894,10 @@
}`,
expectedApi: `"a.map.txt"`,
expectedApiSurfaces: `[
- "systemapi",
+ "module-libapi",
"vendorapi",
]`,
- description: "Library that contributes to systemapi and vendorapi",
+ description: "Library that contributes to module-libapi and vendorapi",
},
}
for _, testCase := range testCases {
diff --git a/cc/library.go b/cc/library.go
index 1291f5c..94984cb 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -475,10 +475,10 @@
func apiContributionBp2Build(ctx android.TopDownMutatorContext, module *Module) {
apiSurfaces := make([]string, 0)
apiHeaders := make([]string, 0)
- // systemapi (non-null `stubs` property)
+ // module-libapi for apexes (non-null `stubs` property)
if module.HasStubsVariants() {
- apiSurfaces = append(apiSurfaces, android.SystemApi.String())
- apiIncludes := getSystemApiIncludes(ctx, module)
+ apiSurfaces = append(apiSurfaces, android.ModuleLibApi.String())
+ apiIncludes := getModuleLibApiIncludes(ctx, module)
if !apiIncludes.isEmpty() {
createApiHeaderTarget(ctx, apiIncludes)
apiHeaders = append(apiHeaders, apiIncludes.name)
@@ -494,8 +494,8 @@
}
}
// create a target only if this module contributes to an api surface
- // TODO: Currently this does not distinguish systemapi-only headers and vendrorapi-only headers
- // TODO: Update so that systemapi-only headers do not get exported to vendorapi (and vice-versa)
+ // TODO: Currently this does not distinguish modulelibapi-only headers and vendrorapi-only headers
+ // TODO: Update so that modulelibapi-only headers do not get exported to vendorapi (and vice-versa)
if len(apiSurfaces) > 0 {
props := bazel.BazelTargetModuleProperties{
Rule_class: "cc_api_contribution",
@@ -527,8 +527,8 @@
linker := module.linker.(*libraryDecorator)
if llndkApi := linker.Properties.Llndk.Symbol_file; llndkApi != nil {
apiFile = llndkApi
- } else if systemApi := linker.Properties.Stubs.Symbol_file; systemApi != nil {
- apiFile = systemApi
+ } else if moduleLibApi := linker.Properties.Stubs.Symbol_file; moduleLibApi != nil {
+ apiFile = moduleLibApi
} else {
ctx.ModuleErrorf("API surface library does not have any API file")
}
@@ -566,7 +566,8 @@
includes.attrs.Deps.Append(lla)
}
-func getSystemApiIncludes(ctx android.TopDownMutatorContext, c *Module) apiIncludes {
+// includes provided to the module-lib API surface. This API surface is used by apexes.
+func getModuleLibApiIncludes(ctx android.TopDownMutatorContext, c *Module) apiIncludes {
flagProps := c.library.(*libraryDecorator).flagExporter.Properties
linkProps := c.library.(*libraryDecorator).baseLinker.Properties
includes := android.FirstUniqueStrings(flagProps.Export_include_dirs)
@@ -579,7 +580,7 @@
}
return apiIncludes{
- name: c.Name() + ".systemapi.headers",
+ name: c.Name() + ".module-libapi.headers",
attrs: bazelCcApiLibraryHeadersAttributes{
bazelCcLibraryHeadersAttributes: attrs,
},
diff --git a/cc/library_headers.go b/cc/library_headers.go
index 4d38068..c77d253 100644
--- a/cc/library_headers.go
+++ b/cc/library_headers.go
@@ -169,7 +169,7 @@
// For API export, create a top-level arch-agnostic target and list the arch-specific targets as its deps
// arch-agnostic includes
- apiIncludes := getSystemApiIncludes(ctx, module)
+ apiIncludes := getModuleLibApiIncludes(ctx, module)
// arch and os specific includes
archApiIncludes, androidOsIncludes := archOsSpecificApiIncludes(ctx, module)
for _, arch := range allArches { // sorted iteration
@@ -186,7 +186,7 @@
}
if !apiIncludes.isEmpty() {
- // override the name from <mod>.systemapi.headers --> <mod>.contribution
+ // override the name from <mod>.module-libapi.headers --> <mod>.contribution
apiIncludes.name = android.ApiContributionTargetName(module.Name())
createApiHeaderTarget(ctx, apiIncludes)
}