summaryrefslogtreecommitdiff
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-rw-r--r--cc/Android.bp1
-rw-r--r--cc/library.go50
-rw-r--r--cc/library_stub_test.go459
-rw-r--r--cc/sabi.go11
-rw-r--r--cc/sdk.go29
5 files changed, 50 insertions, 500 deletions
diff --git a/cc/Android.bp b/cc/Android.bp
index 5ba94270b..9ce89330e 100644
--- a/cc/Android.bp
+++ b/cc/Android.bp
@@ -96,7 +96,6 @@ bootstrap_go_package {
"gen_test.go",
"genrule_test.go",
"library_headers_test.go",
- "library_stub_test.go",
"library_test.go",
"lto_test.go",
"ndk_test.go",
diff --git a/cc/library.go b/cc/library.go
index 5b2480906..44bbdfcaf 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1261,6 +1261,18 @@ func (library *libraryDecorator) linkLlndkSAbiDumpFiles(ctx ModuleContext,
"34")
}
+func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext,
+ deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string,
+ excludeSymbolVersions, excludeSymbolTags []string, sdkVersion string) android.Path {
+ return transformDumpToLinkedDump(ctx,
+ sAbiDumpFiles, soFile, libFileName+".apex",
+ library.exportedIncludeDirsForAbiCheck(ctx),
+ android.OptionalPathForModuleSrc(ctx, library.Properties.Stubs.Symbol_file),
+ append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...),
+ append([]string{"platform-only"}, excludeSymbolTags...),
+ sdkVersion)
+}
+
func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
versionedDumpDir, fileName string) android.OptionalPath {
@@ -1276,21 +1288,21 @@ func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
}
// Return the previous and current SDK versions for cross-version ABI diff.
-func crossVersionAbiDiffSdkVersions(ctx ModuleContext, dumpDir string) (string, string) {
+func crossVersionAbiDiffSdkVersions(ctx ModuleContext, dumpDir string) (int, int) {
sdkVersionInt := ctx.Config().PlatformSdkVersion().FinalInt()
- sdkVersionStr := ctx.Config().PlatformSdkVersion().String()
if ctx.Config().PlatformSdkFinal() {
- return strconv.Itoa(sdkVersionInt - 1), sdkVersionStr
+ return sdkVersionInt - 1, sdkVersionInt
} else {
// The platform SDK version can be upgraded before finalization while the corresponding abi dumps hasn't
// been generated. Thus the Cross-Version Check chooses PLATFORM_SDK_VERION - 1 as previous version.
// This situation could be identified by checking the existence of the PLATFORM_SDK_VERION dump directory.
- versionedDumpDir := android.ExistentPathForSource(ctx, dumpDir, sdkVersionStr)
+ versionedDumpDir := android.ExistentPathForSource(ctx,
+ dumpDir, ctx.Config().PlatformSdkVersion().String())
if versionedDumpDir.Valid() {
- return sdkVersionStr, strconv.Itoa(sdkVersionInt + 1)
+ return sdkVersionInt, sdkVersionInt + 1
} else {
- return strconv.Itoa(sdkVersionInt - 1), sdkVersionStr
+ return sdkVersionInt - 1, sdkVersionInt
}
}
}
@@ -1387,7 +1399,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
headerAbiChecker.Exclude_symbol_tags,
currSdkVersion)
- var llndkDump android.Path
+ var llndkDump, apexVariantDump android.Path
tags := classifySourceAbiDump(ctx)
for _, tag := range tags {
if tag == llndkLsdumpTag {
@@ -1399,6 +1411,15 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
headerAbiChecker.Exclude_symbol_tags)
}
addLsdumpPath(string(tag) + ":" + llndkDump.String())
+ } else if tag == apexLsdumpTag {
+ if apexVariantDump == nil {
+ apexVariantDump = library.linkApexSAbiDumpFiles(ctx,
+ deps, objs.sAbiDumpFiles, soFile, fileName,
+ headerAbiChecker.Exclude_symbol_versions,
+ headerAbiChecker.Exclude_symbol_tags,
+ currSdkVersion)
+ }
+ addLsdumpPath(string(tag) + ":" + apexVariantDump.String())
} else {
addLsdumpPath(string(tag) + ":" + implDump.String())
}
@@ -1412,11 +1433,14 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
}
dumpDir := filepath.Join("prebuilts", "abi-dumps", dumpDirName)
isLlndk := (tag == llndkLsdumpTag)
+ isApex := (tag == apexLsdumpTag)
isNdk := (tag == ndkLsdumpTag)
binderBitness := ctx.DeviceConfig().BinderBitness()
nameExt := ""
if isLlndk {
nameExt = "llndk"
+ } else if isApex {
+ nameExt = "apex"
}
// Check against the previous version.
var prevVersion, currVersion string
@@ -1430,7 +1454,13 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
sourceDump = llndkDump
}
} else {
- prevVersion, currVersion = crossVersionAbiDiffSdkVersions(ctx, dumpDir)
+ prevVersionInt, currVersionInt := crossVersionAbiDiffSdkVersions(ctx, dumpDir)
+ prevVersion = strconv.Itoa(prevVersionInt)
+ currVersion = strconv.Itoa(currVersionInt)
+ // APEX dumps are generated by different rules after trunk stable.
+ if isApex && prevVersionInt > 34 {
+ sourceDump = apexVariantDump
+ }
}
prevDumpDir := filepath.Join(dumpDir, prevVersion, binderBitness)
prevDumpFile := getRefAbiDumpFile(ctx, prevDumpDir, fileName)
@@ -1447,6 +1477,10 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, deps PathD
}
} else {
currVersion = currSdkVersion
+ if isApex && (!ctx.Config().PlatformSdkFinal() ||
+ ctx.Config().PlatformSdkVersion().FinalInt() > 34) {
+ sourceDump = apexVariantDump
+ }
}
currDumpDir := filepath.Join(dumpDir, currVersion, binderBitness)
currDumpFile := getRefAbiDumpFile(ctx, currDumpDir, fileName)
diff --git a/cc/library_stub_test.go b/cc/library_stub_test.go
deleted file mode 100644
index 4df0a4186..000000000
--- a/cc/library_stub_test.go
+++ /dev/null
@@ -1,459 +0,0 @@
-// Copyright 2021 Google Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package cc
-
-import (
- _ "fmt"
- _ "sort"
-
- "testing"
-
- "android/soong/android"
-
- "github.com/google/blueprint"
-)
-
-func hasDirectDependency(t *testing.T, ctx *android.TestResult, from android.Module, to android.Module) bool {
- t.Helper()
- var found bool
- ctx.VisitDirectDeps(from, func(dep blueprint.Module) {
- if dep == to {
- found = true
- }
- })
- return found
-}
-
-func TestApiLibraryReplacesExistingModule(t *testing.T) {
- bp := `
- cc_library {
- name: "libfoo",
- shared_libs: ["libbar"],
- vendor_available: true,
- }
-
- cc_library {
- name: "libbar",
- }
-
- cc_api_library {
- name: "libbar",
- vendor_available: true,
- src: "libbar.so",
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libbar",
- ],
- }
- `
-
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- libfoo := ctx.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Module()
- libbar := ctx.ModuleForTests("libbar", "android_arm64_armv8-a_shared").Module()
- libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_shared").Module()
-
- android.AssertBoolEquals(t, "original library should be linked with non-stub variant", true, hasDirectDependency(t, ctx, libfoo, libbar))
- android.AssertBoolEquals(t, "Stub library from API surface should be not linked with non-stub variant", false, hasDirectDependency(t, ctx, libfoo, libbarApiImport))
-
- libfooVendor := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Module()
- libbarApiImportVendor := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
-
- android.AssertBoolEquals(t, "original library should not be linked", false, hasDirectDependency(t, ctx, libfooVendor, libbar))
- android.AssertBoolEquals(t, "Stub library from API surface should be linked", true, hasDirectDependency(t, ctx, libfooVendor, libbarApiImportVendor))
-}
-
-func TestApiLibraryDoNotRequireOriginalModule(t *testing.T) {
- bp := `
- cc_library {
- name: "libfoo",
- shared_libs: ["libbar"],
- vendor: true,
- }
-
- cc_api_library {
- name: "libbar",
- src: "libbar.so",
- vendor_available: true,
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libbar",
- ],
- }
- `
-
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- libfoo := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Module()
- libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
-
- android.AssertBoolEquals(t, "Stub library from API surface should be linked", true, hasDirectDependency(t, ctx, libfoo, libbarApiImport))
-}
-
-func TestApiLibraryShouldNotReplaceWithoutApiImport(t *testing.T) {
- bp := `
- cc_library {
- name: "libfoo",
- shared_libs: ["libbar"],
- vendor_available: true,
- }
-
- cc_library {
- name: "libbar",
- vendor_available: true,
- }
-
- cc_api_library {
- name: "libbar",
- src: "libbar.so",
- vendor_available: true,
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [],
- }
- `
-
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- libfoo := ctx.ModuleForTests("libfoo", "android_vendor_arm64_armv8-a_shared").Module()
- libbar := ctx.ModuleForTests("libbar", "android_vendor_arm64_armv8-a_shared").Module()
- libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
-
- android.AssertBoolEquals(t, "original library should be linked", true, hasDirectDependency(t, ctx, libfoo, libbar))
- android.AssertBoolEquals(t, "Stub library from API surface should not be linked", false, hasDirectDependency(t, ctx, libfoo, libbarApiImport))
-}
-
-func TestExportDirFromStubLibrary(t *testing.T) {
- bp := `
- cc_library {
- name: "libfoo",
- export_include_dirs: ["source_include_dir"],
- export_system_include_dirs: ["source_system_include_dir"],
- vendor_available: true,
- }
- cc_api_library {
- name: "libfoo",
- export_include_dirs: ["stub_include_dir"],
- export_system_include_dirs: ["stub_system_include_dir"],
- vendor_available: true,
- src: "libfoo.so",
- }
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libfoo",
- ],
- header_libs: [],
- }
- // vendor binary
- cc_binary {
- name: "vendorbin",
- vendor: true,
- srcs: ["vendor.cc"],
- shared_libs: ["libfoo"],
- }
- `
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
- vendorCFlags := ctx.ModuleForTests("vendorbin", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"]
- android.AssertStringDoesContain(t, "Vendor binary should compile using headers provided by stub", vendorCFlags, "-Istub_include_dir")
- android.AssertStringDoesNotContain(t, "Vendor binary should not compile using headers of source", vendorCFlags, "-Isource_include_dir")
- android.AssertStringDoesContain(t, "Vendor binary should compile using system headers provided by stub", vendorCFlags, "-isystem stub_system_include_dir")
- android.AssertStringDoesNotContain(t, "Vendor binary should not compile using system headers of source", vendorCFlags, "-isystem source_system_include_dir")
-
- vendorImplicits := ctx.ModuleForTests("vendorbin", "android_vendor_arm64_armv8-a").Rule("cc").OrderOnly.Strings()
- // Building the stub.so file first assembles its .h files in multi-tree out.
- // These header files are required for compiling the other API domain (vendor in this case)
- android.AssertStringListContains(t, "Vendor binary compilation should have an implicit dep on the stub .so file", vendorImplicits, "libfoo.so")
-}
-
-func TestApiLibraryWithLlndkVariant(t *testing.T) {
- bp := `
- cc_binary {
- name: "binfoo",
- vendor: true,
- srcs: ["binfoo.cc"],
- shared_libs: ["libbar"],
- }
-
- cc_api_library {
- name: "libbar",
- // TODO(b/244244438) Remove src property once all variants are implemented.
- src: "libbar.so",
- vendor_available: true,
- variants: [
- "llndk",
- ],
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "llndk",
- src: "libbar_llndk.so",
- export_include_dirs: ["libbar_llndk_include"]
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libbar",
- ],
- header_libs: [],
- }
- `
-
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- binfoo := ctx.ModuleForTests("binfoo", "android_vendor_arm64_armv8-a").Module()
- libbarApiImport := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
- libbarApiVariant := ctx.ModuleForTests("libbar.llndk.apiimport", "android_vendor_arm64_armv8-a").Module()
-
- android.AssertBoolEquals(t, "Stub library from API surface should be linked", true, hasDirectDependency(t, ctx, binfoo, libbarApiImport))
- android.AssertBoolEquals(t, "Stub library variant from API surface should be linked", true, hasDirectDependency(t, ctx, libbarApiImport, libbarApiVariant))
-
- binFooLibFlags := ctx.ModuleForTests("binfoo", "android_vendor_arm64_armv8-a").Rule("ld").Args["libFlags"]
- android.AssertStringDoesContain(t, "Vendor binary should be linked with LLNDK variant source", binFooLibFlags, "libbar.llndk.apiimport.so")
-
- binFooCFlags := ctx.ModuleForTests("binfoo", "android_vendor_arm64_armv8-a").Rule("cc").Args["cFlags"]
- android.AssertStringDoesContain(t, "Vendor binary should include headers from the LLNDK variant source", binFooCFlags, "-Ilibbar_llndk_include")
-}
-
-func TestApiLibraryWithNdkVariant(t *testing.T) {
- bp := `
- cc_binary {
- name: "binfoo",
- sdk_version: "29",
- srcs: ["binfoo.cc"],
- shared_libs: ["libbar"],
- stl: "c++_shared",
- }
-
- cc_binary {
- name: "binbaz",
- sdk_version: "30",
- srcs: ["binbaz.cc"],
- shared_libs: ["libbar"],
- stl: "c++_shared",
- }
-
- cc_binary {
- name: "binqux",
- srcs: ["binfoo.cc"],
- shared_libs: ["libbar"],
- }
-
- cc_library {
- name: "libbar",
- srcs: ["libbar.cc"],
- }
-
- cc_api_library {
- name: "libbar",
- // TODO(b/244244438) Remove src property once all variants are implemented.
- src: "libbar.so",
- variants: [
- "ndk.29",
- "ndk.30",
- "ndk.current",
- ],
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "29",
- src: "libbar_ndk_29.so",
- export_include_dirs: ["libbar_ndk_29_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "30",
- src: "libbar_ndk_30.so",
- export_include_dirs: ["libbar_ndk_30_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "current",
- src: "libbar_ndk_current.so",
- export_include_dirs: ["libbar_ndk_current_include"]
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libbar",
- ],
- header_libs: [],
- }
- `
-
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- binfoo := ctx.ModuleForTests("binfoo", "android_arm64_armv8-a_sdk").Module()
- libbarApiImportv29 := ctx.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_sdk_shared_29").Module()
- libbarApiVariantv29 := ctx.ModuleForTests("libbar.ndk.29.apiimport", "android_arm64_armv8-a_sdk").Module()
- libbarApiImportv30 := ctx.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_sdk_shared_30").Module()
- libbarApiVariantv30 := ctx.ModuleForTests("libbar.ndk.30.apiimport", "android_arm64_armv8-a_sdk").Module()
-
- android.AssertBoolEquals(t, "Stub library from API surface should be linked with target version", true, hasDirectDependency(t, ctx, binfoo, libbarApiImportv29))
- android.AssertBoolEquals(t, "Stub library variant from API surface should be linked with target version", true, hasDirectDependency(t, ctx, libbarApiImportv29, libbarApiVariantv29))
- android.AssertBoolEquals(t, "Stub library from API surface should not be linked with different version", false, hasDirectDependency(t, ctx, binfoo, libbarApiImportv30))
- android.AssertBoolEquals(t, "Stub library variant from API surface should not be linked with different version", false, hasDirectDependency(t, ctx, libbarApiImportv29, libbarApiVariantv30))
-
- binbaz := ctx.ModuleForTests("binbaz", "android_arm64_armv8-a_sdk").Module()
-
- android.AssertBoolEquals(t, "Stub library from API surface should be linked with target version", true, hasDirectDependency(t, ctx, binbaz, libbarApiImportv30))
- android.AssertBoolEquals(t, "Stub library from API surface should not be linked with different version", false, hasDirectDependency(t, ctx, binbaz, libbarApiImportv29))
-
- binFooLibFlags := ctx.ModuleForTests("binfoo", "android_arm64_armv8-a_sdk").Rule("ld").Args["libFlags"]
- android.AssertStringDoesContain(t, "Binary using sdk should be linked with NDK variant source", binFooLibFlags, "libbar.ndk.29.apiimport.so")
-
- binFooCFlags := ctx.ModuleForTests("binfoo", "android_arm64_armv8-a_sdk").Rule("cc").Args["cFlags"]
- android.AssertStringDoesContain(t, "Binary using sdk should include headers from the NDK variant source", binFooCFlags, "-Ilibbar_ndk_29_include")
-
- binQux := ctx.ModuleForTests("binqux", "android_arm64_armv8-a").Module()
- android.AssertBoolEquals(t, "NDK Stub library from API surface should not be linked with nonSdk binary", false,
- (hasDirectDependency(t, ctx, binQux, libbarApiImportv30) || hasDirectDependency(t, ctx, binQux, libbarApiImportv29)))
-}
-
-func TestApiLibraryWithMultipleVariants(t *testing.T) {
- bp := `
- cc_binary {
- name: "binfoo",
- sdk_version: "29",
- srcs: ["binfoo.cc"],
- shared_libs: ["libbar"],
- stl: "c++_shared",
- }
-
- cc_binary {
- name: "binbaz",
- vendor: true,
- srcs: ["binbaz.cc"],
- shared_libs: ["libbar"],
- }
-
- cc_library {
- name: "libbar",
- srcs: ["libbar.cc"],
- }
-
- cc_api_library {
- name: "libbar",
- // TODO(b/244244438) Remove src property once all variants are implemented.
- src: "libbar.so",
- vendor_available: true,
- variants: [
- "llndk",
- "ndk.29",
- "ndk.30",
- "ndk.current",
- "apex.29",
- "apex.30",
- "apex.current",
- ],
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "29",
- src: "libbar_ndk_29.so",
- export_include_dirs: ["libbar_ndk_29_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "30",
- src: "libbar_ndk_30.so",
- export_include_dirs: ["libbar_ndk_30_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "ndk",
- version: "current",
- src: "libbar_ndk_current.so",
- export_include_dirs: ["libbar_ndk_current_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "apex",
- version: "29",
- src: "libbar_apex_29.so",
- export_include_dirs: ["libbar_apex_29_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "apex",
- version: "30",
- src: "libbar_apex_30.so",
- export_include_dirs: ["libbar_apex_30_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "apex",
- version: "current",
- src: "libbar_apex_current.so",
- export_include_dirs: ["libbar_apex_current_include"]
- }
-
- cc_api_variant {
- name: "libbar",
- variant: "llndk",
- src: "libbar_llndk.so",
- export_include_dirs: ["libbar_llndk_include"]
- }
-
- api_imports {
- name: "api_imports",
- shared_libs: [
- "libbar",
- ],
- apex_shared_libs: [
- "libbar",
- ],
- }
- `
- ctx := prepareForCcTest.RunTestWithBp(t, bp)
-
- binfoo := ctx.ModuleForTests("binfoo", "android_arm64_armv8-a_sdk").Module()
- libbarApiImportv29 := ctx.ModuleForTests("libbar.apiimport", "android_arm64_armv8-a_sdk_shared_29").Module()
- libbarApiImportLlndk := ctx.ModuleForTests("libbar.apiimport", "android_vendor_arm64_armv8-a_shared").Module()
-
- android.AssertBoolEquals(t, "Binary using SDK should be linked with API library from NDK variant", true, hasDirectDependency(t, ctx, binfoo, libbarApiImportv29))
- android.AssertBoolEquals(t, "Binary using SDK should not be linked with API library from LLNDK variant", false, hasDirectDependency(t, ctx, binfoo, libbarApiImportLlndk))
-
- binbaz := ctx.ModuleForTests("binbaz", "android_vendor_arm64_armv8-a").Module()
-
- android.AssertBoolEquals(t, "Vendor binary should be linked with API library from LLNDK variant", true, hasDirectDependency(t, ctx, binbaz, libbarApiImportLlndk))
- android.AssertBoolEquals(t, "Vendor binary should not be linked with API library from NDK variant", false, hasDirectDependency(t, ctx, binbaz, libbarApiImportv29))
-
-}
diff --git a/cc/sabi.go b/cc/sabi.go
index ef43c8daf..cd9bf6393 100644
--- a/cc/sabi.go
+++ b/cc/sabi.go
@@ -29,6 +29,7 @@ var (
type lsdumpTag string
const (
+ apexLsdumpTag lsdumpTag = "APEX"
llndkLsdumpTag lsdumpTag = "LLNDK"
ndkLsdumpTag lsdumpTag = "NDK"
platformLsdumpTag lsdumpTag = "PLATFORM"
@@ -39,6 +40,8 @@ const (
// Return the prebuilt ABI dump directory for a tag; an empty string for an opt-in dump.
func (tag *lsdumpTag) dirName() string {
switch *tag {
+ case apexLsdumpTag:
+ return "platform"
case ndkLsdumpTag:
return "ndk"
case llndkLsdumpTag:
@@ -134,11 +137,13 @@ func classifySourceAbiDump(ctx android.BaseModuleContext) []lsdumpTag {
if m.isImplementationForLLNDKPublic() {
result = append(result, llndkLsdumpTag)
}
- // Return NDK if the library is both NDK and APEX.
- // TODO(b/309880485): Split NDK and APEX ABI.
if m.IsNdk(ctx.Config()) {
result = append(result, ndkLsdumpTag)
- } else if m.library.hasStubsVariants() || headerAbiChecker.enabled() {
+ }
+ // APEX and opt-in platform dumps are placed in the same directory.
+ if m.library.hasStubsVariants() {
+ result = append(result, apexLsdumpTag)
+ } else if headerAbiChecker.enabled() {
result = append(result, platformLsdumpTag)
}
} else if headerAbiChecker.enabled() {
diff --git a/cc/sdk.go b/cc/sdk.go
index 736a958a0..ce0fdc2e3 100644
--- a/cc/sdk.go
+++ b/cc/sdk.go
@@ -59,35 +59,6 @@ func sdkMutator(ctx android.BottomUpMutatorContext) {
modules[1].(*Module).Properties.PreventInstall = true
}
ctx.AliasVariation("")
- } else if isCcModule && ccModule.isImportedApiLibrary() {
- apiLibrary, _ := ccModule.linker.(*apiLibraryDecorator)
- if apiLibrary.hasNDKStubs() && ccModule.canUseSdk() {
- variations := []string{"sdk"}
- if apiLibrary.hasApexStubs() {
- variations = append(variations, "")
- }
- // Handle cc_api_library module with NDK stubs and variants only which can use SDK
- modules := ctx.CreateVariations(variations...)
- // Mark the SDK variant.
- modules[0].(*Module).Properties.IsSdkVariant = true
- if ctx.Config().UnbundledBuildApps() {
- if apiLibrary.hasApexStubs() {
- // For an unbundled apps build, hide the platform variant from Make.
- modules[1].(*Module).Properties.HideFromMake = true
- }
- modules[1].(*Module).Properties.PreventInstall = true
- } else {
- // For a platform build, mark the SDK variant so that it gets a ".sdk" suffix when
- // exposed to Make.
- modules[0].(*Module).Properties.SdkAndPlatformVariantVisibleToMake = true
- // SDK variant is not supposed to be installed
- modules[0].(*Module).Properties.PreventInstall = true
- }
- } else {
- ccModule.Properties.Sdk_version = nil
- ctx.CreateVariations("")
- ctx.AliasVariation("")
- }
} else {
if isCcModule {
// Clear the sdk_version property for modules that don't have an SDK variant so