summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dan Albert <danalbert@google.com> 2024-10-31 22:15:40 +0000
committer Dan Albert <danalbert@google.com> 2024-10-31 22:15:40 +0000
commit499c92ea143e8b1c29a5a2282069127ccbb3a258 (patch)
tree98018b24f3756a99f4a23a2eb5fa943147517a54
parent6f886a36f32638d2ff30c657b73e34ef6068bb80 (diff)
Stop dumping/diffing preview ABIs.
Tracking the unfinalized API levels is causing more harm than good. It's a major source of merge conflicts and the codenames themselves are subject to change. It's also a pretty slow extra step for API authors. We can bring this back if we ever manage to get all the API surfaces onto STG, because then we could use the STG files for signaling API review instead of the *.map.txt filter, but since the others currently don't use STG and don't track preview API, we can't do that today. Bug: None Test: treehugger Change-Id: I309bfeef88c4f2c8a9112beddef8bfe88da9ef32
-rw-r--r--cc/ndk_library.go98
1 files changed, 56 insertions, 42 deletions
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 01551ab49..0db5b7614 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -144,11 +144,9 @@ func (stub *stubDecorator) implementationModuleName(name string) string {
}
func ndkLibraryVersions(ctx android.BaseModuleContext, from android.ApiLevel) []string {
- var versions []android.ApiLevel
versionStrs := []string{}
- for _, version := range ctx.Config().AllSupportedApiLevels() {
+ for _, version := range ctx.Config().FinalApiLevels() {
if version.GreaterThanOrEqualTo(from) {
- versions = append(versions, version)
versionStrs = append(versionStrs, version.String())
}
}
@@ -330,6 +328,12 @@ func (this *stubDecorator) findPrebuiltAbiDump(ctx ModuleContext,
return android.ExistentPathForSource(ctx, subpath)
}
+func (this *stubDecorator) builtAbiDumpLocation(ctx ModuleContext, apiLevel android.ApiLevel) android.OutputPath {
+ return getNdkAbiDumpInstallBase(ctx).Join(ctx,
+ apiLevel.String(), ctx.Arch().ArchType.String(),
+ this.libraryName(ctx), "abi.stg")
+}
+
// Feature flag.
func (this *stubDecorator) canDumpAbi(ctx ModuleContext) bool {
if runtime.GOOS == "darwin" {
@@ -345,25 +349,24 @@ func (this *stubDecorator) canDumpAbi(ctx ModuleContext) bool {
return false
}
- if this.apiLevel.IsCurrent() {
- // "current" (AKA 10000) is not tracked.
- return false
- }
-
// http://b/156513478
return ctx.Config().ReleaseNdkAbiMonitored()
}
// Feature flag to disable diffing against prebuilts.
-func canDiffAbi(config android.Config) bool {
+func (this *stubDecorator) canDiffAbi(config android.Config) bool {
+ if this.apiLevel.IsCurrent() {
+ // Diffs are performed from this to next, and there's nothing after
+ // current.
+ return false
+ }
+
return config.ReleaseNdkAbiMonitored()
}
func (this *stubDecorator) dumpAbi(ctx ModuleContext, symbolList android.Path) {
implementationLibrary := this.findImplementationLibrary(ctx)
- this.abiDumpPath = getNdkAbiDumpInstallBase(ctx).Join(ctx,
- this.apiLevel.String(), ctx.Arch().ArchType.String(),
- this.libraryName(ctx), "abi.stg")
+ this.abiDumpPath = this.builtAbiDumpLocation(ctx, this.apiLevel)
this.hasAbiDump = true
headersList := getNdkABIHeadersFile(ctx)
ctx.Build(pctx, android.BuildParams{
@@ -383,7 +386,7 @@ func (this *stubDecorator) dumpAbi(ctx ModuleContext, symbolList android.Path) {
}
func findNextApiLevel(ctx ModuleContext, apiLevel android.ApiLevel) *android.ApiLevel {
- apiLevels := append(ctx.Config().AllSupportedApiLevels(),
+ apiLevels := append(ctx.Config().FinalApiLevels(),
android.FutureApiLevel)
for _, api := range apiLevels {
if api.GreaterThan(apiLevel) {
@@ -436,38 +439,49 @@ func (this *stubDecorator) diffAbi(ctx ModuleContext) {
"non-current API level %s", this.apiLevel))
}
- // "current" ABI is not tracked.
- if !nextApiLevel.IsCurrent() {
- nextAbiDiffPath := android.PathForModuleOut(ctx,
- "abidiff_next.timestamp")
- nextAbiDump := this.findPrebuiltAbiDump(ctx, *nextApiLevel)
+ // Preview ABI levels are not recording in prebuilts. ABI compatibility
+ // for preview APIs is still monitored via "current" so we have early
+ // warning rather than learning about an ABI break during finalization,
+ // but is only checked against the "current" API dumps in the out
+ // directory.
+ nextAbiDiffPath := android.PathForModuleOut(ctx,
+ "abidiff_next.timestamp")
+
+ var nextAbiDump android.OptionalPath
+ if nextApiLevel.IsCurrent() {
+ nextAbiDump = android.OptionalPathForPath(
+ this.builtAbiDumpLocation(ctx, *nextApiLevel),
+ )
+ } else {
+ nextAbiDump = this.findPrebuiltAbiDump(ctx, *nextApiLevel)
+ }
+
+ if !nextAbiDump.Valid() {
missingNextPrebuiltError := fmt.Sprintf(
missingPrebuiltErrorTemplate, this.libraryName(ctx),
nextAbiDump.InvalidReason())
- if !nextAbiDump.Valid() {
- ctx.Build(pctx, android.BuildParams{
- Rule: android.ErrorRule,
- Output: nextAbiDiffPath,
- Args: map[string]string{
- "error": missingNextPrebuiltError,
- },
- })
- } else {
- ctx.Build(pctx, android.BuildParams{
- Rule: stgdiff,
- Description: fmt.Sprintf(
- "Comparing ABI to the next API level %s %s",
- prebuiltAbiDump, nextAbiDump),
- Output: nextAbiDiffPath,
- Inputs: android.Paths{
- prebuiltAbiDump.Path(), nextAbiDump.Path()},
- Args: map[string]string{
- "args": "--format=small --ignore=interface_addition",
- },
- })
- }
- this.abiDiffPaths = append(this.abiDiffPaths, nextAbiDiffPath)
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.ErrorRule,
+ Output: nextAbiDiffPath,
+ Args: map[string]string{
+ "error": missingNextPrebuiltError,
+ },
+ })
+ } else {
+ ctx.Build(pctx, android.BuildParams{
+ Rule: stgdiff,
+ Description: fmt.Sprintf(
+ "Comparing ABI to the next API level %s %s",
+ prebuiltAbiDump, nextAbiDump),
+ Output: nextAbiDiffPath,
+ Inputs: android.Paths{
+ prebuiltAbiDump.Path(), nextAbiDump.Path()},
+ Args: map[string]string{
+ "args": "--format=small --ignore=interface_addition",
+ },
+ })
}
+ this.abiDiffPaths = append(this.abiDiffPaths, nextAbiDiffPath)
}
}
@@ -492,7 +506,7 @@ func (c *stubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) O
c.versionScriptPath = nativeAbiResult.versionScript
if c.canDumpAbi(ctx) {
c.dumpAbi(ctx, nativeAbiResult.symbolList)
- if canDiffAbi(ctx.Config()) {
+ if c.canDiffAbi(ctx.Config()) {
c.diffAbi(ctx)
}
}