Fix android tests
This commit is contained in:
@@ -25,6 +25,7 @@ dependencies {
|
|||||||
testRuntime(project(":sam-with-receiver-ide-plugin"))
|
testRuntime(project(":sam-with-receiver-ide-plugin"))
|
||||||
testRuntime(project(":noarg-ide-plugin"))
|
testRuntime(project(":noarg-ide-plugin"))
|
||||||
testRuntime(project(":allopen-ide-plugin"))
|
testRuntime(project(":allopen-ide-plugin"))
|
||||||
|
testRuntime(project(":plugins:lint"))
|
||||||
testRuntime(ideaSdkDeps("*.jar"))
|
testRuntime(ideaSdkDeps("*.jar"))
|
||||||
testRuntime(ideaPluginDeps("idea-junit", "resources_en", plugin = "junit"))
|
testRuntime(ideaPluginDeps("idea-junit", "resources_en", plugin = "junit"))
|
||||||
testRuntime(ideaPluginDeps("IntelliLang", plugin = "IntelliLang"))
|
testRuntime(ideaPluginDeps("IntelliLang", plugin = "IntelliLang"))
|
||||||
|
|||||||
+22
-1
@@ -35,6 +35,9 @@ import org.jetbrains.kotlin.config.CompilerConfiguration
|
|||||||
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
|
||||||
import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension
|
import org.jetbrains.kotlin.resolve.jvm.extensions.PackageFragmentProviderExtension
|
||||||
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||||
|
import org.jetbrains.kotlin.utils.KotlinPaths
|
||||||
|
import org.jetbrains.kotlin.utils.KotlinPathsFromHomeDir
|
||||||
|
import org.jetbrains.kotlin.utils.PathUtil
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
fun KtUsefulTestCase.createTestEnvironment(configuration: CompilerConfiguration, resDirectories: List<String>): KotlinCoreEnvironment {
|
fun KtUsefulTestCase.createTestEnvironment(configuration: CompilerConfiguration, resDirectories: List<String>): KotlinCoreEnvironment {
|
||||||
@@ -59,7 +62,7 @@ fun KtUsefulTestCase.createTestEnvironment(configuration: CompilerConfiguration,
|
|||||||
|
|
||||||
fun addAndroidExtensionsRuntimeLibrary(environment: KotlinCoreEnvironment) {
|
fun addAndroidExtensionsRuntimeLibrary(environment: KotlinCoreEnvironment) {
|
||||||
environment.apply {
|
environment.apply {
|
||||||
val runtimeLibrary = File("out/production/android-extensions-runtime")
|
val runtimeLibrary = File(computeKotlinPaths().libPath, "android-extensions-compiler.jar")
|
||||||
updateClasspath(listOf(JvmClasspathRoot(runtimeLibrary)))
|
updateClasspath(listOf(JvmClasspathRoot(runtimeLibrary)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,3 +70,21 @@ fun addAndroidExtensionsRuntimeLibrary(environment: KotlinCoreEnvironment) {
|
|||||||
fun getResPaths(path: String): List<String> {
|
fun getResPaths(path: String): List<String> {
|
||||||
return File(path).listFiles { it -> it.name.startsWith("res") && it.isDirectory }!!.map { "$path${it.name}/" }
|
return File(path).listFiles { it -> it.name.startsWith("res") && it.isDirectory }!!.map { "$path${it.name}/" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val KOTLIN_HOME_PROPERTY = "kotlin.home"
|
||||||
|
val KOTLIN_HOME_ENV_VAR = "KOTLIN_HOME"
|
||||||
|
|
||||||
|
private fun computeKotlinPaths(): KotlinPaths {
|
||||||
|
val kotlinHomeProperty = System.getProperty(KOTLIN_HOME_PROPERTY)
|
||||||
|
val kotlinHomeEnvVar = System.getenv(KOTLIN_HOME_ENV_VAR)
|
||||||
|
val kotlinHome = when {
|
||||||
|
kotlinHomeProperty != null -> File(kotlinHomeProperty)
|
||||||
|
kotlinHomeEnvVar != null -> File(kotlinHomeEnvVar)
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
return when {
|
||||||
|
kotlinHome == null -> PathUtil.kotlinPathsForCompiler
|
||||||
|
kotlinHome.isDirectory -> KotlinPathsFromHomeDir(kotlinHome)
|
||||||
|
else -> throw RuntimeException("Kotlin home does not exist or is not a directory: " + kotlinHome)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ dependencies {
|
|||||||
compile(project(":compiler:frontend")) { isTransitive = false }
|
compile(project(":compiler:frontend")) { isTransitive = false }
|
||||||
compile(project(":compiler:frontend.java")) { isTransitive = false }
|
compile(project(":compiler:frontend.java")) { isTransitive = false }
|
||||||
compile(project(":js:js.frontend")) { isTransitive = false }
|
compile(project(":js:js.frontend")) { isTransitive = false }
|
||||||
compile(project(":idea"))
|
compile(projectClasses(":idea"))
|
||||||
|
compile(project(":idea:idea-jvm")) { isTransitive = false }
|
||||||
compile(project(":idea:idea-core")) { isTransitive = false }
|
compile(project(":idea:idea-core")) { isTransitive = false }
|
||||||
compile(project(":idea:ide-common")) { isTransitive = false }
|
compile(project(":idea:ide-common")) { isTransitive = false }
|
||||||
compile(project(":idea:idea-gradle")) { isTransitive = false }
|
compile(project(":idea:idea-gradle")) { isTransitive = false }
|
||||||
@@ -51,6 +52,7 @@ dependencies {
|
|||||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "junit"))
|
compile(ideaUltimatePluginDeps("*.jar", plugin = "junit"))
|
||||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "uml"))
|
compile(ideaUltimatePluginDeps("*.jar", plugin = "uml"))
|
||||||
compile(ideaUltimatePluginDeps("*.jar", plugin = "JavaScriptLanguage"))
|
compile(ideaUltimatePluginDeps("*.jar", plugin = "JavaScriptLanguage"))
|
||||||
|
compile(ideaUltimatePluginDeps("*.jar", plugin = "JavaScriptDebugger"))
|
||||||
|
|
||||||
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
|
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
|
||||||
testCompile(project(":compiler.tests-common")) { isTransitive = false }
|
testCompile(project(":compiler.tests-common")) { isTransitive = false }
|
||||||
@@ -113,7 +115,9 @@ val ultimatePluginXmlContent: String by lazy {
|
|||||||
|
|
||||||
val prepareResources by task<Copy> {
|
val prepareResources by task<Copy> {
|
||||||
dependsOn(":idea:assemble")
|
dependsOn(":idea:assemble")
|
||||||
from(ideaProjectResources, { exclude("META-INF/plugin.xml") })
|
from(ideaProjectResources, {
|
||||||
|
exclude("META-INF/plugin.xml")
|
||||||
|
})
|
||||||
into(preparedResources)
|
into(preparedResources)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user