From 2c29957cb873881a5b1aa2e6844378a9a3a22677 Mon Sep 17 00:00:00 2001 From: Alexander Dudinsky Date: Fri, 12 Feb 2021 15:55:58 +0300 Subject: [PATCH] Move tests from GradleImportingTestCase to MultiplePluginVersionGradleImportingTestCase --- .../GradleNativeLibrariesInIDENamingTest.kt | 10 +- .../GradleNativeLibrariesPropagationTest.kt | 11 +- .../gradle/TestCaseWithFakeKotlinNative.kt | 4 +- .../GradleMultiplatformHighlightingTest.kt | 5 +- ...chicalMultiplatformProjectImportingTest.kt | 30 +- .../kotlin/gradle/ImportAndCheckNavigation.kt | 3 +- .../kotlin/gradle/KaptImportingTest.kt | 5 +- .../MultiplatformProjectImportingTest.kt | 23 +- ...ewMultiplatformKaptProjectImportingTest.kt | 5 +- .../NewMultiplatformProjectImportingTest.kt | 39 +- .../gradle/PackagePrefixImportingTest.kt | 3 +- .../gradle/GradleBuildFileHighlightingTest.kt | 7 +- .../GradleConfiguratorPlatformSpecificTest.kt | 26 +- .../gradle/GradleConfiguratorTest.kt | 49 +- .../gradle/GradleFacetImportTest.kt | 14 +- .../gradle/GradleImportingTestCase.kt | 468 ------------------ .../gradle/GradleInspectionTest.kt | 23 +- .../codeInsight/gradle/GradleKtsImportTest.kt | 17 +- .../codeInsight/gradle/GradleMigrateTest.kt | 20 +- .../codeInsight/gradle/GradleQuickFixTest.kt | 2 +- ...TestRunConfigurationAndHighlightingTest.kt | 7 +- .../GradleTestRunConfigurationCustomTest.kt | 6 +- .../GradleUpdateConfigurationQuickFixTest.kt | 14 +- ...plePluginVersionGradleImportingTestCase.kt | 44 +- .../gradle/NativeRunConfigurationTest.kt | 6 +- .../addLanguageVersion/build.gradle | 1 + .../addLanguageVersion/build.gradle.after | 1 + .../configurator/addLibrary/build.gradle | 1 + .../addLibrary/build.gradle.after | 1 + .../changeFeatureSupport/build.gradle | 2 + .../changeFeatureSupport/build.gradle.after | 2 + .../changeLanguageVersion/build.gradle | 1 + .../changeLanguageVersion/build.gradle.after | 1 + .../disableFeatureSupport/build.gradle | 2 + .../disableFeatureSupport/build.gradle.after | 2 + .../enableFeatureSupport/build.gradle | 2 + .../enableFeatureSupport/build.gradle.after | 2 + .../build.gradle | 2 + .../build.gradle.after | 2 + .../build.gradle | 5 + .../build.gradle.after | 5 + .../build.gradle | 2 + .../build.gradle.after | 2 + .../projectWithModule/app/build.gradle | 1 + .../updateKotlinxCoroutines/build.gradle | 1 + .../build.gradle.after | 1 + .../differentKotlinGradleVersion/build.gradle | 2 +- .../build.gradle | 2 +- .../build.gradle | 2 +- .../build.gradle | 2 +- .../commonIOS/build.gradle.kts | 2 +- .../build.gradle.kts | 2 +- .../expectClassWithTests/build.gradle | 2 +- .../kotlinJUnitSettings/build.gradle | 2 +- .../multiplatformTestsInObject/build.gradle | 2 +- .../multiprojectBuild/build.gradle | 2 +- .../preferredConfigurations/build.gradle | 2 +- 57 files changed, 232 insertions(+), 670 deletions(-) delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleImportingTestCase.kt diff --git a/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesInIDENamingTest.kt b/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesInIDENamingTest.kt index 5a377c0e71b..8ac87b3ee14 100644 --- a/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesInIDENamingTest.kt +++ b/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesInIDENamingTest.kt @@ -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_]+)\\])?$") diff --git a/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesPropagationTest.kt b/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesPropagationTest.kt index b1b55cef64b..eb169d04f2f 100644 --- a/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesPropagationTest.kt +++ b/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesPropagationTest.kt @@ -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")) - } } diff --git a/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/TestCaseWithFakeKotlinNative.kt b/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/TestCaseWithFakeKotlinNative.kt index c7f400f4c55..57eb4908960 100644 --- a/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/TestCaseWithFakeKotlinNative.kt +++ b/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/TestCaseWithFakeKotlinNative.kt @@ -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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformHighlightingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformHighlightingTest.kt index 6b07e484da8..2ed82fc00c9 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformHighlightingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformHighlightingTest.kt @@ -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() } diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt index 5130be92a4e..c232c296965 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt @@ -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 } } diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/ImportAndCheckNavigation.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/ImportAndCheckNavigation.kt index aff59ca338f..7f369c4d627 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/ImportAndCheckNavigation.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/ImportAndCheckNavigation.kt @@ -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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt index 8fc38ae0b0f..7c73010fd8f 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt @@ -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) diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt index 871d1aabff8..a6fff848813 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt @@ -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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformKaptProjectImportingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformKaptProjectImportingTest.kt index b5411592a74..c265583e597 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformKaptProjectImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformKaptProjectImportingTest.kt @@ -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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt index d1efdb7fa8d..94f3e6d0b09 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt @@ -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) diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt index e4e4bb1f4bc..795ab61e6a5 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt @@ -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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleBuildFileHighlightingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleBuildFileHighlightingTest.kt index c31df619a8e..cdc16e94406 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleBuildFileHighlightingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleBuildFileHighlightingTest.kt @@ -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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt index 906155fad20..289c92f2772 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt @@ -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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorTest.kt index c7eddc94574..0d32145ba8e 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorTest.kt @@ -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() { """

The compiler bundled to Kotlin plugin (1.0.0) is older than external compiler used for building modules:

This may cause different set of errors and warnings reported in IDE.

Update Ignore

@@ -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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt index 66788567837..77605d23d5c 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt @@ -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>> { +internal fun MultiplePluginVersionGradleImportingTestCase.getSourceRootInfos(moduleName: String): List>> { 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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleImportingTestCase.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleImportingTestCase.kt deleted file mode 100644 index 9aaa36c6ff2..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleImportingTestCase.kt +++ /dev/null @@ -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 = 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 { configureWrapper() } - - val allowedRoots = ArrayList() - 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) { - super.collectAllowedRoots(roots) - roots.add(myJdkHome) - roots.addAll(ExternalSystemTestCase.collectRootsInside(myJdkHome)) - roots.add(PathManager.getConfigPath()) - } - - protected open fun collectAllowedRoots( - roots: MutableList, - 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() { - override fun onProjectsLinked(settings: Collection) { - val item = ContainerUtil.getFirstItem(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? = 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? = null): List { - 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 { - val files = configureByFiles() - importProject(skipIndexing) - return files - } - - protected fun checkFiles(files: List) { - 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() { - override fun run(result: Result) { - 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> { - 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() - } - } -} diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTest.kt index dcc38fa276b..d38c435fa47 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTest.kt @@ -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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleKtsImportTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleKtsImportTest.kt index 91b3b527316..1b0eff3de61 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleKtsImportTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleKtsImportTest.kt @@ -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> = listOf(arrayOf("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() diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleMigrateTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleMigrateTest.kt index d5bbd4ae2f8..60c2bd7138d 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleMigrateTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleMigrateTest.kt @@ -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 ) diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleQuickFixTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleQuickFixTest.kt index 48fb398690f..ad01ca15e37 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleQuickFixTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleQuickFixTest.kt @@ -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" diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleTestRunConfigurationAndHighlightingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleTestRunConfigurationAndHighlightingTest.kt index e260fe5cbdf..77a536895b4 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleTestRunConfigurationAndHighlightingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleTestRunConfigurationAndHighlightingTest.kt @@ -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() } diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleTestRunConfigurationCustomTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleTestRunConfigurationCustomTest.kt index 3020960fd8b..5c32711d524 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleTestRunConfigurationCustomTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleTestRunConfigurationCustomTest.kt @@ -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 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleUpdateConfigurationQuickFixTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleUpdateConfigurationQuickFixTest.kt index 6509b3272c6..dc43a243deb 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleUpdateConfigurationQuickFixTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleUpdateConfigurationQuickFixTest.kt @@ -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)) diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/MultiplePluginVersionGradleImportingTestCase.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/MultiplePluginVersionGradleImportingTestCase.kt index b7a278d6ee5..e241c30eb38 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/MultiplePluginVersionGradleImportingTestCase.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/MultiplePluginVersionGradleImportingTestCase.kt @@ -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 { val defaultProperties = HashMap() 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 = 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> { 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) } } } \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/NativeRunConfigurationTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/NativeRunConfigurationTest.kt index 348d61429e6..ccbc37d618a 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/NativeRunConfigurationTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/NativeRunConfigurationTest.kt @@ -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() } diff --git a/idea/testData/gradle/configurator/addLanguageVersion/build.gradle b/idea/testData/gradle/configurator/addLanguageVersion/build.gradle index b6c887d7c05..1d009ba73d2 100644 --- a/idea/testData/gradle/configurator/addLanguageVersion/build.gradle +++ b/idea/testData/gradle/configurator/addLanguageVersion/build.gradle @@ -2,6 +2,7 @@ buildscript { repositories { jcenter() mavenCentral() + mavenLocal() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}" diff --git a/idea/testData/gradle/configurator/addLanguageVersion/build.gradle.after b/idea/testData/gradle/configurator/addLanguageVersion/build.gradle.after index de403eeb12b..80e8d54f487 100644 --- a/idea/testData/gradle/configurator/addLanguageVersion/build.gradle.after +++ b/idea/testData/gradle/configurator/addLanguageVersion/build.gradle.after @@ -2,6 +2,7 @@ buildscript { repositories { jcenter() mavenCentral() + mavenLocal() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}" diff --git a/idea/testData/gradle/configurator/addLibrary/build.gradle b/idea/testData/gradle/configurator/addLibrary/build.gradle index b6c887d7c05..1d009ba73d2 100644 --- a/idea/testData/gradle/configurator/addLibrary/build.gradle +++ b/idea/testData/gradle/configurator/addLibrary/build.gradle @@ -2,6 +2,7 @@ buildscript { repositories { jcenter() mavenCentral() + mavenLocal() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}" diff --git a/idea/testData/gradle/configurator/addLibrary/build.gradle.after b/idea/testData/gradle/configurator/addLibrary/build.gradle.after index 51cddb0fb9a..059019a8d5e 100644 --- a/idea/testData/gradle/configurator/addLibrary/build.gradle.after +++ b/idea/testData/gradle/configurator/addLibrary/build.gradle.after @@ -2,6 +2,7 @@ buildscript { repositories { jcenter() mavenCentral() + mavenLocal() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}" diff --git a/idea/testData/gradle/configurator/changeFeatureSupport/build.gradle b/idea/testData/gradle/configurator/changeFeatureSupport/build.gradle index 0dd08d20518..0b7f529e527 100644 --- a/idea/testData/gradle/configurator/changeFeatureSupport/build.gradle +++ b/idea/testData/gradle/configurator/changeFeatureSupport/build.gradle @@ -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" diff --git a/idea/testData/gradle/configurator/changeFeatureSupport/build.gradle.after b/idea/testData/gradle/configurator/changeFeatureSupport/build.gradle.after index b094519f38f..d787b13b71c 100644 --- a/idea/testData/gradle/configurator/changeFeatureSupport/build.gradle.after +++ b/idea/testData/gradle/configurator/changeFeatureSupport/build.gradle.after @@ -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" diff --git a/idea/testData/gradle/configurator/changeLanguageVersion/build.gradle b/idea/testData/gradle/configurator/changeLanguageVersion/build.gradle index 5e2d03c5acd..b1a5b3f685f 100644 --- a/idea/testData/gradle/configurator/changeLanguageVersion/build.gradle +++ b/idea/testData/gradle/configurator/changeLanguageVersion/build.gradle @@ -2,6 +2,7 @@ buildscript { repositories { jcenter() mavenCentral() + mavenLocal() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}" diff --git a/idea/testData/gradle/configurator/changeLanguageVersion/build.gradle.after b/idea/testData/gradle/configurator/changeLanguageVersion/build.gradle.after index de403eeb12b..80e8d54f487 100644 --- a/idea/testData/gradle/configurator/changeLanguageVersion/build.gradle.after +++ b/idea/testData/gradle/configurator/changeLanguageVersion/build.gradle.after @@ -2,6 +2,7 @@ buildscript { repositories { jcenter() mavenCentral() + mavenLocal() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}" diff --git a/idea/testData/gradle/configurator/disableFeatureSupport/build.gradle b/idea/testData/gradle/configurator/disableFeatureSupport/build.gradle index 8fa6299ab49..bed55311726 100644 --- a/idea/testData/gradle/configurator/disableFeatureSupport/build.gradle +++ b/idea/testData/gradle/configurator/disableFeatureSupport/build.gradle @@ -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" diff --git a/idea/testData/gradle/configurator/disableFeatureSupport/build.gradle.after b/idea/testData/gradle/configurator/disableFeatureSupport/build.gradle.after index 0dd08d20518..0b7f529e527 100644 --- a/idea/testData/gradle/configurator/disableFeatureSupport/build.gradle.after +++ b/idea/testData/gradle/configurator/disableFeatureSupport/build.gradle.after @@ -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" diff --git a/idea/testData/gradle/configurator/enableFeatureSupport/build.gradle b/idea/testData/gradle/configurator/enableFeatureSupport/build.gradle index 8fa6299ab49..bed55311726 100644 --- a/idea/testData/gradle/configurator/enableFeatureSupport/build.gradle +++ b/idea/testData/gradle/configurator/enableFeatureSupport/build.gradle @@ -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" diff --git a/idea/testData/gradle/configurator/enableFeatureSupport/build.gradle.after b/idea/testData/gradle/configurator/enableFeatureSupport/build.gradle.after index b094519f38f..d787b13b71c 100644 --- a/idea/testData/gradle/configurator/enableFeatureSupport/build.gradle.after +++ b/idea/testData/gradle/configurator/enableFeatureSupport/build.gradle.after @@ -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" diff --git a/idea/testData/gradle/configurator/enableFeatureSupportMultiplatform/build.gradle b/idea/testData/gradle/configurator/enableFeatureSupportMultiplatform/build.gradle index cd51b8ab5bf..653494cbba5 100644 --- a/idea/testData/gradle/configurator/enableFeatureSupportMultiplatform/build.gradle +++ b/idea/testData/gradle/configurator/enableFeatureSupportMultiplatform/build.gradle @@ -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 { diff --git a/idea/testData/gradle/configurator/enableFeatureSupportMultiplatform/build.gradle.after b/idea/testData/gradle/configurator/enableFeatureSupportMultiplatform/build.gradle.after index a32c7d6eac0..0fe0efc0aab 100644 --- a/idea/testData/gradle/configurator/enableFeatureSupportMultiplatform/build.gradle.after +++ b/idea/testData/gradle/configurator/enableFeatureSupportMultiplatform/build.gradle.after @@ -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 { diff --git a/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformToExistentArguments/build.gradle b/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformToExistentArguments/build.gradle index ea8b50da1d6..d4ac6a7efbd 100644 --- a/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformToExistentArguments/build.gradle +++ b/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformToExistentArguments/build.gradle @@ -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 { diff --git a/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformToExistentArguments/build.gradle.after b/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformToExistentArguments/build.gradle.after index 554a99097de..307f7c8095c 100644 --- a/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformToExistentArguments/build.gradle.after +++ b/idea/testData/gradle/configurator/enableFeatureSupportMultiplatformToExistentArguments/build.gradle.after @@ -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 { diff --git a/idea/testData/gradle/configurator/enableFeatureSupportToExistentArguments/build.gradle b/idea/testData/gradle/configurator/enableFeatureSupportToExistentArguments/build.gradle index aaf11a3ba49..a3300ec6549 100644 --- a/idea/testData/gradle/configurator/enableFeatureSupportToExistentArguments/build.gradle +++ b/idea/testData/gradle/configurator/enableFeatureSupportToExistentArguments/build.gradle @@ -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" diff --git a/idea/testData/gradle/configurator/enableFeatureSupportToExistentArguments/build.gradle.after b/idea/testData/gradle/configurator/enableFeatureSupportToExistentArguments/build.gradle.after index a4339a4aaa6..2450c369277 100644 --- a/idea/testData/gradle/configurator/enableFeatureSupportToExistentArguments/build.gradle.after +++ b/idea/testData/gradle/configurator/enableFeatureSupportToExistentArguments/build.gradle.after @@ -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" diff --git a/idea/testData/gradle/configurator/projectWithModule/app/build.gradle b/idea/testData/gradle/configurator/projectWithModule/app/build.gradle index 906ada0d194..40a252e368f 100644 --- a/idea/testData/gradle/configurator/projectWithModule/app/build.gradle +++ b/idea/testData/gradle/configurator/projectWithModule/app/build.gradle @@ -2,6 +2,7 @@ buildscript { repositories { jcenter() mavenCentral() + mavenLocal() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}" diff --git a/idea/testData/gradle/fixes/updateKotlinxCoroutines/build.gradle b/idea/testData/gradle/fixes/updateKotlinxCoroutines/build.gradle index b39a69b3131..5b5d7f41a83 100644 --- a/idea/testData/gradle/fixes/updateKotlinxCoroutines/build.gradle +++ b/idea/testData/gradle/fixes/updateKotlinxCoroutines/build.gradle @@ -4,6 +4,7 @@ version '1.0-SNAPSHOT' buildscript { repositories { mavenCentral() + mavenLocal() } dependencies { diff --git a/idea/testData/gradle/fixes/updateKotlinxCoroutines/build.gradle.after b/idea/testData/gradle/fixes/updateKotlinxCoroutines/build.gradle.after index c56bef704f0..ab1d0195c0f 100644 --- a/idea/testData/gradle/fixes/updateKotlinxCoroutines/build.gradle.after +++ b/idea/testData/gradle/fixes/updateKotlinxCoroutines/build.gradle.after @@ -4,6 +4,7 @@ version '1.0-SNAPSHOT' buildscript { repositories { mavenCentral() + mavenLocal() } dependencies { diff --git a/idea/testData/gradle/inspections/differentKotlinGradleVersion/build.gradle b/idea/testData/gradle/inspections/differentKotlinGradleVersion/build.gradle index f691e1922d4..433b5260ed1 100644 --- a/idea/testData/gradle/inspections/differentKotlinGradleVersion/build.gradle +++ b/idea/testData/gradle/inspections/differentKotlinGradleVersion/build.gradle @@ -5,7 +5,7 @@ version '1.0-SNAPSHOT' buildscript { repositories { - mavenCentral() + {{kotlin_plugin_repositories}} } dependencies { diff --git a/idea/testData/gradle/inspections/differentStdlibGradleVersionWithVariables/build.gradle b/idea/testData/gradle/inspections/differentStdlibGradleVersionWithVariables/build.gradle index a3a3f9ea7c3..9643309327b 100644 --- a/idea/testData/gradle/inspections/differentStdlibGradleVersionWithVariables/build.gradle +++ b/idea/testData/gradle/inspections/differentStdlibGradleVersionWithVariables/build.gradle @@ -5,7 +5,7 @@ version '1.0-SNAPSHOT' buildscript { repositories { - mavenCentral() + {{kotlin_plugin_repositories}} } dependencies { diff --git a/idea/testData/gradle/inspections/noDifferentStdlibCommonGradleVersion/build.gradle b/idea/testData/gradle/inspections/noDifferentStdlibCommonGradleVersion/build.gradle index 28f8a5798a9..d487d5edd47 100644 --- a/idea/testData/gradle/inspections/noDifferentStdlibCommonGradleVersion/build.gradle +++ b/idea/testData/gradle/inspections/noDifferentStdlibCommonGradleVersion/build.gradle @@ -5,7 +5,7 @@ version '1.0-SNAPSHOT' buildscript { repositories { - mavenCentral() + {{kotlin_plugin_repositories}} } dependencies { diff --git a/idea/testData/gradle/inspections/noDifferentStdlibJdk7GradleVersion/build.gradle b/idea/testData/gradle/inspections/noDifferentStdlibJdk7GradleVersion/build.gradle index 9d625c08771..0904d0019c3 100644 --- a/idea/testData/gradle/inspections/noDifferentStdlibJdk7GradleVersion/build.gradle +++ b/idea/testData/gradle/inspections/noDifferentStdlibJdk7GradleVersion/build.gradle @@ -5,7 +5,7 @@ version '1.0-SNAPSHOT' buildscript { repositories { - mavenCentral() + {{kotlin_plugin_repositories}} } dependencies { diff --git a/idea/testData/gradle/nativeLibraries/commonIOS/build.gradle.kts b/idea/testData/gradle/nativeLibraries/commonIOS/build.gradle.kts index e8b3b86dd83..de766066b83 100644 --- a/idea/testData/gradle/nativeLibraries/commonIOS/build.gradle.kts +++ b/idea/testData/gradle/nativeLibraries/commonIOS/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("multiplatform") version "1.3.60" + kotlin("multiplatform") version "{{kotlin_plugin_version}}" } repositories { diff --git a/idea/testData/gradle/nativeLibraries/commonIOSWithDisabledPropagation/build.gradle.kts b/idea/testData/gradle/nativeLibraries/commonIOSWithDisabledPropagation/build.gradle.kts index e8b3b86dd83..de766066b83 100644 --- a/idea/testData/gradle/nativeLibraries/commonIOSWithDisabledPropagation/build.gradle.kts +++ b/idea/testData/gradle/nativeLibraries/commonIOSWithDisabledPropagation/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("multiplatform") version "1.3.60" + kotlin("multiplatform") version "{{kotlin_plugin_version}}" } repositories { diff --git a/idea/testData/gradle/testRunConfigurations/expectClassWithTests/build.gradle b/idea/testData/gradle/testRunConfigurations/expectClassWithTests/build.gradle index 287bc06e6ea..6a52dd7af04 100644 --- a/idea/testData/gradle/testRunConfigurations/expectClassWithTests/build.gradle +++ b/idea/testData/gradle/testRunConfigurations/expectClassWithTests/build.gradle @@ -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() diff --git a/idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/build.gradle b/idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/build.gradle index 9c16a8a3d4c..036bbcb52f0 100644 --- a/idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/build.gradle +++ b/idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/build.gradle @@ -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" } diff --git a/idea/testData/gradle/testRunConfigurations/multiplatformTestsInObject/build.gradle b/idea/testData/gradle/testRunConfigurations/multiplatformTestsInObject/build.gradle index 41b768a5dbf..1233338e766 100644 --- a/idea/testData/gradle/testRunConfigurations/multiplatformTestsInObject/build.gradle +++ b/idea/testData/gradle/testRunConfigurations/multiplatformTestsInObject/build.gradle @@ -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() diff --git a/idea/testData/gradle/testRunConfigurations/multiprojectBuild/build.gradle b/idea/testData/gradle/testRunConfigurations/multiprojectBuild/build.gradle index 40b8750ee79..e434bc333b7 100644 --- a/idea/testData/gradle/testRunConfigurations/multiprojectBuild/build.gradle +++ b/idea/testData/gradle/testRunConfigurations/multiprojectBuild/build.gradle @@ -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' diff --git a/idea/testData/gradle/testRunConfigurations/preferredConfigurations/build.gradle b/idea/testData/gradle/testRunConfigurations/preferredConfigurations/build.gradle index ca38f7ade59..dbcb6eb85d7 100755 --- a/idea/testData/gradle/testRunConfigurations/preferredConfigurations/build.gradle +++ b/idea/testData/gradle/testRunConfigurations/preferredConfigurations/build.gradle @@ -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