disable usage of plugins as static libs

Test: m auto_value_plugin
Test: m androidx.appsearch_appsearch-compiler
Test: m intdef-annotation-processor-test
Test: atest intdef-annotation-processor-test
Test: m view-inspector-annotation-processor-test
Test: atest view-inspector-annotation-processor-test
Test: m Robolectric_processor_tests
Test: atest Robolectric_processor_tests
Bug: 225388628
Change-Id: I9e3dd81f44333b680f2e81283c02a9be5a4de15b
(cherry picked from commit 0d1c4a0fee)
Merged-In: I9e3dd81f44333b680f2e81283c02a9be5a4de15b
This commit is contained in:
Sam Delmerico
2022-04-26 18:34:55 +00:00
committed by Cherrypicker Worker
parent 72da93e188
commit 969f8f0a25

View File

@@ -1937,6 +1937,9 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
case bootClasspathTag:
deps.bootClasspath = append(deps.bootClasspath, dep.HeaderJars...)
case libTag, instrumentationForTag:
if _, ok := module.(*Plugin); ok {
ctx.ModuleErrorf("a java_plugin (%s) cannot be used as a libs dependency", otherName)
}
deps.classpath = append(deps.classpath, dep.HeaderJars...)
deps.dexClasspath = append(deps.dexClasspath, dep.HeaderJars...)
deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs...)
@@ -1945,6 +1948,9 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
case java9LibTag:
deps.java9Classpath = append(deps.java9Classpath, dep.HeaderJars...)
case staticLibTag:
if _, ok := module.(*Plugin); ok {
ctx.ModuleErrorf("a java_plugin (%s) cannot be used as a static_libs dependency", otherName)
}
deps.classpath = append(deps.classpath, dep.HeaderJars...)
deps.staticJars = append(deps.staticJars, dep.ImplementationJars...)
deps.staticHeaderJars = append(deps.staticHeaderJars, dep.HeaderJars...)