In Android MPP target, add common module dependency to api configuration

Since Android considers the `compile` configuration as deprecated and
reports a warning when a dependency is added to it, use the `api`
configuration when dealing with an Android platform module.

Issue #KT-23719 Fixed
This commit is contained in:
Sergey Igushkin
2018-05-08 16:35:04 +03:00
parent 37d7c36b11
commit 2a46648e3e
2 changed files with 25 additions and 4 deletions
@@ -289,10 +289,21 @@ fun getSomething() = 10
}
@Test
fun testMultiplatformAndroidCompile() {
val project = Project("multiplatformAndroidProject", gradleVersion)
fun testMultiplatformAndroidCompile() = with(Project("multiplatformAndroidProject", gradleVersion)) {
setupWorkingDir()
project.build("build") {
if (!isLegacyAndroidGradleVersion(androidGradlePluginVersion)) {
// Check that the common module is not added to the deprecated configuration 'compile' (KT-23719):
gradleBuildScript("libAndroid").appendText(
"""${'\n'}
configurations.compile.dependencies.all { aDependencyExists ->
throw GradleException("Check failed")
}
""".trimIndent()
)
}
build("build") {
assertSuccessful()
assertTasksExecuted(
":lib:compileKotlinCommon",