Merge "Improve the structure of the link check method" am: 14da93be48

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1324609

Change-Id: I1b45c0ae2e7dcb8ef81c385a2b0a9aacd3c7ed1a
This commit is contained in:
Anton Hansson 2020-06-05 18:50:59 +00:00 committed by Automerger Merge Worker
commit 0f8187d4c1

View file

@ -836,41 +836,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) {