From 86a26f0ccab96d249e0ba920906a4ce59e7ee17d Mon Sep 17 00:00:00 2001 From: Andrey Uskov Date: Wed, 24 Jul 2019 12:55:18 +0300 Subject: [PATCH] Add jvmWithJava IDE import test --- .../NewMultiplatformProjectImportingTest.kt | 51 +++++++++++++++++++ .../jvmWithJava/build.gradle | 21 ++++++++ .../jvmWithJava/gradle.properties | 6 +++ .../jvmWithJava/jvm-mod/build.gradle | 15 ++++++ .../jvmWithJava/mpp-mod-a/build.gradle | 47 +++++++++++++++++ .../jvmWithJava/settings.gradle | 16 ++++++ 6 files changed, 156 insertions(+) create mode 100644 idea/testData/gradle/newMultiplatformImport/jvmWithJava/build.gradle create mode 100644 idea/testData/gradle/newMultiplatformImport/jvmWithJava/gradle.properties create mode 100644 idea/testData/gradle/newMultiplatformImport/jvmWithJava/jvm-mod/build.gradle create mode 100644 idea/testData/gradle/newMultiplatformImport/jvmWithJava/mpp-mod-a/build.gradle create mode 100644 idea/testData/gradle/newMultiplatformImport/jvmWithJava/settings.gradle 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 f3c2d890270..7e56f0ac288 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt @@ -591,6 +591,57 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin } } + @Test + fun testJvmWithJava() { + configureByFiles() + importProject(true) + + checkProjectStructure(true, false, true) { + module("jvm-on-mpp") {} + module("jvm-on-mpp.jvm-mod") {} + module("jvm-on-mpp.jvm-mod.main") { + moduleDependency("jvm-on-mpp.mpp-mod-a.jvmMain", DependencyScope.COMPILE, false) + moduleDependency("jvm-on-mpp.mpp-mod-a.main", DependencyScope.COMPILE, false) + } + module("jvm-on-mpp.jvm-mod.test") { + moduleDependency("jvm-on-mpp.jvm-mod.main", DependencyScope.COMPILE, false) + moduleDependency("jvm-on-mpp.mpp-mod-a.jvmMain", DependencyScope.COMPILE, false) + moduleDependency("jvm-on-mpp.mpp-mod-a.main", DependencyScope.COMPILE, false) + } + + module("jvm-on-mpp.mpp-mod-a") { + } + module("jvm-on-mpp.mpp-mod-a.commonMain") { + } + module("jvm-on-mpp.mpp-mod-a.commonTest") { + moduleDependency("jvm-on-mpp.mpp-mod-a.commonMain", DependencyScope.TEST, false) + } + module("jvm-on-mpp.mpp-mod-a.jsMain") { + moduleDependency("jvm-on-mpp.mpp-mod-a.commonMain", DependencyScope.COMPILE, false) + } + module("jvm-on-mpp.mpp-mod-a.jsTest") { + moduleDependency("jvm-on-mpp.mpp-mod-a.jsMain", DependencyScope.TEST, false) + moduleDependency("jvm-on-mpp.mpp-mod-a.commonMain", DependencyScope.TEST, false) + moduleDependency("jvm-on-mpp.mpp-mod-a.commonTest", DependencyScope.TEST, true) + } + module("jvm-on-mpp.mpp-mod-a.jvmMain") { + moduleDependency("jvm-on-mpp.mpp-mod-a.commonMain", DependencyScope.COMPILE, false) + } + module("jvm-on-mpp.mpp-mod-a.jvmTest") { + moduleDependency("jvm-on-mpp.mpp-mod-a.commonMain", DependencyScope.TEST, false) + moduleDependency("jvm-on-mpp.mpp-mod-a.commonTest", DependencyScope.TEST, true) + moduleDependency("jvm-on-mpp.mpp-mod-a.jvmMain", DependencyScope.TEST, false) + } + + //At the moment this is 'fake' source roots and they have no explicit dependencies. + module("jvm-on-mpp.mpp-mod-a.main") { + } + module("jvm-on-mpp.mpp-mod-a.test") { + } + } + + } + private fun checkProjectStructure( exhaustiveModuleList: Boolean = true, exhaustiveSourceSourceRootList: Boolean = true, diff --git a/idea/testData/gradle/newMultiplatformImport/jvmWithJava/build.gradle b/idea/testData/gradle/newMultiplatformImport/jvmWithJava/build.gradle new file mode 100644 index 00000000000..f5f2e2bbcfe --- /dev/null +++ b/idea/testData/gradle/newMultiplatformImport/jvmWithJava/build.gradle @@ -0,0 +1,21 @@ +buildscript { + repositories { + mavenLocal() + jcenter() + maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } + } + + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } + +} + +allprojects { + repositories { + mavenLocal() + jcenter() + maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } + } +} + diff --git a/idea/testData/gradle/newMultiplatformImport/jvmWithJava/gradle.properties b/idea/testData/gradle/newMultiplatformImport/jvmWithJava/gradle.properties new file mode 100644 index 00000000000..87f9533b5f6 --- /dev/null +++ b/idea/testData/gradle/newMultiplatformImport/jvmWithJava/gradle.properties @@ -0,0 +1,6 @@ +kotlin_version = 1.3.40 +coroutines_version = 1.1.1 +moowork_node = 1.2.0 + +org.gradle.paralllel=true +kotlin.parallel.tasks.in.project=true \ No newline at end of file diff --git a/idea/testData/gradle/newMultiplatformImport/jvmWithJava/jvm-mod/build.gradle b/idea/testData/gradle/newMultiplatformImport/jvmWithJava/jvm-mod/build.gradle new file mode 100644 index 00000000000..7ec6685c369 --- /dev/null +++ b/idea/testData/gradle/newMultiplatformImport/jvmWithJava/jvm-mod/build.gradle @@ -0,0 +1,15 @@ +plugins { + id 'org.jetbrains.kotlin.jvm' +} + +version 'unspecified' + +repositories { + mavenLocal() + jcenter() + maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } +} + +dependencies { + compile project(":mpp-mod-a") +} diff --git a/idea/testData/gradle/newMultiplatformImport/jvmWithJava/mpp-mod-a/build.gradle b/idea/testData/gradle/newMultiplatformImport/jvmWithJava/mpp-mod-a/build.gradle new file mode 100644 index 00000000000..0787802eb99 --- /dev/null +++ b/idea/testData/gradle/newMultiplatformImport/jvmWithJava/mpp-mod-a/build.gradle @@ -0,0 +1,47 @@ +version '1.0.0' + +apply plugin: 'kotlin-multiplatform' +apply plugin: 'maven-publish' +apply plugin: 'kotlin-allopen' +apply plugin: 'kotlin-noarg' + +buildscript { + dependencies { + classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version" + } + repositories { + mavenLocal() + jcenter() + maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } + } +} + +repositories { + mavenLocal() + jcenter() + maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } +} + +kotlin { + jvm { + withJava() + } + + js() + + sourceSets { + commonMain { + } + commonTest { + } + jvmMain { + } + jvmTest { + } + jsMain { + } + jsTest { + } + } +} diff --git a/idea/testData/gradle/newMultiplatformImport/jvmWithJava/settings.gradle b/idea/testData/gradle/newMultiplatformImport/jvmWithJava/settings.gradle new file mode 100644 index 00000000000..166cd35252a --- /dev/null +++ b/idea/testData/gradle/newMultiplatformImport/jvmWithJava/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } + maven { url 'http://dl.bintray.com/kotlin/kotlin-eap' } + + mavenCentral() + mavenLocal() + jcenter() + + maven { url 'https://dl.bintray.com/qwwdfsad/kotlinx' } + maven { url 'https://plugins.gradle.org/m2/' } + } +} +rootProject.name = 'jvm-on-mpp' +include ':mpp-mod-a', ':jvm-mod' +enableFeaturePreview('GRADLE_METADATA') \ No newline at end of file