Move tests from GradleImportingTestCase to MultiplePluginVersionGradleImportingTestCase
This commit is contained in:
+2
-8
@@ -19,10 +19,10 @@ import org.jetbrains.kotlin.idea.util.projectStructure.allModules
|
||||
import org.jetbrains.kotlin.konan.library.konanCommonLibraryPath
|
||||
import org.jetbrains.kotlin.konan.library.konanPlatformLibraryPath
|
||||
import org.jetbrains.kotlin.platform.konan.isNative
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
import org.junit.runners.Parameterized
|
||||
import java.io.File
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ class GradleNativeLibrariesInIDENamingTest : TestCaseWithFakeKotlinNative() {
|
||||
|
||||
// Test naming of Kotlin/Native libraries
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testLibrariesNaming() {
|
||||
configureProject()
|
||||
importProject()
|
||||
@@ -40,13 +41,6 @@ class GradleNativeLibrariesInIDENamingTest : TestCaseWithFakeKotlinNative() {
|
||||
override fun getExternalSystemConfigFileName() = GradleConstants.KOTLIN_DSL_SCRIPT_NAME
|
||||
|
||||
override fun testDataDirName() = "nativeLibraries"
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{index}: with Gradle-{0}")
|
||||
@Throws(Throwable::class)
|
||||
@JvmStatic
|
||||
fun data() = listOf(arrayOf("4.10.2"))
|
||||
}
|
||||
}
|
||||
|
||||
private val NATIVE_LIBRARY_NAME_REGEX = Regex("^Kotlin/Native ([\\d\\w\\.-]+) - ([\\w\\d]+)( \\[([\\w\\d_]+)\\])?$")
|
||||
|
||||
+3
-8
@@ -9,9 +9,9 @@ import com.intellij.openapi.roots.DependencyScope
|
||||
import org.jetbrains.kotlin.gradle.ModuleInfo
|
||||
import org.jetbrains.kotlin.gradle.checkProjectStructure
|
||||
import org.jetbrains.kotlin.idea.configuration.externalCompilerVersion
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
import org.junit.Test
|
||||
import org.junit.runners.Parameterized
|
||||
|
||||
class GradleNativeLibrariesPropagationTest : TestCaseWithFakeKotlinNative() {
|
||||
|
||||
@@ -22,6 +22,7 @@ class GradleNativeLibrariesPropagationTest : TestCaseWithFakeKotlinNative() {
|
||||
private val testedTargets = setOf("ios_arm64", "ios_x64", "watchos_arm32", "watchos_x86")
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testCommonIOS() {
|
||||
configureProject()
|
||||
importProject()
|
||||
@@ -63,6 +64,7 @@ class GradleNativeLibrariesPropagationTest : TestCaseWithFakeKotlinNative() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "<1.4.0", skipForMaster = true)
|
||||
fun testCommonIOSWithDisabledPropagation() {
|
||||
configureProject()
|
||||
importProject()
|
||||
@@ -110,11 +112,4 @@ class GradleNativeLibrariesPropagationTest : TestCaseWithFakeKotlinNative() {
|
||||
libraryDependency("Kotlin/Native $kotlinVersion - $libraryName [$target]", DependencyScope.PROVIDED)
|
||||
noPlatformLibrary(libraryName, testedTargets - target)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@Parameterized.Parameters(name = "{index}: with Gradle-{0}")
|
||||
@Throws(Throwable::class)
|
||||
@JvmStatic
|
||||
fun data() = listOf(arrayOf("4.10.2"))
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,10 +5,10 @@
|
||||
|
||||
package org.jetbrains.kotlin.ide.konan.gradle
|
||||
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.GradleImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||
import java.io.File
|
||||
|
||||
abstract class TestCaseWithFakeKotlinNative : GradleImportingTestCase() {
|
||||
abstract class TestCaseWithFakeKotlinNative : MultiplePluginVersionGradleImportingTestCase() {
|
||||
protected fun configureProject() {
|
||||
configureByFiles()
|
||||
|
||||
|
||||
+2
-3
@@ -27,7 +27,6 @@ import com.intellij.testFramework.VfsTestUtil
|
||||
import com.intellij.testFramework.runInEdtAndWait
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.mppImportTestMinVersionForMaster
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TagsTestDataUtil
|
||||
import org.jetbrains.kotlin.test.TagsTestDataUtil.TagInfo
|
||||
@@ -39,13 +38,13 @@ import java.io.File
|
||||
class GradleMultiplatformHighlightingTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testFirst() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testNoErrors() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
+13
-17
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.config.SourceKotlinRootType
|
||||
import org.jetbrains.kotlin.config.TestResourceKotlinRootType
|
||||
import org.jetbrains.kotlin.config.TestSourceKotlinRootType
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.mppImportTestMinVersionForMaster
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
@@ -41,7 +40,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testImportHMPPFlag() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -56,7 +55,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testImportIntermediateModules() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -232,7 +231,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testJvmWithJavaOnHMPP() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -344,7 +343,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testPrecisePlatformsHmpp() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -378,7 +377,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testPrecisePlatformsWithUnrelatedModuleHmpp() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -426,7 +425,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testOrphanSourceSet() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -451,7 +450,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testSourceSetIncludedIntoCompilationDirectly() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -476,7 +475,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testDefaultSourceSetDependsOnDefaultSourceSet() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -505,7 +504,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testDefaultSourceSetIncludedIntoAnotherCompilationDirectly() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -525,7 +524,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testSourceSetsWithDependsOnButNotIncludedIntoCompilation() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -560,7 +559,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testCustomAddToCompilationPlusDependsOn() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -579,7 +578,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testCommonMainIsSingleBackend() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -619,12 +618,9 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
|
||||
override fun importProject() {
|
||||
val isUseQualifiedModuleNames = currentExternalProjectSettings.isUseQualifiedModuleNames
|
||||
currentExternalProjectSettings.isUseQualifiedModuleNames = true
|
||||
val isCreateEmptyContentRootDirectories = currentExternalProjectSettings.isCreateEmptyContentRootDirectories
|
||||
currentExternalProjectSettings.isCreateEmptyContentRootDirectories = true
|
||||
try {
|
||||
super.importProject()
|
||||
super.importProject(true)
|
||||
} finally {
|
||||
currentExternalProjectSettings.isCreateEmptyContentRootDirectories = isCreateEmptyContentRootDirectories
|
||||
currentExternalProjectSettings.isUseQualifiedModuleNames = isUseQualifiedModuleNames
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.intellij.psi.*
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.testFramework.runInEdtAndGet
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MasterPluginVersionGradleImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.mppImportTestMinVersionForMaster
|
||||
import org.jetbrains.kotlin.idea.core.util.toPsiFile
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.kotlin.psi.KtTreeVisitorVoid
|
||||
@@ -21,7 +20,7 @@ import org.junit.Test
|
||||
class ImportAndCheckNavigation : MasterPluginVersionGradleImportingTestCase() {
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersion = "6.0+", pluginVersion = "1.4+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(gradleVersion = "6.0+", pluginVersion = "1.4+")
|
||||
fun testNavigationToCommonizedLibrary() {
|
||||
val files = configureAndImportProject()
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.intellij.openapi.roots.DependencyScope
|
||||
import org.jetbrains.jps.model.java.JavaResourceRootType
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.legacyMppImportTestMinVersionForMaster
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Test
|
||||
|
||||
@@ -27,7 +26,7 @@ class KaptImportingTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testModulePerSourceSet() {
|
||||
// Disable testing import module per source set test in Android Studio as this mode is not supported in Android Studio
|
||||
if (isAndroidStudio()) {
|
||||
@@ -60,7 +59,7 @@ class KaptImportingTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testModulePerSourceSetDisabled() {
|
||||
configureByFiles()
|
||||
importProject(false)
|
||||
|
||||
+11
-12
@@ -25,7 +25,6 @@ import com.intellij.util.PathUtil
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.facetSettings
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.legacyMppImportTestMinVersionForMaster
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacet
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.kotlin.idea.util.rootManager
|
||||
@@ -58,7 +57,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testPlatformToCommonDependency() {
|
||||
val files = configureByFiles()
|
||||
importProject()
|
||||
@@ -79,7 +78,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testPlatformToCommonExpectedByDependency() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -94,7 +93,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testPlatformToCommonDependencyRoot() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -105,7 +104,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testMultiProject() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -120,7 +119,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testDependenciesReachableViaImpl() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -137,7 +136,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testTransitiveImplement() {
|
||||
configureByFiles()
|
||||
|
||||
@@ -186,7 +185,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testTransitiveImplementWithNonDefaultConfig() {
|
||||
configureByFiles()
|
||||
|
||||
@@ -231,7 +230,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testTransitiveImplementWithAndroid() {
|
||||
configureByFiles()
|
||||
|
||||
@@ -262,7 +261,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun simpleAndroidAppWithCommonModule() {
|
||||
configureByFiles()
|
||||
|
||||
@@ -291,7 +290,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testJsTestOutputFile() {
|
||||
configureByFiles()
|
||||
|
||||
@@ -308,7 +307,7 @@ class MultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTe
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testJsProductionOutputFile() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
|
||||
+2
-3
@@ -10,7 +10,6 @@ import com.intellij.openapi.module.ModuleManager
|
||||
import com.intellij.openapi.roots.*
|
||||
import com.intellij.openapi.roots.impl.ModulesOrderEnumerator
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.mppImportTestMinVersionForMaster
|
||||
import org.jetbrains.kotlin.idea.util.sourceRoots
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Test
|
||||
@@ -19,7 +18,7 @@ import java.io.File
|
||||
class NewMultiplatformKaptProjectImportingTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.40+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.40+")
|
||||
fun testKaptPaths() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -72,7 +71,7 @@ class NewMultiplatformKaptProjectImportingTest : MultiplePluginVersionGradleImpo
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.40+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.40+")
|
||||
fun testRuntimeClasspath() {
|
||||
configureByFiles()
|
||||
|
||||
|
||||
+19
-20
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.config.SourceKotlinRootType
|
||||
import org.jetbrains.kotlin.config.TestResourceKotlinRootType
|
||||
import org.jetbrains.kotlin.config.TestSourceKotlinRootType
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.mppImportTestMinVersionForMaster
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.jetbrains.kotlin.platform.CommonPlatforms
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
@@ -45,7 +44,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.10+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.10+")
|
||||
fun testProjectDependency() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -226,7 +225,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testFileCollectionDependency() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -245,7 +244,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.30+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.30+")
|
||||
fun testUnresolvedDependency() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -265,7 +264,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersion = "5.0+", pluginVersion = "1.3.30+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(gradleVersion = "5.0+", pluginVersion = "1.3.30+")
|
||||
fun testAndroidDependencyOnMPP() {
|
||||
configureByFiles()
|
||||
createProjectSubFile(
|
||||
@@ -305,7 +304,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
libraryDependency("Gradle: org.hamcrest:hamcrest-core:1.3@jar", DependencyScope.TEST)
|
||||
libraryDependency("Gradle: org.hamcrest:hamcrest-integration:1.3@jar", DependencyScope.TEST)
|
||||
libraryDependency("Gradle: org.hamcrest:hamcrest-library:1.3@jar", DependencyScope.TEST)
|
||||
if (gradleKotlinPluginVersion != MINIMAL_SUPPORTED_VERSION) {
|
||||
if (gradleKotlinPluginVersion != RELEASED_A_YEAR_AGO_GRADLE_PLUGIN_VERSION) {
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-android-extensions-runtime:${gradleKotlinPluginVersion}@jar", DependencyScope.COMPILE)
|
||||
}
|
||||
libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}@jar", DependencyScope.COMPILE)
|
||||
@@ -369,7 +368,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testTestTasks() {
|
||||
val files = configureByFiles()
|
||||
importProject(skipIndexing = true)
|
||||
@@ -412,7 +411,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.50+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.50+")
|
||||
fun testImportTestsAndTargets() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -440,7 +439,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@PluginTargetVersions(gradleVersion = "5.0+", pluginVersion = "1.3.50+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(gradleVersion = "5.0+", pluginVersion = "1.3.50+")
|
||||
fun testSingleAndroidTarget() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -497,7 +496,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.10+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.10+")
|
||||
fun testDependencyOnRoot() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -546,7 +545,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.10+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.10+")
|
||||
fun testNestedDependencies() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -629,7 +628,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersion = "5.0+", pluginVersion = "1.3.20+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(gradleVersion = "5.0+", pluginVersion = "1.3.20+")
|
||||
fun testDetectAndroidSources() {
|
||||
configureByFiles()
|
||||
createProjectSubFile(
|
||||
@@ -651,7 +650,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
* dependencies in multiplatform project included in composite build
|
||||
*/
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.20+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.20+")
|
||||
fun testPlatformToCommonExpByInComposite() {
|
||||
configureByFiles()
|
||||
importProject(true)
|
||||
@@ -703,7 +702,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
* Test case for issue https://youtrack.jetbrains.com/issue/KT-29757
|
||||
*/
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.40+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.40+")
|
||||
fun testJavaTransitiveOnMPP() {
|
||||
configureByFiles()
|
||||
importProject(true)
|
||||
@@ -769,7 +768,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
* Test case for issue https://youtrack.jetbrains.com/issue/KT-28822
|
||||
*/
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.41+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.41+")
|
||||
fun testImportBeforeBuild() {
|
||||
configureByFiles()
|
||||
importProject(true)
|
||||
@@ -836,7 +835,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.20+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.20+")
|
||||
fun testProductionOnTestFlag() {
|
||||
configureByFiles()
|
||||
importProject(true)
|
||||
@@ -849,7 +848,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.30+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.30+")
|
||||
fun testJvmWithJava() {
|
||||
configureByFiles()
|
||||
importProject(true)
|
||||
@@ -904,7 +903,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.30+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.30+")
|
||||
fun testCommonTestTargetPlatform() {
|
||||
configureByFiles()
|
||||
importProject(true)
|
||||
@@ -926,7 +925,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.60+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.60+")
|
||||
fun testIgnoreIncompatibleNativeTestTasks() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -981,7 +980,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
|
||||
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "1.3.30+", gradleVersionForLatestPlugin = mppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions(pluginVersion = "1.3.30+")
|
||||
fun testMutableArtifactLists() {
|
||||
configureByFiles()
|
||||
importProject(true)
|
||||
|
||||
@@ -8,14 +8,13 @@ package org.jetbrains.kotlin.gradle
|
||||
import org.jetbrains.jps.model.java.JavaResourceRootType
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase
|
||||
import org.jetbrains.kotlin.idea.codeInsight.gradle.legacyMppImportTestMinVersionForMaster
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Test
|
||||
|
||||
class PackagePrefixImportingTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersionForLatestPlugin = legacyMppImportTestMinVersionForMaster)
|
||||
@PluginTargetVersions()
|
||||
fun testPackagePrefixNonMPP() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
|
||||
+4
-3
@@ -13,14 +13,15 @@ import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
|
||||
class GradleBuildFileHighlightingTest : GradleImportingTestCase() {
|
||||
class GradleBuildFileHighlightingTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
|
||||
@TargetVersions("4.8+")
|
||||
@PluginTargetVersions(gradleVersion = "4.8+")
|
||||
@Test
|
||||
fun testKtsInJsProject() {
|
||||
val file = configureByFiles().buildGradleKtsFile()
|
||||
@@ -30,7 +31,7 @@ class GradleBuildFileHighlightingTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@TargetVersions("4.8+")
|
||||
@PluginTargetVersions(gradleVersion = "4.8+")
|
||||
@Test
|
||||
fun testComplexBuildGradleKts() {
|
||||
val file = configureByFiles().buildGradleKtsFile()
|
||||
|
||||
+13
-13
@@ -12,11 +12,11 @@ import com.intellij.testFramework.runInEdtAndWait
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinWithGradleConfigurator
|
||||
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Test
|
||||
|
||||
class GradleConfiguratorPlatformSpecificTest : GradleImportingTestCase() {
|
||||
@TargetVersions("4.7+")
|
||||
class GradleConfiguratorPlatformSpecificTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testEnableFeatureSupportMultiplatform() {
|
||||
val files = importProjectFromTestData()
|
||||
@@ -32,11 +32,11 @@ class GradleConfiguratorPlatformSpecificTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testEnableFeatureSupportMultiplatformWithXFlag() = testEnableFeatureSupportMultiplatform()
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testEnableFeatureSupportMultiplatform2() {
|
||||
val files = importProjectFromTestData()
|
||||
@@ -52,7 +52,7 @@ class GradleConfiguratorPlatformSpecificTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testEnableFeatureSupportMultiplatformToExistentArguments() {
|
||||
val files = importProjectFromTestData()
|
||||
@@ -68,7 +68,7 @@ class GradleConfiguratorPlatformSpecificTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testEnableFeatureSupportMultiplatformKts() {
|
||||
val files = importProjectFromTestData()
|
||||
@@ -84,27 +84,27 @@ class GradleConfiguratorPlatformSpecificTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testAddLibraryMultiplatform() = doTestAddLibrary()
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testAddLibraryMultiplatformGSK() = doTestAddLibrary()
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testAddLibraryMultiplatformGSK2() = doTestAddLibrary()
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testAddLibraryMultiplatformGSK3() = doTestAddLibrary()
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testAddLibraryMultiplatformGSK4() = doTestAddLibrary()
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testAddLibraryMultiplatformGSK5() = doTestAddLibrary()
|
||||
|
||||
|
||||
+29
-20
@@ -17,11 +17,11 @@ import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.kotlin.test.testFramework.runWriteAction
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.GradleTestRunConfigurationProducer
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
||||
class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
class GradleConfiguratorTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
|
||||
@Test
|
||||
fun testProjectWithModule() {
|
||||
@@ -46,7 +46,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
"""
|
||||
<p>The compiler bundled to Kotlin plugin (1.0.0) is older than external compiler used for building modules:</p>
|
||||
<ul>
|
||||
<li>app (${LATEST_STABLE_GRADLE_PLUGIN_VERSION})</li>
|
||||
<li>app ($gradleKotlinPluginVersion)</li>
|
||||
</ul>
|
||||
<p>This may cause different set of errors and warnings reported in IDE.</p>
|
||||
<p><a href="update">Update</a> <a href="ignore">Ignore</a></p>
|
||||
@@ -120,7 +120,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.4+")
|
||||
@PluginTargetVersions(gradleVersion = "4.4+")
|
||||
fun testConfigureJvmWithBuildGradle() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -137,7 +137,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.4+")
|
||||
@PluginTargetVersions(gradleVersion = "4.4+")
|
||||
fun testConfigureJvmWithBuildGradleKts() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -154,7 +154,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.4+")
|
||||
@PluginTargetVersions(gradleVersion = "4.4+")
|
||||
fun testConfigureJvmEAPWithBuildGradle() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -171,7 +171,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.4+")
|
||||
@PluginTargetVersions(gradleVersion = "4.4+")
|
||||
fun testConfigureJvmEAPWithBuildGradleKts() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -188,7 +188,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.4+")
|
||||
@PluginTargetVersions(gradleVersion = "4.4+")
|
||||
fun testConfigureJsWithBuildGradle() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -205,7 +205,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.4+")
|
||||
@PluginTargetVersions(gradleVersion = "4.4+")
|
||||
fun testConfigureJsWithBuildGradleKts() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -222,7 +222,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.4+")
|
||||
@PluginTargetVersions(gradleVersion = "4.4+")
|
||||
fun testConfigureJsEAPWithBuildGradle() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -239,7 +239,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.4+")
|
||||
@PluginTargetVersions(gradleVersion = "4.4+")
|
||||
fun testConfigureJsEAPWithBuildGradleKts() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -330,6 +330,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testTestTasksAreImported() {
|
||||
importProjectFromTestData()
|
||||
|
||||
@@ -338,6 +339,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testAddNonKotlinLibraryGSK() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -356,6 +358,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testAddTestLibraryGSK() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -381,6 +384,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testAddLibraryGSK() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -438,6 +442,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testChangeLanguageVersionGSK() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -483,7 +488,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testChangeFeatureSupportWithXFlag() = testChangeFeatureSupport()
|
||||
|
||||
@@ -502,7 +507,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testDisableFeatureSupportWithXFlag() = testDisableFeatureSupport()
|
||||
|
||||
@@ -521,7 +526,7 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
@JvmName("testEnableFeatureSupportWithXFlag")
|
||||
fun testEnableFeatureSupportWithXFlag() = testEnableFeatureSupport()
|
||||
@@ -556,11 +561,12 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testEnableFeatureSupportToExistentArgumentsWithXFlag() = testEnableFeatureSupportToExistentArguments()
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testChangeFeatureSupportGSK() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -575,11 +581,12 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testChangeFeatureSupportGSKWithXFlag() = testChangeFeatureSupportGSK()
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testDisableFeatureSupportGSK() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -594,11 +601,13 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
fun testDisableFeatureSupportGSKWithXFlag() = testDisableFeatureSupportGSK()
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testEnableFeatureSupportGSK() {
|
||||
val files = importProjectFromTestData()
|
||||
|
||||
@@ -613,15 +622,15 @@ class GradleConfiguratorTest : GradleImportingTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testEnableFeatureSupportGSKWithXFlag() = testEnableFeatureSupportGSK()
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testEnableFeatureSupportGSKWithNotInfixVersionCallAndXFlag() = testEnableFeatureSupportGSK()
|
||||
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+")
|
||||
@Test
|
||||
fun testEnableFeatureSupportGSKWithSpecifyingPluginThroughIdAndXFlag() = testEnableFeatureSupportGSK()
|
||||
|
||||
|
||||
+7
-7
@@ -54,25 +54,25 @@ import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
||||
internal fun GradleImportingTestCase.facetSettings(moduleName: String) = KotlinFacet.get(getModule(moduleName))!!.configuration.settings
|
||||
internal fun MultiplePluginVersionGradleImportingTestCase.facetSettings(moduleName: String) = KotlinFacet.get(getModule(moduleName))!!.configuration.settings
|
||||
|
||||
internal val GradleImportingTestCase.facetSettings: KotlinFacetSettings
|
||||
internal val MultiplePluginVersionGradleImportingTestCase.facetSettings: KotlinFacetSettings
|
||||
get() = facetSettings("project_main")
|
||||
|
||||
internal val GradleImportingTestCase.testFacetSettings: KotlinFacetSettings
|
||||
internal val MultiplePluginVersionGradleImportingTestCase.testFacetSettings: KotlinFacetSettings
|
||||
get() = facetSettings("project_test")
|
||||
|
||||
internal fun GradleImportingTestCase.getSourceRootInfos(moduleName: String): List<Pair<String, JpsModuleSourceRootType<*>>> {
|
||||
internal fun MultiplePluginVersionGradleImportingTestCase.getSourceRootInfos(moduleName: String): List<Pair<String, JpsModuleSourceRootType<*>>> {
|
||||
return ModuleRootManager.getInstance(getModule(moduleName)).contentEntries.flatMap {
|
||||
it.sourceFolders.map { it.url.replace(projectPath, "") to it.rootType }
|
||||
}
|
||||
}
|
||||
|
||||
class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
class GradleFacetImportTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
|
||||
private fun assertSameKotlinSdks(vararg moduleNames: String) {
|
||||
val sdks = moduleNames.map { getModule(it).sdk!! }
|
||||
@@ -406,7 +406,7 @@ class GradleFacetImportTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.9")
|
||||
@PluginTargetVersions(gradleVersion = "4.9")
|
||||
fun testCommonImportByPlatformPlugin() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
|
||||
-468
@@ -1,468 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.kotlin.idea.codeInsight.gradle
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.application.Result
|
||||
import com.intellij.openapi.application.WriteAction
|
||||
import com.intellij.openapi.externalSystem.importing.ImportSpec
|
||||
import com.intellij.openapi.externalSystem.importing.ImportSpecBuilder
|
||||
import com.intellij.openapi.externalSystem.model.ProjectSystemId
|
||||
import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings
|
||||
import com.intellij.openapi.externalSystem.settings.ExternalProjectSettings
|
||||
import com.intellij.openapi.externalSystem.settings.ExternalSystemSettingsListenerAdapter
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.openapi.fileEditor.impl.LoadTextUtil
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager
|
||||
import com.intellij.openapi.projectRoots.JavaSdk
|
||||
import com.intellij.openapi.projectRoots.ProjectJdkTable
|
||||
import com.intellij.openapi.projectRoots.Sdk
|
||||
import com.intellij.openapi.projectRoots.impl.ProjectJdkTableImpl
|
||||
import com.intellij.openapi.projectRoots.impl.SdkConfigurationUtil
|
||||
import com.intellij.openapi.roots.ProjectRootManager
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import com.intellij.openapi.ui.TestDialog
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
|
||||
import com.intellij.testFramework.IdeaTestUtil
|
||||
import com.intellij.testFramework.RunAll
|
||||
import com.intellij.testFramework.VfsTestUtil
|
||||
import com.intellij.util.ArrayUtilRt
|
||||
import com.intellij.util.PathUtil
|
||||
import com.intellij.util.SmartList
|
||||
import com.intellij.util.ThrowableRunnable
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import junit.framework.TestCase
|
||||
import org.gradle.StartParameter
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.gradle.wrapper.GradleWrapperMain
|
||||
import org.gradle.wrapper.PathAssembler
|
||||
import org.intellij.lang.annotations.Language
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.idea.test.GradleProcessOutputInterceptor
|
||||
import org.jetbrains.kotlin.idea.test.KotlinSdkCreationChecker
|
||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||
import org.jetbrains.kotlin.idea.util.getProjectJdkTableSafe
|
||||
import org.jetbrains.kotlin.test.JUnitParameterizedWithIdeaConfigurationRunner
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.RunnerFactoryWithMuteInDatabase
|
||||
import org.jetbrains.plugins.gradle.settings.DistributionType
|
||||
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings
|
||||
import org.jetbrains.plugins.gradle.settings.GradleSettings
|
||||
import org.jetbrains.plugins.gradle.settings.GradleSystemSettings
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
import org.jetbrains.plugins.gradle.util.GradleUtil
|
||||
import org.jetbrains.plugins.groovy.GroovyFileType
|
||||
import org.junit.AfterClass
|
||||
import org.junit.Assume.assumeThat
|
||||
import org.junit.Assume.assumeTrue
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Rule
|
||||
import org.junit.rules.TestName
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.StringWriter
|
||||
import java.net.URISyntaxException
|
||||
import java.util.*
|
||||
import java.util.zip.ZipException
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
// part of org.jetbrains.plugins.gradle.importing.GradleImportingTestCase
|
||||
@RunWith(value = JUnitParameterizedWithIdeaConfigurationRunner::class)
|
||||
@Parameterized.UseParametersRunnerFactory(RunnerFactoryWithMuteInDatabase::class)
|
||||
abstract class GradleImportingTestCase : ExternalSystemImportingTestCase() {
|
||||
|
||||
protected var sdkCreationChecker: KotlinSdkCreationChecker? = null
|
||||
|
||||
private val removedSdks: MutableList<Sdk> = SmartList()
|
||||
|
||||
@JvmField
|
||||
@Rule
|
||||
var name = TestName()
|
||||
|
||||
@JvmField
|
||||
@Rule
|
||||
var testWatcher = ImportingTestWatcher()
|
||||
|
||||
@JvmField
|
||||
@Rule
|
||||
var versionMatcherRule = VersionMatcherRule()
|
||||
|
||||
@JvmField
|
||||
@Parameterized.Parameter
|
||||
var gradleVersion: String = ""
|
||||
|
||||
private lateinit var myProjectSettings: GradleProjectSettings
|
||||
private lateinit var myJdkHome: String
|
||||
|
||||
open fun isApplicableTest(): Boolean = true
|
||||
|
||||
open fun jvmHeapArgsByGradleVersion(version: String): String = when {
|
||||
version.startsWith("4.") ->
|
||||
// work-around due to memory leak in class loaders in gradle. The amount of used memory in the gradle daemon
|
||||
// is drammatically increased on every reimport of project due to sequential compilation of build scripts.
|
||||
// see more details in https://github.com/gradle/gradle/commit/b483d29f315758913791fe58d572fa6bafa0395c
|
||||
"-Xmx256m -XX:MaxPermSize=64m"
|
||||
else ->
|
||||
// 128M should be enough for gradle 5.0+ (leak is fixed), and <4.0 (amount of tests is less)
|
||||
"-Xms128M -Xmx256m -XX:MaxPermSize=64m"
|
||||
}
|
||||
|
||||
override fun setUp() {
|
||||
myJdkHome = IdeaTestUtil.requireRealJdkHome()
|
||||
super.setUp()
|
||||
assumeTrue(isApplicableTest())
|
||||
assumeThat(gradleVersion, versionMatcherRule.matcher)
|
||||
removedSdks.clear()
|
||||
runWrite {
|
||||
val jdkTable = getProjectJdkTableSafe()
|
||||
jdkTable.findJdk(GRADLE_JDK_NAME)?.let {
|
||||
jdkTable.removeJdk(it)
|
||||
}
|
||||
val jdkHomeDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(File(myJdkHome))!!
|
||||
val jdk = SdkConfigurationUtil.setupSdk(arrayOfNulls(0), jdkHomeDir, JavaSdk.getInstance(), true, null, GRADLE_JDK_NAME)
|
||||
TestCase.assertNotNull("Cannot create JDK for $myJdkHome", jdk)
|
||||
if (!jdkTable.allJdks.contains(jdk)) {
|
||||
(jdkTable as ProjectJdkTableImpl).addTestJdk(jdk!!, testRootDisposable)
|
||||
ProjectRootManager.getInstance(myProject).projectSdk = jdk
|
||||
}
|
||||
FileTypeManager.getInstance().associateExtension(GroovyFileType.GROOVY_FILE_TYPE, "gradle")
|
||||
|
||||
}
|
||||
myProjectSettings = GradleProjectSettings().apply {
|
||||
this.isUseQualifiedModuleNames = false
|
||||
}
|
||||
System.setProperty(ExternalSystemExecutionSettings.REMOTE_PROCESS_IDLE_TTL_IN_MS_KEY, GRADLE_DAEMON_TTL_MS.toString())
|
||||
|
||||
val distribution = WriteAction.computeAndWait<PathAssembler.LocalDistribution, Throwable> { configureWrapper() }
|
||||
|
||||
val allowedRoots = ArrayList<String>()
|
||||
collectAllowedRoots(allowedRoots, distribution)
|
||||
if (!allowedRoots.isEmpty()) {
|
||||
VfsRootAccess.allowRootAccess(myTestFixture.testRootDisposable, *ArrayUtilRt.toStringArray(allowedRoots))
|
||||
}
|
||||
|
||||
GradleSettings.getInstance(myProject).gradleVmOptions =
|
||||
"${jvmHeapArgsByGradleVersion(gradleVersion)} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${System.getProperty("user.dir")}"
|
||||
|
||||
sdkCreationChecker = KotlinSdkCreationChecker()
|
||||
|
||||
GradleProcessOutputInterceptor.install(testRootDisposable)
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
if (myJdkHome == null) {
|
||||
//super.setUp() wasn't called
|
||||
return
|
||||
}
|
||||
RunAll(
|
||||
ThrowableRunnable {
|
||||
runWrite {
|
||||
Arrays.stream(ProjectJdkTable.getInstance().allJdks).forEach { jdk: Sdk ->
|
||||
(ProjectJdkTable.getInstance() as ProjectJdkTableImpl).removeTestJdk(jdk)
|
||||
if (jdk is Disposable) {
|
||||
Disposer.dispose((jdk as Disposable))
|
||||
}
|
||||
}
|
||||
for (sdk in removedSdks) {
|
||||
SdkConfigurationUtil.addSdk(sdk)
|
||||
}
|
||||
removedSdks.clear()
|
||||
}
|
||||
},
|
||||
ThrowableRunnable {
|
||||
Messages.setTestDialog(TestDialog.DEFAULT)
|
||||
deleteBuildSystemDirectory()
|
||||
// was FileUtil.delete(BuildManager.getInstance().buildSystemDirectory.toFile())
|
||||
sdkCreationChecker?.removeNewKotlinSdk()
|
||||
},
|
||||
ThrowableRunnable {
|
||||
super.tearDown()
|
||||
}
|
||||
).run()
|
||||
}
|
||||
|
||||
override fun collectAllowedRoots(roots: MutableList<String>) {
|
||||
super.collectAllowedRoots(roots)
|
||||
roots.add(myJdkHome)
|
||||
roots.addAll(ExternalSystemTestCase.collectRootsInside(myJdkHome))
|
||||
roots.add(PathManager.getConfigPath())
|
||||
}
|
||||
|
||||
protected open fun collectAllowedRoots(
|
||||
roots: MutableList<String>,
|
||||
distribution: PathAssembler.LocalDistribution?
|
||||
) {
|
||||
//Note: could be required to use:
|
||||
//Environment.getEnvVariable("JAVA_HOME")
|
||||
roots.add(myJdkHome)
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
return if (name.methodName == null) super.getName() else FileUtil.sanitizeFileName(name.methodName)
|
||||
}
|
||||
|
||||
override fun getExternalSystemConfigFileName(): String = "build.gradle"
|
||||
|
||||
@Throws(IOException::class)
|
||||
protected open fun importProjectUsingSingeModulePerGradleProject(config: String? = null, skipIndexing: Boolean? = null) {
|
||||
currentExternalProjectSettings.isResolveModulePerSourceSet = false
|
||||
importProject(config, skipIndexing)
|
||||
}
|
||||
|
||||
open fun importProject() {
|
||||
importProject(skipIndexing = null)
|
||||
}
|
||||
|
||||
override fun importProject(skipIndexing: Boolean?) {
|
||||
ExternalSystemApiUtil.subscribe(
|
||||
myProject,
|
||||
GradleConstants.SYSTEM_ID,
|
||||
object : ExternalSystemSettingsListenerAdapter<ExternalProjectSettings>() {
|
||||
override fun onProjectsLinked(settings: Collection<ExternalProjectSettings>) {
|
||||
val item = ContainerUtil.getFirstItem<Any>(settings)
|
||||
if (item is GradleProjectSettings) {
|
||||
item.gradleJvm = GRADLE_JDK_NAME
|
||||
}
|
||||
}
|
||||
})
|
||||
super.importProject(skipIndexing)
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun importProject(@NonNls @Language("Groovy") config: String?, skipIndexing: Boolean?) {
|
||||
var config = config
|
||||
config = injectRepo(config)
|
||||
super.importProject(config, skipIndexing)
|
||||
}
|
||||
|
||||
override fun handleImportFailure(errorMessage: String, errorDetails: String?) {
|
||||
val gradleOutput = GradleProcessOutputInterceptor.getInstance()?.getOutput().orEmpty()
|
||||
|
||||
// Typically Gradle error message consists of a line with the description of the error followed by
|
||||
// a multi-line stacktrace. The idea is to cut off the stacktrace if it is already contained in
|
||||
// the intercepted Gradle process output to avoid unnecessary verbosity.
|
||||
val compactErrorMessage = when (val indexOfNewLine = errorMessage.indexOf('\n')) {
|
||||
-1 -> errorMessage
|
||||
else -> {
|
||||
val compactErrorMessage = errorMessage.substring(0, indexOfNewLine)
|
||||
val theRest = errorMessage.substring(indexOfNewLine + 1)
|
||||
if (theRest in gradleOutput) compactErrorMessage else errorMessage
|
||||
}
|
||||
}
|
||||
|
||||
val failureMessage = buildString {
|
||||
append("Gradle import failed: ").append(compactErrorMessage).append('\n')
|
||||
if (!errorDetails.isNullOrBlank()) append("Error details: ").append(errorDetails).append('\n')
|
||||
append("Gradle process output (BEGIN):\n")
|
||||
append(gradleOutput)
|
||||
if (!gradleOutput.endsWith('\n')) append('\n')
|
||||
append("Gradle process output (END)")
|
||||
}
|
||||
fail(failureMessage)
|
||||
}
|
||||
|
||||
protected open fun injectRepo(@NonNls @Language("Groovy") config: String?): String {
|
||||
var config = config ?: ""
|
||||
config = """allprojects {
|
||||
repositories {
|
||||
maven {
|
||||
url 'https://repo.labs.intellij.net/repo1'
|
||||
}
|
||||
}}
|
||||
$config"""
|
||||
return config
|
||||
}
|
||||
|
||||
|
||||
override fun createImportSpec(): ImportSpec? {
|
||||
val importSpecBuilder = ImportSpecBuilder(super.createImportSpec())
|
||||
importSpecBuilder.withArguments("--stacktrace")
|
||||
return importSpecBuilder.build()
|
||||
}
|
||||
|
||||
override fun getCurrentExternalProjectSettings(): GradleProjectSettings = myProjectSettings
|
||||
|
||||
override fun getExternalSystemId(): ProjectSystemId = GradleConstants.SYSTEM_ID
|
||||
|
||||
@Throws(IOException::class)
|
||||
protected open fun createSettingsFile(@NonNls @Language("Groovy") content: String?): VirtualFile? {
|
||||
return createProjectSubFile("settings.gradle", content)
|
||||
}
|
||||
|
||||
@Throws(IOException::class, URISyntaxException::class)
|
||||
private fun configureWrapper(): PathAssembler.LocalDistribution {
|
||||
val distributionUri = AbstractModelBuilderTest.DistributionLocator().getDistributionFor(GradleVersion.version(gradleVersion))
|
||||
|
||||
myProjectSettings.distributionType = DistributionType.DEFAULT_WRAPPED
|
||||
val wrapperJarFrom = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wrapperJar())!!
|
||||
|
||||
val wrapperJarFromTo = createProjectSubFile("gradle/wrapper/gradle-wrapper.jar")
|
||||
runWrite {
|
||||
wrapperJarFromTo.setBinaryContent(wrapperJarFrom.contentsToByteArray())
|
||||
}
|
||||
|
||||
val properties = Properties()
|
||||
properties.setProperty("distributionBase", "GRADLE_USER_HOME")
|
||||
properties.setProperty("distributionPath", "wrapper/dists")
|
||||
properties.setProperty("zipStoreBase", "GRADLE_USER_HOME")
|
||||
properties.setProperty("zipStorePath", "wrapper/dists")
|
||||
properties.setProperty("distributionUrl", distributionUri.toString())
|
||||
|
||||
val writer = StringWriter()
|
||||
properties.store(writer, null)
|
||||
|
||||
createProjectSubFile("gradle/wrapper/gradle-wrapper.properties", writer.toString())
|
||||
|
||||
val wrapperConfiguration =
|
||||
GradleUtil.getWrapperConfiguration(projectPath)
|
||||
val localDistribution = PathAssembler(
|
||||
StartParameter.DEFAULT_GRADLE_USER_HOME
|
||||
).getDistribution(wrapperConfiguration)
|
||||
|
||||
val zip = localDistribution.zipFile
|
||||
try {
|
||||
if (zip.exists()) {
|
||||
val zipFile = ZipFile(zip)
|
||||
zipFile.close()
|
||||
}
|
||||
} catch (e: ZipException) {
|
||||
e.printStackTrace()
|
||||
println("Corrupted file will be removed: " + zip.path)
|
||||
FileUtil.delete(zip)
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return localDistribution
|
||||
}
|
||||
|
||||
protected open fun testDataDirName(): String = ""
|
||||
|
||||
protected open fun testDataDirectory(): File {
|
||||
val baseDir = "${PluginTestCaseBase.getTestDataPathBase()}/gradle/${testDataDirName()}/"
|
||||
return File(baseDir, getTestName(true).substringBefore("_"))
|
||||
}
|
||||
|
||||
protected fun configureKotlinVersionAndProperties(text: String, properties: Map<String, String>? = null): String {
|
||||
var result = text
|
||||
(properties ?: mapOf("kotlin_plugin_version" to LATEST_STABLE_GRADLE_PLUGIN_VERSION)).forEach { (key, value) ->
|
||||
result = result.replace("{{${key}}}", value)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
protected open fun configureByFiles(properties: Map<String, String>? = null): List<VirtualFile> {
|
||||
val rootDir = testDataDirectory()
|
||||
assert(rootDir.exists()) { "Directory ${rootDir.path} doesn't exist" }
|
||||
|
||||
return rootDir.walk().mapNotNull {
|
||||
when {
|
||||
it.isDirectory -> null
|
||||
|
||||
!it.name.endsWith(SUFFIX) -> {
|
||||
val text = configureKotlinVersionAndProperties(FileUtil.loadFile(it, /* convertLineSeparators = */ true), properties)
|
||||
val virtualFile = createProjectSubFile(it.path.substringAfter(rootDir.path + File.separator), text)
|
||||
|
||||
// Real file with expected testdata allows to throw nicer exceptions in
|
||||
// case of mismatch, as well as open interactive diff window in IDEA
|
||||
virtualFile.putUserData(VfsTestUtil.TEST_DATA_FILE_PATH, it.absolutePath)
|
||||
|
||||
virtualFile
|
||||
}
|
||||
|
||||
else -> null
|
||||
}
|
||||
}.toList()
|
||||
}
|
||||
|
||||
protected fun importProjectFromTestData(skipIndexing: Boolean? = null): List<VirtualFile> {
|
||||
val files = configureByFiles()
|
||||
importProject(skipIndexing)
|
||||
return files
|
||||
}
|
||||
|
||||
protected fun checkFiles(files: List<VirtualFile>) {
|
||||
FileDocumentManager.getInstance().saveAllDocuments()
|
||||
|
||||
files.filter {
|
||||
it.name == GradleConstants.DEFAULT_SCRIPT_NAME
|
||||
|| it.name == GradleConstants.KOTLIN_DSL_SCRIPT_NAME
|
||||
|| it.name == GradleConstants.SETTINGS_FILE_NAME
|
||||
}
|
||||
.forEach {
|
||||
if (it.name == GradleConstants.SETTINGS_FILE_NAME && !File(testDataDirectory(), it.name + SUFFIX).exists()) return@forEach
|
||||
val actualText = configureKotlinVersionAndProperties(LoadTextUtil.loadText(it).toString())
|
||||
val expectedFileName = if (File(testDataDirectory(), it.name + ".$gradleVersion" + SUFFIX).exists()) {
|
||||
it.name + ".$gradleVersion" + SUFFIX
|
||||
} else {
|
||||
it.name + SUFFIX
|
||||
}
|
||||
KotlinTestUtils.assertEqualsToFile(File(testDataDirectory(), expectedFileName), actualText)
|
||||
{ s -> configureKotlinVersionAndProperties(s) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun runWrite(f: () -> Unit) {
|
||||
object : WriteAction<Any>() {
|
||||
override fun run(result: Result<Any>) {
|
||||
f()
|
||||
}
|
||||
}.execute()
|
||||
}
|
||||
|
||||
protected open fun enableGradleDebugWithSuspend() {
|
||||
GradleSystemSettings.getInstance().gradleVmOptions = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val GRADLE_JDK_NAME = "Gradle JDK"
|
||||
private const val GRADLE_DAEMON_TTL_MS = 10000
|
||||
|
||||
@JvmStatic
|
||||
protected val SUFFIX = ".after"
|
||||
|
||||
@JvmStatic
|
||||
@Parameterized.Parameters(name = "{index}: with Gradle-{0}")
|
||||
fun data(): Collection<Array<Any>> {
|
||||
return listOf(*AbstractModelBuilderTest.SUPPORTED_GRADLE_VERSIONS)
|
||||
}
|
||||
|
||||
fun wrapperJar(): File {
|
||||
return File(PathUtil.getJarPathForClass(GradleWrapperMain::class.java))
|
||||
}
|
||||
|
||||
private var logSaver: GradleImportingTestLogSaver? = null
|
||||
|
||||
@JvmStatic
|
||||
@BeforeClass
|
||||
fun setLoggerFactory() {
|
||||
logSaver = GradleImportingTestLogSaver()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@AfterClass
|
||||
fun restoreLoggerFactory() {
|
||||
logSaver?.restore()
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-9
@@ -23,15 +23,16 @@ import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.testFramework.runInEdtAndWait
|
||||
import org.jetbrains.kotlin.idea.inspections.gradle.DifferentKotlinGradleVersionInspection
|
||||
import org.jetbrains.kotlin.idea.inspections.runInspection
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
class GradleInspectionTest : GradleImportingTestCase() {
|
||||
class GradleInspectionTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
|
||||
// Disable gradle inspection tests in AndroidStudio as they are disabled in distribution
|
||||
override fun isApplicableTest(): Boolean = isGradleInspectionTestApplicable()
|
||||
override fun isApplicableTest(): Boolean = isGradleInspectionTestApplicable() && super.isApplicableTest()
|
||||
|
||||
|
||||
@Test
|
||||
@@ -71,10 +72,14 @@ class GradleInspectionTest : GradleImportingTestCase() {
|
||||
val problems = getInspectionResultFromTestDataProject()
|
||||
|
||||
Assert.assertEquals(1, problems.size)
|
||||
Assert.assertEquals("Plugin version ($LATEST_STABLE_GRADLE_PLUGIN_VERSION) is not the same as library version (1.3.30)", problems.single())
|
||||
Assert.assertEquals(
|
||||
"Plugin version ($gradleKotlinPluginVersion) is not the same as library version (1.3.30)",
|
||||
problems.single()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(pluginVersion = "<1.5.20")
|
||||
fun testDifferentKotlinGradleVersion() {
|
||||
val tool = DifferentKotlinGradleVersionInspection()
|
||||
tool.testVersionMessage = "\$PLUGIN_VERSION"
|
||||
@@ -82,20 +87,20 @@ class GradleInspectionTest : GradleImportingTestCase() {
|
||||
|
||||
Assert.assertEquals(1, problems.size)
|
||||
Assert.assertEquals(
|
||||
"Kotlin version that is used for building with Gradle ($LATEST_STABLE_GRADLE_PLUGIN_VERSION) differs from the one bundled into the IDE plugin (\$PLUGIN_VERSION)",
|
||||
"Kotlin version that is used for building with Gradle ($gradleKotlinPluginVersion) differs from the one bundled into the IDE plugin (\$PLUGIN_VERSION)",
|
||||
problems.single()
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.9")
|
||||
@PluginTargetVersions(gradleVersion = "4.9")
|
||||
fun testJreInOldVersion() {
|
||||
val problems = getInspectionResultFromTestDataProject()
|
||||
Assert.assertTrue("The inspection result should be empty but contains the following elements: [$problems].", problems.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.9")
|
||||
@PluginTargetVersions(gradleVersion = "4.9")
|
||||
fun testJreIsDeprecated() {
|
||||
val problems = getInspectionResultFromTestDataProject()
|
||||
|
||||
@@ -107,7 +112,7 @@ class GradleInspectionTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.9")
|
||||
@PluginTargetVersions(gradleVersion = "4.9")
|
||||
fun testJreIsDeprecatedWithImplementation() {
|
||||
val problems = getInspectionResultFromTestDataProject()
|
||||
|
||||
@@ -118,7 +123,7 @@ class GradleInspectionTest : GradleImportingTestCase() {
|
||||
)
|
||||
}
|
||||
|
||||
@TargetVersions("4.9")
|
||||
@PluginTargetVersions(gradleVersion = "4.9")
|
||||
@Test
|
||||
fun testJreIsDeprecatedWithoutImplicitVersion() {
|
||||
val problems = getInspectionResultFromTestDataProject()
|
||||
@@ -145,7 +150,7 @@ class GradleInspectionTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.9")
|
||||
@PluginTargetVersions(gradleVersion = "4.9")
|
||||
fun testObsoleteCoroutinesUsage() {
|
||||
val problems = getInspectionResultFromTestDataProject()
|
||||
|
||||
|
||||
+6
-11
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.idea.codeInsight.gradle
|
||||
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.testFramework.Parameterized
|
||||
import junit.framework.AssertionFailedError
|
||||
import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
|
||||
@@ -21,19 +22,13 @@ import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition
|
||||
import org.jetbrains.kotlin.scripting.resolve.ScriptCompilationConfigurationWrapper
|
||||
import org.jetbrains.kotlin.test.JUnitParameterizedWithIdeaConfigurationRunner
|
||||
import org.jetbrains.plugins.gradle.settings.GradleSettings
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized.Parameters
|
||||
import java.io.File
|
||||
|
||||
@RunWith(value = JUnitParameterizedWithIdeaConfigurationRunner::class)
|
||||
class GradleKtsImportTest : GradleImportingTestCase() {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@Parameters(name = "{index}: with Gradle-{0}")
|
||||
fun data(): Collection<Array<Any?>> = listOf(arrayOf<Any?>("6.0.1"))
|
||||
}
|
||||
class GradleKtsImportTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
|
||||
val scriptConfigurationManager get() = ScriptConfigurationManager.getInstance(myProject) as CompositeScriptConfigurationManager
|
||||
val projectDir get() = File(GradleSettings.getInstance(myProject).linkedProjectsSettings.first().externalProjectPath)
|
||||
@@ -47,7 +42,7 @@ class GradleKtsImportTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("6.0.1+")
|
||||
@PluginTargetVersions(gradleVersion = "6.0.1+")
|
||||
fun testEmpty() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
@@ -56,7 +51,7 @@ class GradleKtsImportTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("6.0.1+")
|
||||
@PluginTargetVersions(gradleVersion = "6.0.1+")
|
||||
fun testError() {
|
||||
configureByFiles()
|
||||
|
||||
@@ -72,7 +67,7 @@ class GradleKtsImportTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("6.0.1+")
|
||||
@PluginTargetVersions(gradleVersion = "6.0.1+")
|
||||
fun testCompositeBuild() {
|
||||
configureByFiles()
|
||||
importProject()
|
||||
|
||||
+10
-10
@@ -16,15 +16,15 @@ import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinMigrationProjectService
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinMigrationProjectService.MigrationTestState
|
||||
import org.jetbrains.kotlin.idea.configuration.MigrationInfo
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.TimeoutException
|
||||
|
||||
class GradleMigrateTest : GradleImportingTestCase() {
|
||||
class GradleMigrateTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
@Test
|
||||
@TargetVersions("5.3+")
|
||||
@PluginTargetVersions(gradleVersion = "5.3+", pluginVersion = "1.4.0+")
|
||||
fun testMigrateStdlib() {
|
||||
val migrateComponentState = doMigrationTest(
|
||||
beforeText = """
|
||||
@@ -44,37 +44,37 @@ class GradleMigrateTest : GradleImportingTestCase() {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:1.3.40"
|
||||
}
|
||||
""",
|
||||
//ToDo: Change 1.4-M3 to 1.4.0 version after release
|
||||
afterText =
|
||||
"""
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0-rc"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$gradleKotlinPluginVersion"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:1.4.0-rc"
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$gradleKotlinPluginVersion"
|
||||
}
|
||||
"""
|
||||
)
|
||||
|
||||
Assert.assertEquals(false, migrateComponentState?.hasApplicableTools)
|
||||
|
||||
val newLanguageVersion = LanguageVersion.fromFullVersionString(gradleKotlinPluginVersion)!!
|
||||
Assert.assertEquals(
|
||||
MigrationInfo.create(
|
||||
oldStdlibVersion = "1.3.40",
|
||||
oldApiVersion = ApiVersion.KOTLIN_1_3,
|
||||
oldLanguageVersion = LanguageVersion.KOTLIN_1_3,
|
||||
newStdlibVersion = "1.4.0-rc",
|
||||
newApiVersion = ApiVersion.KOTLIN_1_4,
|
||||
newLanguageVersion = LanguageVersion.KOTLIN_1_4
|
||||
newStdlibVersion = gradleKotlinPluginVersion,
|
||||
newApiVersion = ApiVersion.createByLanguageVersion(newLanguageVersion),
|
||||
newLanguageVersion = newLanguageVersion
|
||||
),
|
||||
migrateComponentState?.migrationInfo
|
||||
)
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.junit.Test
|
||||
import java.io.File
|
||||
import kotlin.reflect.KMutableProperty0
|
||||
|
||||
class GradleQuickFixTest : GradleImportingTestCase() {
|
||||
class GradleQuickFixTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
private lateinit var codeInsightTestFixture: CodeInsightTestFixture
|
||||
|
||||
override fun testDataDirName() = "fixes"
|
||||
|
||||
+6
-1
@@ -18,26 +18,31 @@ import org.jetbrains.kotlin.gradle.GradleDaemonAnalyzerTestCase
|
||||
import org.jetbrains.kotlin.gradle.checkFiles
|
||||
import org.jetbrains.kotlin.test.TagsTestDataUtil
|
||||
import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
class GradleTestRunConfigurationAndHighlightingTest : GradleImportingTestCase() {
|
||||
class GradleTestRunConfigurationAndHighlightingTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testExpectClassWithTests() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun preferredConfigurations() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun multiplatformTestsInObject() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
@Test
|
||||
@PluginTargetVersions(skipForMaster = true)
|
||||
fun testMultiprojectBuild() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
+3
-3
@@ -15,12 +15,12 @@ import org.jetbrains.kotlin.idea.run.getConfiguration
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer
|
||||
import org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Test
|
||||
|
||||
class GradleTestRunConfigurationCustomTest : GradleImportingTestCase() {
|
||||
class GradleTestRunConfigurationCustomTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
@Test
|
||||
@TargetVersions("4.7+")
|
||||
@PluginTargetVersions(gradleVersion = "4.7+", skipForMaster = true)
|
||||
fun testPreferredConfigurations() {
|
||||
if (!PlatformUtils.isIntelliJ()) {
|
||||
return
|
||||
|
||||
+7
-7
@@ -25,12 +25,12 @@ import com.intellij.testFramework.fixtures.CodeInsightTestFixture
|
||||
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory
|
||||
import com.intellij.testFramework.runInEdtAndWait
|
||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
import kotlin.reflect.KMutableProperty0
|
||||
|
||||
class GradleUpdateConfigurationQuickFixTest : GradleImportingTestCase() {
|
||||
class GradleUpdateConfigurationQuickFixTest : MultiplePluginVersionGradleImportingTestCase() {
|
||||
private lateinit var codeInsightTestFixture: CodeInsightTestFixture
|
||||
|
||||
fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/gradle/languageFeature/" + getTestName(true).substringBefore('_')
|
||||
@@ -49,25 +49,25 @@ class GradleUpdateConfigurationQuickFixTest : GradleImportingTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.7 <=> 6.0")
|
||||
@PluginTargetVersions(gradleVersion = "4.7 <=> 6.0")
|
||||
fun testUpdateLanguageVersion() {
|
||||
doTest("Set module language version to 1.1")
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.7 <=> 6.0")
|
||||
@PluginTargetVersions(gradleVersion = "4.7 <=> 6.0")
|
||||
fun testUpdateApiVersion() {
|
||||
doTest("Set module API version to 1.1")
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.7 <=> 6.0")
|
||||
@PluginTargetVersions(gradleVersion = "4.7 <=> 6.0")
|
||||
fun testUpdateLanguageAndApiVersion() {
|
||||
doTest("Set module language version to 1.1")
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("4.7 <=> 6.0")
|
||||
@PluginTargetVersions(gradleVersion = "4.7 <=> 6.0")
|
||||
fun testAddKotlinReflect() {
|
||||
doTest("Add 'kotlin-reflect.jar' to the classpath")
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class GradleUpdateConfigurationQuickFixTest : GradleImportingTestCase() {
|
||||
private fun doTest(intentionName: String) {
|
||||
val buildGradleVFile = createProjectSubFile("build.gradle", File(getTestDataPath(), "build.gradle").readText())
|
||||
val sourceVFile = createProjectSubFile("src/main/kotlin/src.kt", File(getTestDataPath(), "src.kt").readText())
|
||||
importProject()
|
||||
importProject(false)
|
||||
runInEdtAndWait {
|
||||
codeInsightTestFixture.configureFromExistingVirtualFile(sourceVFile)
|
||||
codeInsightTestFixture.launchAction(codeInsightTestFixture.findSingleIntention(intentionName))
|
||||
|
||||
+21
-23
@@ -102,7 +102,9 @@ abstract class MultiplePluginVersionGradleImportingTestCase : ExternalSystemImpo
|
||||
|
||||
@JvmField
|
||||
@Parameterized.Parameter(1)
|
||||
var gradleKotlinPluginVersion: String = ""
|
||||
var gradleKotlinPluginParameter: String = ""
|
||||
|
||||
open val gradleKotlinPluginVersion: String get() = if (gradleKotlinPluginParameter == "master") MASTER_VERSION_OF_PLUGIN else gradleKotlinPluginParameter
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
@@ -133,7 +135,7 @@ abstract class MultiplePluginVersionGradleImportingTestCase : ExternalSystemImpo
|
||||
"-Xmx256m -XX:MaxPermSize=64m"
|
||||
else ->
|
||||
// 128M should be enough for gradle 5.0+ (leak is fixed), and <4.0 (amount of tests is less)
|
||||
"-Xms128M -Xmx192m -XX:MaxPermSize=64m"
|
||||
"-Xms128M -Xmx256m -XX:MaxPermSize=64m"
|
||||
}
|
||||
|
||||
override fun setUp() {
|
||||
@@ -443,23 +445,19 @@ abstract class MultiplePluginVersionGradleImportingTestCase : ExternalSystemImpo
|
||||
private fun getDefaultPropertiesMap(): Map<String, String> {
|
||||
val defaultProperties = HashMap<String, String>()
|
||||
defaultProperties["kotlin_plugin_version"] = gradleKotlinPluginVersion
|
||||
defaultProperties["kotlin_plugin_repositories"] = repositories(false)
|
||||
defaultProperties["kts_kotlin_plugin_repositories"] = repositories(true)
|
||||
defaultProperties["kotlin_plugin_repositories"] = repositories()
|
||||
defaultProperties["kts_kotlin_plugin_repositories"] = repositories()
|
||||
|
||||
return defaultProperties
|
||||
}
|
||||
|
||||
private fun repositories(useKts: Boolean): String {
|
||||
val customRepositories = arrayOf(
|
||||
"https://dl.bintray.com/kotlin/kotlin-dev",
|
||||
)
|
||||
val customMavenRepositories = customRepositories.joinToString("\n") { if (useKts) "maven(\"$it\")" else "maven { url '$it' } " }
|
||||
private fun repositories(): String {
|
||||
return """
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
jcenter()
|
||||
$customMavenRepositories
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
@@ -476,6 +474,7 @@ abstract class MultiplePluginVersionGradleImportingTestCase : ExternalSystemImpo
|
||||
|
||||
const val RELEASED_A_YEAR_AGO_GRADLE_PLUGIN_VERSION = "1.3.72"
|
||||
const val LATEST_STABLE_RELEASE_GRADLE_PLUGIN_VERSION = "1.4.30"
|
||||
|
||||
val MASTER_VERSION_OF_PLUGIN
|
||||
get() = File("libraries/tools/kotlin-gradle-plugin/build/libs").listFiles()?.map { it.name }
|
||||
?.firstOrNull { it.contains("-original.jar") }?.replace(
|
||||
@@ -485,13 +484,13 @@ abstract class MultiplePluginVersionGradleImportingTestCase : ExternalSystemImpo
|
||||
|
||||
const val LATEST_SUPPORTED_GRADLE_VERSION = "6.5.1"
|
||||
|
||||
val SUPPORTED_GRADLE_VERSIONS = arrayOf("4.9", "5.6.4", LATEST_SUPPORTED_GRADLE_VERSION)
|
||||
val SUPPORTED_GRADLE_VERSIONS = arrayOf("4.9", "6.1.1", LATEST_SUPPORTED_GRADLE_VERSION)
|
||||
|
||||
private val LOCAL_RUN_PARAMS: Array<Any> =
|
||||
System.getenv("IMPORTING_TESTS_LOCAL_RUN_PARAMS") // You can specify versions for local run. For example: "6.7.1:1.4.30"
|
||||
?.replace(" ", "")
|
||||
?.split(":")?.toTypedArray()
|
||||
?: arrayOf(LATEST_SUPPORTED_GRADLE_VERSION, MASTER_VERSION_OF_PLUGIN)
|
||||
?: arrayOf(LATEST_SUPPORTED_GRADLE_VERSION, "master")
|
||||
|
||||
private val isTeamcityBuild = UsefulTestCase.IS_UNDER_TEAMCITY
|
||||
|
||||
@@ -499,17 +498,16 @@ abstract class MultiplePluginVersionGradleImportingTestCase : ExternalSystemImpo
|
||||
@Parameterized.Parameters(name = "{index}: Gradle-{0}, KotlinGradlePlugin-{1}")
|
||||
fun data(): Collection<Array<Any>> {
|
||||
if (isTeamcityBuild)
|
||||
return listOf(LOCAL_RUN_PARAMS)
|
||||
|
||||
return (SUPPORTED_GRADLE_VERSIONS).flatMap { gradleVersion ->
|
||||
arrayOf(
|
||||
RELEASED_A_YEAR_AGO_GRADLE_PLUGIN_VERSION,
|
||||
LATEST_STABLE_RELEASE_GRADLE_PLUGIN_VERSION,
|
||||
MASTER_VERSION_OF_PLUGIN
|
||||
).map { pluginVersion ->
|
||||
arrayOf(gradleVersion, pluginVersion)
|
||||
return (SUPPORTED_GRADLE_VERSIONS).flatMap { gradleVersion ->
|
||||
arrayOf(
|
||||
RELEASED_A_YEAR_AGO_GRADLE_PLUGIN_VERSION,
|
||||
LATEST_STABLE_RELEASE_GRADLE_PLUGIN_VERSION,
|
||||
"master"
|
||||
).map { pluginVersion ->
|
||||
arrayOf(gradleVersion, pluginVersion)
|
||||
}
|
||||
}
|
||||
}
|
||||
return listOf(LOCAL_RUN_PARAMS)
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -12,7 +12,7 @@ import com.intellij.execution.actions.ConfigurationFromContext
|
||||
import org.jetbrains.kotlin.gradle.GradleDaemonAnalyzerTestCase
|
||||
import org.jetbrains.kotlin.test.TagsTestDataUtil
|
||||
import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions
|
||||
import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions
|
||||
import org.junit.Test
|
||||
|
||||
class NativeRunConfigurationTest : MasterPluginVersionGradleImportingTestCase() {
|
||||
@@ -20,13 +20,13 @@ class NativeRunConfigurationTest : MasterPluginVersionGradleImportingTestCase()
|
||||
override fun testDataDirName(): String = "nativeRunConfiguration"
|
||||
|
||||
@Test
|
||||
@TargetVersions("6.0+")
|
||||
@PluginTargetVersions(gradleVersion = "6.0+")
|
||||
fun multiplatformNativeRunGutter() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
@Test
|
||||
@TargetVersions("6.0+")
|
||||
@PluginTargetVersions(gradleVersion = "6.0+")
|
||||
fun customEntryPointWithoutRunGutter() {
|
||||
doTest()
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,6 +12,7 @@ apply plugin: "kotlin"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,6 +12,7 @@ apply plugin: "kotlin"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,6 +12,7 @@ apply plugin: "kotlin"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,6 +12,7 @@ apply plugin: "kotlin"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,6 +12,7 @@ apply plugin: "kotlin"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,6 +12,7 @@ apply plugin: "kotlin"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib"
|
||||
|
||||
+2
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,6 +12,7 @@ apply plugin: "kotlin-multiplatform"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
kotlin {
|
||||
targets {
|
||||
|
||||
+2
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,6 +12,7 @@ apply plugin: "kotlin-multiplatform"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
kotlin {
|
||||
targets {
|
||||
|
||||
Vendored
+5
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,8 +12,12 @@ apply plugin: "kotlin-multiplatform"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
kotlin {
|
||||
targets {
|
||||
fromPreset(presets.jvm, 'jvm')
|
||||
}
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
|
||||
+5
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,8 +12,12 @@ apply plugin: "kotlin-multiplatform"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
kotlin {
|
||||
targets {
|
||||
fromPreset(presets.jvm, 'jvm')
|
||||
}
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
|
||||
+2
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,6 +12,7 @@ apply plugin: "kotlin"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib"
|
||||
|
||||
Vendored
+2
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
@@ -11,6 +12,7 @@ apply plugin: "kotlin"
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib"
|
||||
|
||||
@@ -2,6 +2,7 @@ buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
|
||||
|
||||
@@ -4,6 +4,7 @@ version '1.0-SNAPSHOT'
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -4,6 +4,7 @@ version '1.0-SNAPSHOT'
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -5,7 +5,7 @@ version '1.0-SNAPSHOT'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
{{kotlin_plugin_repositories}}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ version '1.0-SNAPSHOT'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
{{kotlin_plugin_repositories}}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ version '1.0-SNAPSHOT'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
{{kotlin_plugin_repositories}}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ version '1.0-SNAPSHOT'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
{{kotlin_plugin_repositories}}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
kotlin("multiplatform") version "1.3.60"
|
||||
kotlin("multiplatform") version "{{kotlin_plugin_version}}"
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
kotlin("multiplatform") version "1.3.60"
|
||||
kotlin("multiplatform") version "{{kotlin_plugin_version}}"
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.multiplatform' version '1.3.61'
|
||||
id 'org.jetbrains.kotlin.multiplatform' version '{{kotlin_plugin_version}}'
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
|
||||
id 'org.jetbrains.kotlin.jvm' version '{{kotlin_plugin_version}}'
|
||||
id "org.jetbrains.gradle.plugin.idea-ext" version "0.7"
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.multiplatform' version '1.3.61'
|
||||
id 'org.jetbrains.kotlin.multiplatform' version '{{kotlin_plugin_version}}'
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.multiplatform' version '1.3.61'
|
||||
id 'org.jetbrains.kotlin.multiplatform' version '{{kotlin_plugin_version}}'
|
||||
}
|
||||
|
||||
group 'org.example'
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.3.50'
|
||||
id 'org.jetbrains.kotlin.jvm' version '{{kotlin_plugin_version}}'
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
Reference in New Issue
Block a user