Fix Gradle plugin build with Gradle 5.0

* Due to 'improved POM support' introduced in 5.0, runtime dependencies
of the `compileOnly 'com.android.tools.build:gradle:...'` dependency
were no more transitively available. Add them manually;

* Add `!!` to usages of `resourcesDir`, which became nullable;

* Replace the dropped `classesDir` method usages with reflection;
This commit is contained in:
Sergey Igushkin
2018-12-06 17:38:05 +03:00
committed by Vyacheslav Gerasimov
parent e8f1e2d022
commit 2a14301c75
3 changed files with 7 additions and 5 deletions
@@ -1,5 +1,4 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.gradle.publish.PluginConfig
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.pill.PillExtension
@@ -46,6 +45,9 @@ dependencies {
compileOnly(project(":kotlin-scripting-compiler"))
compileOnly("com.android.tools.build:gradle:2.0.0")
compileOnly("com.android.tools.build:gradle-core:2.0.0")
compileOnly("com.android.tools.build:builder:2.0.0")
compileOnly("com.android.tools.build:builder-model:2.0.0")
compileOnly("org.codehaus.groovy:groovy-all:2.4.12")
compileOnly(gradleApi())
@@ -95,7 +95,7 @@ class KotlinModelBuilder(private val kotlinPluginVersion: String, private val an
kotlinSourceSet.kotlin.srcDirs,
javaSourceSet.resources.srcDirs,
destinationDir,
javaSourceSet.output.resourcesDir,
javaSourceSet.output.resourcesDir!!,
createCompilerArguments()
)
} else null
@@ -38,10 +38,10 @@ class KotlinWithJavaCompilationOutput(
get() = compilation.javaSourceSet.output
override val resourcesDir: File
get() = javaSourceSetOutput.resourcesDir
get() = javaSourceSetOutput.resourcesDir!!
override var resourcesDirProvider: Any
get() = javaSourceSetOutput.resourcesDir
get() = javaSourceSetOutput.resourcesDir!!
set(value) {
javaSourceSetOutput.setResourcesDir(value)
}