Can't use configure action from Immutable state
#KT-42413 Fixed
This commit is contained in:
+13
@@ -337,6 +337,19 @@ open class KotlinAndroid36GradleIT : KotlinAndroid33GradleIT() {
|
|||||||
assertTasksExecuted(lintTask) // Check that the lint task ran successfully, KT-27170
|
assertTasksExecuted(lintTask) // Check that the lint task ran successfully, KT-27170
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testJvmWithJava() = with(Project("mppJvmWithJava")) {
|
||||||
|
setupWorkingDir()
|
||||||
|
|
||||||
|
build("build") {
|
||||||
|
assertSuccessful()
|
||||||
|
}
|
||||||
|
|
||||||
|
build("assemble") {
|
||||||
|
assertSuccessful()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class KotlinAndroid32GradleIT : KotlinAndroid3GradleIT() {
|
open class KotlinAndroid32GradleIT : KotlinAndroid3GradleIT() {
|
||||||
|
|||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
apply plugin: 'kotlin-multiplatform'
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
classpath "com.android.tools.build:gradle:$android_tools_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvm("jvmWithJava") {
|
||||||
|
withJava()
|
||||||
|
|
||||||
|
compilations.all {
|
||||||
|
kotlinOptions.jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
google()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#kotlin_version = 1.4.255-SNAPSHOT
|
||||||
|
#android_tools_version = 3.6.0
|
||||||
|
|
||||||
|
org.gradle.paralllel=true
|
||||||
|
kotlin.parallel.tasks.in.project=true
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package jvmWithJavaData
|
||||||
|
|
||||||
|
class SomeJVMWithJavaClass {
|
||||||
|
}
|
||||||
+9
-2
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.compilerRunner
|
package org.jetbrains.kotlin.compilerRunner
|
||||||
|
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.UnknownTaskException
|
||||||
import org.gradle.api.invocation.Gradle
|
import org.gradle.api.invocation.Gradle
|
||||||
import org.gradle.api.logging.Logger
|
import org.gradle.api.logging.Logger
|
||||||
import org.gradle.api.plugins.JavaPluginConvention
|
import org.gradle.api.plugins.JavaPluginConvention
|
||||||
@@ -235,8 +236,14 @@ internal open class GradleCompilerRunner(protected val taskProvider: GradleCompi
|
|||||||
|
|
||||||
if (compilation.isMain()) {
|
if (compilation.isMain()) {
|
||||||
if (isMultiplatformProject) {
|
if (isMultiplatformProject) {
|
||||||
project.locateTask<AbstractArchiveTask>(target.artifactsTaskName)?.configure { jarTask ->
|
try {
|
||||||
jarToModule[jarTask.archivePathCompatible.canonicalFile] = module
|
//It could cause task reconfiguration. TODO: fix it some day if need
|
||||||
|
// But using project.locateTask(taskName).configure cause an Exception for call from ImmutableActionSet
|
||||||
|
|
||||||
|
val archiveTask = project.tasks.getByName(target.artifactsTaskName) as AbstractArchiveTask
|
||||||
|
jarToModule[archiveTask.archivePathCompatible.canonicalFile] = module
|
||||||
|
} catch (e: UnknownTaskException) {
|
||||||
|
//ignore not found task
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (target is KotlinWithJavaTarget<*>) {
|
if (target is KotlinWithJavaTarget<*>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user