Improve the structure of the link check method
Match by name first, then by kind. Bug: 157010342 Test: m Change-Id: Ic337a073c3bd14ac03b1d899aeb612247a708495
This commit is contained in:
parent
83ef435005
commit
ac103461a4
61
java/java.go
61
java/java.go
|
@ -827,41 +827,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) {
|
||||
|
|
Loading…
Reference in New Issue