Shade test jars from compiler used in Gradle tests
This fixes `VerifyError` for all integration tests calling `KotlinTestUtils.findAndroidSdk()`. The exception was thrown because `:kotlin-gradle-plugin-integration-tests` was depending on both relocated intellij-core (from kotlin-compiler-embeddable) and non-relocated intellij-core (transitevely through tests jars from compiler). A call to `findAndroidSdk()` was triggering classloading for `KotlinTestUtils` which had bytecode references to `org.jetbrains.kotlin.idea.KotlinLanguage` loaded from the embeddable compiler and to `com.intellij.lang.Language` loaded from non-relocated intellij-core. `KotlinLanguage` from the embeddable compiler was a subclass of relocated `org.jetbrains.kotlin.com.intellij.lang.Language` thus it was not assignable to `com.intellij.lang.Language` causing `VerifyError`. The solution is to create relocated jar combining the necessary test jars from the compiler.
This commit is contained in:
@@ -15,12 +15,12 @@ dependencies {
|
||||
testCompile project(':kotlin-test:kotlin-test-jvm')
|
||||
|
||||
testCompile project(path: ':kotlin-compiler-embeddable', configuration: 'runtimeJar')
|
||||
testCompile (project(path: ':kotlin-gradle-plugin-test-utils-embeddable', configuration: 'runtimeJar'))
|
||||
|
||||
testCompile project(path: ':examples:annotation-processor-example')
|
||||
testCompile project(':kotlin-stdlib-jre8')
|
||||
testCompile project(':kotlin-reflect')
|
||||
testCompile project(':kotlin-android-extensions')
|
||||
testCompile project(path: ':kotlin-build-common', configuration: 'tests-jar')
|
||||
testCompile project(path: ':compiler:incremental-compilation-impl', configuration: 'tests-jar')
|
||||
|
||||
testCompile gradleApi()
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.com.intellij.openapi.util.io.FileUtil
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.jetbrains.kotlin.gradle.util.*
|
||||
import org.junit.After
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.gradle.plugin.CopyClassesToJavaOutputStatus
|
||||
import org.jetbrains.kotlin.gradle.tasks.USING_INCREMENTAL_COMPILATION_MESSAGE
|
||||
import org.jetbrains.kotlin.gradle.plugin.*
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
|
||||
description = "Shaded test jars from compiler for Gradle integration tests"
|
||||
|
||||
plugins { `java` }
|
||||
|
||||
val packedJars by configurations.creating
|
||||
|
||||
val projectsToInclude = listOf(":compiler:tests-common",
|
||||
":compiler:incremental-compilation-impl",
|
||||
":kotlin-build-common")
|
||||
|
||||
dependencies {
|
||||
for (projectName in projectsToInclude) {
|
||||
packedJars(projectTests(projectName)) { isTransitive = false }
|
||||
}
|
||||
|
||||
packedJars(intellijDep()) { includeJars("idea_rt") }
|
||||
|
||||
}
|
||||
|
||||
runtimeJar(rewriteDepsToShadedCompiler(
|
||||
task<ShadowJar>("shadowJar") {
|
||||
from(packedJars)
|
||||
}
|
||||
))
|
||||
@@ -129,6 +129,7 @@ include ":kotlin-build-common",
|
||||
":tools:kotlin-stdlib-gen",
|
||||
":kotlin-gradle-plugin-api",
|
||||
":kotlin-gradle-plugin",
|
||||
":kotlin-gradle-plugin-test-utils-embeddable",
|
||||
":kotlin-gradle-plugin-integration-tests",
|
||||
":kotlin-allopen",
|
||||
":kotlin-noarg",
|
||||
@@ -209,6 +210,7 @@ project(':tools:kotlin-stdlib-js-merger').projectDir = "$rootDir/libraries/tools
|
||||
project(':tools:kotlin-stdlib-gen').projectDir = "$rootDir/libraries/tools/kotlin-stdlib-gen" as File
|
||||
project(':kotlin-gradle-plugin-api').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-api" as File
|
||||
project(':kotlin-gradle-plugin').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin" as File
|
||||
project(':kotlin-gradle-plugin-test-utils-embeddable').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-test-utils-embeddable" as File
|
||||
project(':kotlin-gradle-plugin-integration-tests').projectDir = "$rootDir/libraries/tools/kotlin-gradle-plugin-integration-tests" as File
|
||||
project(':kotlin-allopen').projectDir = "$rootDir/libraries/tools/kotlin-allopen" as File
|
||||
project(':kotlin-noarg').projectDir = "$rootDir/libraries/tools/kotlin-noarg" as File
|
||||
|
||||
Reference in New Issue
Block a user