Merge "Improve the structure of the link check method" into rvc-dev

This commit is contained in:
Anton Hansson 2020-05-27 11:09:53 +00:00 committed by Android (Google) Code Review
commit 5e8c81a91d
1 changed files with 31 additions and 30 deletions

View File

@ -837,41 +837,42 @@ type linkTypeContext interface {
}
func (m *Module) getLinkType(name string) (ret linkType, stubs bool) {
ver := m.sdkVersion()
switch {
case name == "core.current.stubs" || name == "core.platform.api.stubs" ||
name == "stub-annotations" || name == "private-stub-annotations-jar" ||
name == "core-lambda-stubs" || name == "core-generated-annotation-stubs":
switch name {
case "core.current.stubs", "core.platform.api.stubs", "stub-annotations",
"private-stub-annotations-jar", "core-lambda-stubs", "core-generated-annotation-stubs":
return javaCore, true
case ver.kind == sdkCore:
return javaCore, false
case name == "android_system_stubs_current":
return javaSystem, true
case ver.kind == sdkSystem:
return javaSystem, false
case name == "android_test_stubs_current":
return javaSystem, true
case ver.kind == sdkTest:
return javaPlatform, false
case name == "android_stubs_current":
case "android_stubs_current":
return javaSdk, true
case ver.kind == sdkPublic:
return javaSdk, false
case name == "android_module_lib_stubs_current":
case "android_system_stubs_current":
return javaSystem, true
case "android_module_lib_stubs_current":
return javaModule, true
case ver.kind == sdkModule:
return javaModule, false
case name == "android_system_server_stubs_current":
case "android_system_server_stubs_current":
return javaSystemServer, true
case ver.kind == sdkSystemServer:
return javaSystemServer, false
case ver.kind == sdkPrivate || ver.kind == sdkNone || ver.kind == sdkCorePlatform:
return javaPlatform, false
case !ver.valid():
panic(fmt.Errorf("sdk_version is invalid. got %q", ver.raw))
default:
return javaSdk, false
case "android_test_stubs_current":
return javaSystem, true
}
ver := m.sdkVersion()
switch ver.kind {
case sdkCore:
return javaCore, false
case sdkSystem:
return javaSystem, false
case sdkPublic:
return javaSdk, false
case sdkModule:
return javaModule, false
case sdkSystemServer:
return javaSystemServer, false
case sdkPrivate, sdkNone, sdkCorePlatform, sdkTest:
return javaPlatform, false
}
if !ver.valid() {
panic(fmt.Errorf("sdk_version is invalid. got %q", ver.raw))
}
return javaSdk, false
}
func checkLinkType(ctx android.ModuleContext, from *Module, to linkTypeContext, tag dependencyTag) {