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
diff --git a/java/sdk_library.go b/java/sdk_library.go
index f72c608..78e3102 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1876,6 +1876,14 @@
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)