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 5b5e15667fd..5a377c0e71b 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 @@ -12,7 +12,6 @@ import com.intellij.openapi.roots.OrderRootType import com.intellij.openapi.roots.libraries.Library import com.intellij.openapi.vfs.VfsUtilCore.urlToPath import org.jetbrains.kotlin.ide.konan.NativeLibraryKind -import org.jetbrains.kotlin.idea.codeInsight.gradle.GradleImportingTestCase import org.jetbrains.kotlin.idea.configuration.externalCompilerVersion import org.jetbrains.kotlin.idea.framework.detectLibraryKind import org.jetbrains.kotlin.idea.project.platform @@ -26,28 +25,10 @@ import org.junit.Test import org.junit.runners.Parameterized import java.io.File -abstract class TestCaseWithFakeKotlinNative : GradleImportingTestCase() { - protected fun configureProject() { - configureByFiles() - - // include data dir with fake Kotlin/Native libraries - val testSuiteDataDir = testDataDirectory().parentFile - val kotlinNativeHome = testSuiteDataDir.resolve(FAKE_KOTLIN_NATIVE_HOME_RELATIVE_PATH) - - kotlinNativeHome.walkTopDown() - .filter { it.isFile } - .forEach { pathInTestSuite -> - // need to put copied file one directory upper than the project root, so adding ".." to the beginning of relative path - // reason: distribution KLIBs should not be appear in IDEA indexes, so they should be located outside of the project root - val relativePathInProject = DOUBLE_DOT_PATH.resolve(pathInTestSuite.relativeTo(testSuiteDataDir)) - createProjectSubFile(relativePathInProject.toString(), pathInTestSuite.readText()) - } - } -} class GradleNativeLibrariesInIDENamingTest : TestCaseWithFakeKotlinNative() { - // Test naming of Kotlin/Native libraries in projects with Gradle plugin 1.3.21+ + // Test naming of Kotlin/Native libraries @Test fun testLibrariesNaming() { configureProject() @@ -56,15 +37,6 @@ class GradleNativeLibrariesInIDENamingTest : TestCaseWithFakeKotlinNative() { myProject.allModules().forEach { assertValidModule(it, projectPath) } } - // Test naming of Kotlin/Native libraries in projects with Gradle plugin 1.3.20 or earlier - @Test - fun testLegacyLibrariesNaming() { - configureProject() - importProject() - - myProject.allModules().forEach { assertValidModule(it, projectPath) } - } - override fun getExternalSystemConfigFileName() = GradleConstants.KOTLIN_DSL_SCRIPT_NAME override fun testDataDirName() = "nativeLibraries" @@ -77,7 +49,6 @@ class GradleNativeLibrariesInIDENamingTest : TestCaseWithFakeKotlinNative() { } } -private val FAKE_KOTLIN_NATIVE_HOME_RELATIVE_PATH = File("kotlin-native-data-dir", "kotlin-native-PLATFORM-VERSION") private val NATIVE_LIBRARY_NAME_REGEX = Regex("^Kotlin/Native ([\\d\\w\\.-]+) - ([\\w\\d]+)( \\[([\\w\\d_]+)\\])?$") private val NATIVE_LINUX_LIBRARIES = listOf( @@ -100,7 +71,6 @@ private val NATIVE_MINGW_LIBRARIES = listOf( "Kotlin/Native {version} - opengl32 [mingw_x64]", "Kotlin/Native {version} - windows [mingw_x64]" ) -private val DOUBLE_DOT_PATH = File("..") private val Module.libraries get() = ModuleRootManager.getInstance(this).orderEntries 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 new file mode 100644 index 00000000000..c7f400f4c55 --- /dev/null +++ b/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/TestCaseWithFakeKotlinNative.kt @@ -0,0 +1,31 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.ide.konan.gradle + +import org.jetbrains.kotlin.idea.codeInsight.gradle.GradleImportingTestCase +import java.io.File + +abstract class TestCaseWithFakeKotlinNative : GradleImportingTestCase() { + protected fun configureProject() { + configureByFiles() + + // include data dir with fake Kotlin/Native libraries + val testSuiteDataDir = testDataDirectory().parentFile + val kotlinNativeHome = testSuiteDataDir.resolve(FAKE_KOTLIN_NATIVE_HOME_RELATIVE_PATH) + + kotlinNativeHome.walkTopDown() + .filter { it.isFile } + .forEach { pathInTestSuite -> + // need to put copied file one directory upper than the project root, so adding ".." to the beginning of relative path + // reason: distribution KLIBs should not be appear in IDEA indexes, so they should be located outside of the project root + val relativePathInProject = DOUBLE_DOT_PATH.resolve(pathInTestSuite.relativeTo(testSuiteDataDir)) + createProjectSubFile(relativePathInProject.toString(), pathInTestSuite.readText()) + } + } +} + +internal val FAKE_KOTLIN_NATIVE_HOME_RELATIVE_PATH = File("kotlin-native-data-dir", "kotlin-native-PLATFORM-VERSION") +internal val DOUBLE_DOT_PATH = File("..") diff --git a/idea/testData/gradle/nativeLibraries/legacyLibrariesNaming/build.gradle.kts b/idea/testData/gradle/nativeLibraries/legacyLibrariesNaming/build.gradle.kts deleted file mode 100644 index 3f34ab4878d..00000000000 --- a/idea/testData/gradle/nativeLibraries/legacyLibrariesNaming/build.gradle.kts +++ /dev/null @@ -1,48 +0,0 @@ -plugins { - kotlin("multiplatform") version "{{kotlin_plugin_version}}" -} - -repositories { - mavenCentral() -} - -kotlin { - jvm() - js() - macosX64() - linuxX64() - mingwX64() - - sourceSets { - val commonMain by getting { - dependencies { - implementation(kotlin("stdlib-common")) - } - } - - val commonTest by getting { - dependencies { - implementation(kotlin("test-common")) - implementation(kotlin("test-annotations-common")) - } - } - - jvm().compilations["main"].defaultSourceSet { - dependencies { - implementation(kotlin("stdlib-jdk8")) - } - } - - jvm().compilations["test"].defaultSourceSet { - dependencies { - implementation(kotlin("test-junit")) - } - } - - js().compilations["main"].defaultSourceSet { - dependencies { - implementation(kotlin("stdlib-js")) - } - } - } -} diff --git a/idea/testData/gradle/nativeLibraries/legacyLibrariesNaming/gradle.properties b/idea/testData/gradle/nativeLibraries/legacyLibrariesNaming/gradle.properties deleted file mode 100644 index c7965da73e1..00000000000 --- a/idea/testData/gradle/nativeLibraries/legacyLibrariesNaming/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -org.jetbrains.kotlin.native.home=../kotlin-native-data-dir/kotlin-native-PLATFORM-VERSION