From d30ac8a32a9ff28db781db20e6dbe08d0b04b394 Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Mon, 9 Oct 2023 18:00:17 +0000 Subject: [PATCH] Disable full_api_surface_stubs for some java_api_library modules java_api_library modules generated from java_sdk_library get full_api_surface_stubs corresponding to the api surface that the module contributes to. However, modules generated from java_sdk_library where sdk_version is none should not depend on the full api surface stub jar. Test: m --build-from-text-stub Bug: 288624417 Change-Id: I7edda3e6a40f739e805e8719b8d366da765a6933 --- java/sdk_library.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/java/sdk_library.go b/java/sdk_library.go index f72c6086f..78e31023f 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -1876,6 +1876,14 @@ func (module *SdkLibrary) createApiLibrary(mctx android.DefaultableHookContext, props.Full_api_surface_stub = proptools.StringPtr(apiScope.kind.DefaultJavaLibraryName() + "_full.from-text") } + // java_sdk_library modules that set sdk_version as none does not depend on other api + // domains. Therefore, java_api_library created from such modules should not depend on + // full_api_surface_stubs but create and compile stubs by the java_api_library module + // itself. + if module.SdkVersion(mctx).Kind == android.SdkNone { + props.Full_api_surface_stub = nil + } + props.System_modules = module.deviceProperties.System_modules mctx.CreateModule(ApiLibraryFactory, &props)