Merge "Correct link type for module stubs"
This commit is contained in:
@@ -852,6 +852,10 @@ func (m *Module) getLinkType(name string) (ret linkType, stubs bool) {
|
|||||||
return javaSystem, true
|
return javaSystem, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if stub, linkType := moduleStubLinkType(name); stub {
|
||||||
|
return linkType, true
|
||||||
|
}
|
||||||
|
|
||||||
ver := m.sdkVersion()
|
ver := m.sdkVersion()
|
||||||
switch ver.kind {
|
switch ver.kind {
|
||||||
case sdkCore:
|
case sdkCore:
|
||||||
|
@@ -1577,6 +1577,24 @@ func (s *frameworkModulesNamingScheme) apiModuleName(scope *apiScope, baseName s
|
|||||||
|
|
||||||
var _ sdkLibraryComponentNamingScheme = (*frameworkModulesNamingScheme)(nil)
|
var _ sdkLibraryComponentNamingScheme = (*frameworkModulesNamingScheme)(nil)
|
||||||
|
|
||||||
|
func moduleStubLinkType(name string) (stub bool, ret linkType) {
|
||||||
|
// This suffix-based approach is fragile and could potentially mis-trigger.
|
||||||
|
// TODO(b/155164730): Clean this up when modules no longer reference sdk_lib stubs directly.
|
||||||
|
if strings.HasSuffix(name, ".stubs.public") || strings.HasSuffix(name, "-stubs-publicapi") {
|
||||||
|
return true, javaSdk
|
||||||
|
}
|
||||||
|
if strings.HasSuffix(name, ".stubs.system") || strings.HasSuffix(name, "-stubs-systemapi") {
|
||||||
|
return true, javaSystem
|
||||||
|
}
|
||||||
|
if strings.HasSuffix(name, ".stubs.module_lib") || strings.HasSuffix(name, "-stubs-module_libs_api") {
|
||||||
|
return true, javaModule
|
||||||
|
}
|
||||||
|
if strings.HasSuffix(name, ".stubs.test") {
|
||||||
|
return true, javaSystem
|
||||||
|
}
|
||||||
|
return false, javaPlatform
|
||||||
|
}
|
||||||
|
|
||||||
// java_sdk_library is a special Java library that provides optional platform APIs to apps.
|
// java_sdk_library is a special Java library that provides optional platform APIs to apps.
|
||||||
// In practice, it can be viewed as a combination of several modules: 1) stubs library that clients
|
// In practice, it can be viewed as a combination of several modules: 1) stubs library that clients
|
||||||
// are linked against to, 2) droiddoc module that internally generates API stubs source files,
|
// are linked against to, 2) droiddoc module that internally generates API stubs source files,
|
||||||
|
Reference in New Issue
Block a user