Fix Kapt configuration not resolving MPP deps to JVM variants, KT-31641

This commit is contained in:
Sergey Igushkin
2019-09-02 21:18:53 +03:00
parent f2d2fb9e6b
commit 3deff3b347
4 changed files with 18 additions and 6 deletions
@@ -283,6 +283,8 @@ class NewMultiplatformIT : BaseGradleIT() {
private fun doTestJvmWithJava(testJavaSupportInJvmTargets: Boolean) =
with(Project("sample-lib", GradleVersionRequired.AtLeast("5.0"), "new-mpp-lib-and-app")) {
embedProject(Project("sample-lib-gradle-kotlin-dsl", directoryPrefix = "new-mpp-lib-and-app"))
lateinit var classesWithoutJava: Set<String>
fun getFilePathsSet(inDirectory: String): Set<String> {
@@ -322,6 +324,7 @@ class NewMultiplatformIT : BaseGradleIT() {
dependencies {
jvm6MainImplementation("com.google.dagger:dagger:2.24")
kapt("com.google.dagger:dagger-compiler:2.24")
kapt(project(":sample-lib-gradle-kotlin-dsl"))
}
""".trimIndent()
)
@@ -62,7 +62,7 @@ class PluginsDslIT : BaseGradleIT() {
}
private const val MAVEN_LOCAL_URL_PLACEHOLDER = "<mavenLocalUrl>"
private const val PLUGIN_MARKER_VERSION_PLACEHOLDER = "<pluginMarkerVersion>"
internal const val PLUGIN_MARKER_VERSION_PLACEHOLDER = "<pluginMarkerVersion>"
internal fun BaseGradleIT.transformProjectWithPluginsDsl(
projectName: String,
@@ -290,10 +290,17 @@ class VariantAwareDependenciesIT : BaseGradleIT() {
}
}
private fun Project.embedProject(other: Project) {
setupWorkingDir()
other.setupWorkingDir()
other.projectDir.copyRecursively(projectDir.resolve(other.projectName))
projectDir.resolve("settings.gradle").appendText("\ninclude '${other.projectName}'")
}
internal fun BaseGradleIT.Project.embedProject(other: BaseGradleIT.Project) {
setupWorkingDir()
other.setupWorkingDir()
other.testCase.apply {
val gradleBuildScript = other.gradleBuildScript()
if (gradleBuildScript.extension == "kts") {
gradleBuildScript.modify { it.replace(".version(\"$PLUGIN_MARKER_VERSION_PLACEHOLDER\")", "") }
}
}
other.projectDir.copyRecursively(projectDir.resolve(other.projectName))
projectDir.resolve("settings.gradle").appendText("\ninclude '${other.projectName}'")
}