summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2019-12-03 03:41:21 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-12-03 03:41:21 +0000
commitf6739a65dd1ceeb050249070e9407890f713e30c (patch)
treebb45846dcfe7afde14934a347065c829ca7efaa4 /java/java.go
parente643cd2b61cfe8a9d86cf25062d3647f74ec8710 (diff)
parent75b83b0a81f2dbe55a1146118d0a4eff11c4ea87 (diff)
Merge "Link type will be check in android_library also"
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/java/java.go b/java/java.go
index 1c52575d2..5cd074ab1 100644
--- a/java/java.go
+++ b/java/java.go
@@ -689,7 +689,12 @@ const (
javaPlatform
)
-func getLinkType(m *Module, name string) (ret linkType, stubs bool) {
+type linkTypeContext interface {
+ android.Module
+ getLinkType(name string) (ret linkType, stubs bool)
+}
+
+func (m *Module) getLinkType(name string) (ret linkType, stubs bool) {
ver := m.sdkVersion()
switch {
case name == "core.current.stubs" || name == "core.platform.api.stubs" ||
@@ -720,16 +725,16 @@ func getLinkType(m *Module, name string) (ret linkType, stubs bool) {
}
}
-func checkLinkType(ctx android.ModuleContext, from *Module, to *Library, tag dependencyTag) {
+func checkLinkType(ctx android.ModuleContext, from *Module, to linkTypeContext, tag dependencyTag) {
if ctx.Host() {
return
}
- myLinkType, stubs := getLinkType(from, ctx.ModuleName())
+ myLinkType, stubs := from.getLinkType(ctx.ModuleName())
if stubs {
return
}
- otherLinkType, _ := getLinkType(&to.Module, ctx.OtherModuleName(to))
+ otherLinkType, _ := to.getLinkType(ctx.OtherModuleName(to))
commonMessage := "Adjust sdk_version: property of the source or target module so that target module is built with the same or smaller API set than the source."
switch myLinkType {
@@ -786,11 +791,14 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
// Handled by AndroidApp.collectAppDeps
return
}
-
- if to, ok := module.(*Library); ok {
- switch tag {
- case bootClasspathTag, libTag, staticLibTag:
- checkLinkType(ctx, j, to, tag.(dependencyTag))
+ switch module.(type) {
+ case *Library:
+ case *AndroidLibrary:
+ if to, ok := module.(linkTypeContext); ok {
+ switch tag {
+ case bootClasspathTag, libTag, staticLibTag:
+ checkLinkType(ctx, j, to, tag.(dependencyTag))
+ }
}
}
switch dep := module.(type) {