diff --git a/java/sdk_library.go b/java/sdk_library.go index a8cc1b81f..4f95a997d 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -3602,3 +3602,19 @@ func (s *sdkLibrarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberCo propertySet.AddProperty("doctag_files", dests) } } + +// TODO(b/358613520): This can be removed when modules are no longer allowed to depend on the top-level library. +func (s *SdkLibrary) IDEInfo(dpInfo *android.IdeInfo) { + s.Library.IDEInfo(dpInfo) + if s.implLibraryModule != nil { + dpInfo.Deps = append(dpInfo.Deps, s.implLibraryModule.Name()) + } else { + // This java_sdk_library does not have an implementation (it sets `api_only` to true). + // Examples of this are `art.module.intra.core.api` (IntraCore api surface). + // Return the "public" stubs for these. + stubPaths := s.findClosestScopePath(apiScopePublic) + if len(stubPaths.stubsHeaderPath) > 0 { + dpInfo.Jars = append(dpInfo.Jars, stubPaths.stubsHeaderPath[0].String()) + } + } +}