Special case the stubgen args for bionic libs

IsNdk and NotInPlatform can return incorrect values in minimal branches
that do not contain the source bionic libraries. (e.g. in
aosp-master-art)

Bug: 275273834
Test: presbumits (which will build aosp-master-art)
Change-Id: I5e9216a40c0fd2d077bb6c53ba6628e311d99737
This commit is contained in:
Spandan Das
2024-08-15 21:49:14 +00:00
parent 357ffcc146
commit c27dd3393c

View File

@@ -676,6 +676,15 @@ func (library *libraryDecorator) compileModuleLibApiStubs(ctx ModuleContext, fla
!strings.Contains(ctx.ModuleName(), "libclang_rt") {
flag = flag + " --no-ndk"
}
// TODO(b/361303067): Remove this special case if bionic/ projects are added to ART development branches.
if isBionic(ctx.baseModuleName()) {
// set the flags explicitly for bionic libs.
// this is necessary for development in minimal branches which does not contain bionic/*.
// In such minimal branches, e.g. on the prebuilt libc stubs
// 1. IsNdk will return false (since the ndk_library definition for libc does not exist)
// 2. NotInPlatform will return true (since the source com.android.runtime does not exist)
flag = "--apex"
}
nativeAbiResult := parseNativeAbiDefinition(ctx, symbolFile,
android.ApiLevelOrPanic(ctx, library.MutatedProperties.StubsVersion), flag)
objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc)