From 9c8e0c4e64abfe487020958120075eea609cc7fb Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 18 Sep 2024 20:45:44 +0000 Subject: [PATCH] Fix `m ndk`. Apparently treehugger doesn't cover this, and autosubmit fired before I had a chance to upload the second PS. Bug: None Test: m ndk Change-Id: I292f7349b98d5f9132ea41729933c1462e100a69 --- cc/ndk_library.go | 62 +++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/cc/ndk_library.go b/cc/ndk_library.go index 94e0452dd..01551ab49 100644 --- a/cc/ndk_library.go +++ b/cc/ndk_library.go @@ -429,41 +429,45 @@ func (this *stubDecorator) diffAbi(ctx ModuleContext) { // Also ensure that the ABI of the next API level (if there is one) matches // this API level. *New* ABI is allowed, but any changes to APIs that exist // in this API level are disallowed. - if !this.apiLevel.IsCurrent() && prebuiltAbiDump.Valid() { + if prebuiltAbiDump.Valid() { nextApiLevel := findNextApiLevel(ctx, this.apiLevel) if nextApiLevel == nil { panic(fmt.Errorf("could not determine which API level follows "+ "non-current API level %s", this.apiLevel)) } - nextAbiDiffPath := android.PathForModuleOut(ctx, - "abidiff_next.timestamp") - nextAbiDump := this.findPrebuiltAbiDump(ctx, *nextApiLevel) - 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", - }, - }) + + // "current" ABI is not tracked. + if !nextApiLevel.IsCurrent() { + nextAbiDiffPath := android.PathForModuleOut(ctx, + "abidiff_next.timestamp") + nextAbiDump := this.findPrebuiltAbiDump(ctx, *nextApiLevel) + 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) } - this.abiDiffPaths = append(this.abiDiffPaths, nextAbiDiffPath) } }