Fix javaOutputDir changed to the JAR, which was breaking unit tests

internal visibility, because they did not get the JAR into classpath

Issue #KT-20212 Fixed

(cherry picked from commit 19e861b)
This commit is contained in:
Sergey Igushkin
2017-09-19 14:52:40 +03:00
parent 5ce514bd42
commit 41b13d25f2
2 changed files with 8 additions and 2 deletions
@@ -0,0 +1,6 @@
import lib.internalLibFun
fun main(args: Array<String>) {
// check that unit tests can access internals of the main variant:
internalLibFun()
}
@@ -61,9 +61,9 @@ internal class LegacyAndroidAndroidProjectHandler(kotlinConfigurationTools: Kotl
createSyncOutputTask(project, kotlinTask, javaTask, kotlinAfterJavaTask, getVariantName(variantData))
// In lib modules, the androidTest variants get the classes jar in their classpath instead of the Java
// destination dir. To use it as a friend path, set the jar as the javaOutputDir (see its usages):
// destination dir. Attach the JAR to be consumed as friend path:
if (variantData is LibraryVariantData) {
variantData.dependencyJarOrNull?.let { kotlinTask.javaOutputDir = it }
variantData.dependencyJarOrNull?.let { jar -> kotlinTask.attachClassesDir { jar } }
}
}