From c27dd3393cfcf19524d09ddcc9930b48ed139fec Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Thu, 15 Aug 2024 21:49:14 +0000 Subject: [PATCH] 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 --- cc/library.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cc/library.go b/cc/library.go index fef83f6c1..011de36b3 100644 --- a/cc/library.go +++ b/cc/library.go @@ -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)