Remade launch of NativeRunConfigurationTest against master version of gradle plugin
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This TestCase implements possibility to test import with different versions of gradle and master
|
||||||
|
* version of gradle kotlin plugin
|
||||||
|
*/
|
||||||
|
package org.jetbrains.kotlin.idea.codeInsight.gradle
|
||||||
|
|
||||||
|
import org.junit.runners.Parameterized
|
||||||
|
|
||||||
|
abstract class MasterPluginVersionGradleImportingTestCase : MultiplePluginVersionGradleImportingTestCase() {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
@Parameterized.Parameters(name = "{index}: Gradle-{0}, KotlinGradlePlugin-{1}")
|
||||||
|
fun data(): Collection<Array<Any>> {
|
||||||
|
return (AbstractModelBuilderTest.SUPPORTED_GRADLE_VERSIONS).map { gradleVersion ->
|
||||||
|
arrayOf<Any>(
|
||||||
|
gradleVersion[0],
|
||||||
|
LATEST_SUPPORTED_VERSION
|
||||||
|
)
|
||||||
|
}.toList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+4
-41
@@ -9,49 +9,28 @@ import com.intellij.codeInsight.daemon.LineMarkerInfo
|
|||||||
import com.intellij.execution.PsiLocation
|
import com.intellij.execution.PsiLocation
|
||||||
import com.intellij.execution.actions.ConfigurationContext
|
import com.intellij.execution.actions.ConfigurationContext
|
||||||
import com.intellij.execution.actions.ConfigurationFromContext
|
import com.intellij.execution.actions.ConfigurationFromContext
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
|
||||||
import org.jetbrains.kotlin.gradle.GradleDaemonAnalyzerTestCase
|
import org.jetbrains.kotlin.gradle.GradleDaemonAnalyzerTestCase
|
||||||
import org.jetbrains.kotlin.test.TagsTestDataUtil
|
import org.jetbrains.kotlin.test.TagsTestDataUtil
|
||||||
import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration
|
import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration
|
||||||
|
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runners.Parameterized
|
|
||||||
import java.net.URL
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class NativeRunConfigurationTest : GradleImportingTestCase() {
|
class NativeRunConfigurationTest : MasterPluginVersionGradleImportingTestCase() {
|
||||||
private companion object {
|
|
||||||
private const val DEFAULT_PLUGIN_VERSION = "1.4-M2"
|
|
||||||
private val latestPluginVersion by lazy {
|
|
||||||
PluginVersionDownloader.getLatestDevVersion() ?: DEFAULT_PLUGIN_VERSION
|
|
||||||
}
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@Parameterized.Parameters(name = "{index}: Gradle-{0}, KotlinGradlePlugin-{1}")
|
|
||||||
fun data(): Collection<Array<Any>> = listOf(arrayOf("6.0.1", latestPluginVersion))
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun testDataDirName(): String = "nativeRunConfiguration"
|
override fun testDataDirName(): String = "nativeRunConfiguration"
|
||||||
|
|
||||||
@JvmField
|
|
||||||
@Parameterized.Parameter(1)
|
|
||||||
var kotlinGradlePluginVersion: String = DEFAULT_PLUGIN_VERSION
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@TargetVersions("6.0+")
|
||||||
fun multiplatformNativeRunGutter() {
|
fun multiplatformNativeRunGutter() {
|
||||||
doTest()
|
doTest()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@TargetVersions("6.0+")
|
||||||
fun customEntryPointWithoutRunGutter() {
|
fun customEntryPointWithoutRunGutter() {
|
||||||
doTest()
|
doTest()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun configureByFiles(properties: Map<String, String>?): List<VirtualFile> {
|
|
||||||
val unitedProperties = HashMap(properties ?: emptyMap())
|
|
||||||
unitedProperties["kotlin_plugin_version"] = kotlinGradlePluginVersion
|
|
||||||
return super.configureByFiles(unitedProperties)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun doTest() {
|
private fun doTest() {
|
||||||
val files = importProjectFromTestData()
|
val files = importProjectFromTestData()
|
||||||
val project = myTestFixture.project
|
val project = myTestFixture.project
|
||||||
@@ -85,19 +64,3 @@ class NativeRunConfigurationTest : GradleImportingTestCase() {
|
|||||||
return emptyContext.configurationsFromContext.orEmpty()
|
return emptyContext.configurationsFromContext.orEmpty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object PluginVersionDownloader {
|
|
||||||
fun getLatestEapVersion() = downloadVersions(EAP_URL).lastOrNull()
|
|
||||||
fun getLatestDevVersion() = downloadVersions(DEV_URL).lastOrNull()
|
|
||||||
|
|
||||||
private fun downloadVersions(url: String): List<String> {
|
|
||||||
return versionRegexp.findAll(URL(url).readText())
|
|
||||||
.map { it.groupValues[1].removeSuffix("/") }
|
|
||||||
.filter { it.isNotEmpty() && it[0].isDigit() }
|
|
||||||
.toList()
|
|
||||||
}
|
|
||||||
|
|
||||||
private const val EAP_URL = "https://dl.bintray.com/kotlin/kotlin-eap/org/jetbrains/kotlin/jvm/org.jetbrains.kotlin.jvm.gradle.plugin/"
|
|
||||||
private const val DEV_URL = "https://dl.bintray.com/kotlin/kotlin-dev/org/jetbrains/kotlin/jvm/org.jetbrains.kotlin.jvm.gradle.plugin/"
|
|
||||||
private val versionRegexp = """href="([^"\\]+)"""".toRegex()
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user