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 06dc9d6fb86..78ecef8cc21 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt @@ -52,47 +52,7 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testPlatformToCommonDependency() { - createProjectSubFile("settings.gradle", "include ':common', ':jvm', ':js'") - val commonTestFile = createProjectSubFile("common/src/test/kotlin/test.kt", "") - createProjectSubFile("jvm/src/test/kotlin/test.kt", "") - createProjectSubFile("js/src/test/kotlin/test.kt", "") - - val kotlinVersion = "1.1.0" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - } - } - - project('common') { - apply plugin: 'kotlin-platform-common' - } - - project('jvm') { - apply plugin: 'kotlin-platform-jvm' - - dependencies { - implement project(':common') - } - } - - project('js') { - apply plugin: 'kotlin-platform-js' - - dependencies { - implement project(':common') - } - } - """ - ) - + val files = configureByFiles() importProject() assertModuleModuleDepScope("jvm_main", "common_main", DependencyScope.COMPILE) @@ -105,56 +65,14 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { assertProductionOnTestDependency("js_main", "common_main", false) assertProductionOnTestDependency("js_test", "common_test", true) + val commonTestFile = files.find { it.path.contains("common") }!! assertFileInModuleScope(commonTestFile, "jvm_test") assertFileInModuleScope(commonTestFile, "js_test") } @Test fun testPlatformToCommonExpectedByDependency() { - createProjectSubFile("settings.gradle", "include ':common1', ':common2', ':jvm', ':js'") - - val kotlinVersion = "1.2.40-dev-610" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - } - } - - project('common1') { - apply plugin: 'kotlin-platform-common' - } - - project('common2') { - apply plugin: 'kotlin-platform-common' - } - - project('jvm') { - apply plugin: 'kotlin-platform-jvm' - - dependencies { - expectedBy project(':common1') - expectedBy project(':common2') - } - } - - project('js') { - apply plugin: 'kotlin-platform-js' - - dependencies { - expectedBy project(':common1') - } - } - """ - ) - + configureByFiles() importProject() assertModuleModuleDepScope("jvm_main", "common1_main", DependencyScope.COMPILE) assertModuleModuleDepScope("jvm_main", "common2_main", DependencyScope.COMPILE) @@ -168,63 +86,7 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testPlatformToCommonExpectedByDependencyInComposite() { - createProjectSubFile("toInclude/settings.gradle", "include ':common', ':jvm', ':js'") - - val kotlinVersion = "1.2.0-beta-74" - - createProjectSubFile( - "toInclude/build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - } - } - - project('common') { - apply plugin: 'kotlin-platform-common' - } - - project('jvm') { - apply plugin: 'kotlin-platform-jvm' - - dependencies { - expectedBy project(':common') - } - } - - project('js') { - apply plugin: 'kotlin-platform-js' - - dependencies { - expectedBy project(':common') - } - } - """ - ) - - createProjectSubFile("settings.gradle", "includeBuild('toInclude')") - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - } - } - - apply plugin: 'kotlin' - """.trimIndent() - ) - + configureByFiles() importProject() TestCase.assertEquals(listOf("common_main"), facetSettings("jvm_main").implementedModuleNames) @@ -240,42 +102,7 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testPlatformToCommonDependencyRoot() { - createProjectSubFile("settings.gradle", "rootProject.name = 'foo'\ninclude ':jvm', ':js'") - - val kotlinVersion = "1.1.0" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - } - } - - apply plugin: 'kotlin-platform-common' - - project('jvm') { - apply plugin: 'kotlin-platform-jvm' - - dependencies { - implement project(':') - } - } - - project('js') { - apply plugin: 'kotlin-platform-js' - - dependencies { - implement project(':') - } - } - """ - ) - + configureByFiles() importProject() assertModuleModuleDepScope("jvm_main", "foo_main", DependencyScope.COMPILE) assertModuleModuleDepScope("jvm_test", "foo_test", DependencyScope.COMPILE) @@ -285,70 +112,7 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testMultiProject() { - createProjectSubFile("settings.gradle", "include ':common-lib', ':jvm-lib', ':js-lib', ':common-app', ':jvm-app', ':js-app'") - - val kotlinVersion = "1.1.0" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - } - } - - project('common-lib') { - apply plugin: 'kotlin-platform-common' - } - - project('jvm-lib') { - apply plugin: 'kotlin-platform-jvm' - - dependencies { - implement project(':common-lib') - } - } - - project('js-lib') { - apply plugin: 'kotlin-platform-js' - - dependencies { - implement project(':common-lib') - } - } - - project('common-app') { - apply plugin: 'kotlin-platform-common' - - dependencies { - compile project(':common-lib') - } - } - - project('jvm-app') { - apply plugin: 'kotlin-platform-jvm' - - dependencies { - implement project(':common-app') - compile project(':jvm-lib') - } - } - - project('js-app') { - apply plugin: 'kotlin-platform-js' - - dependencies { - implement project(':common-app') - compile project(':js-lib') - } - } - """ - ) - + configureByFiles() importProject() assertModuleModuleDepScope("jvm-app_main", "common-app_main", DependencyScope.COMPILE) @@ -362,60 +126,7 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testDependenciesReachableViaImpl() { - createProjectSubFile( - "settings.gradle", - "include ':common-lib1', ':common-lib2', ':jvm-lib1', ':jvm-lib2', ':jvm-app'" - ) - - val kotlinVersion = "1.1.0" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - } - } - - project('common-lib1') { - apply plugin: 'kotlin-platform-common' - } - - project('common-lib2') { - apply plugin: 'kotlin-platform-common' - } - - project('jvm-lib1') { - apply plugin: 'kotlin-platform-jvm' - - dependencies { - implement project(':common-lib1') - } - } - - project('jvm-lib2') { - apply plugin: 'kotlin-platform-jvm' - - dependencies { - implement project(':common-lib2') - compile project(':jvm-lib1') - } - } - - project('jvm-app') { - apply plugin: 'kotlin-platform-jvm' - - dependencies { - compile project(':jvm-lib2') - } - } - """ - ) - + configureByFiles() importProject() assertModuleModuleDepScope("jvm-app_main", "jvm-lib2_main", DependencyScope.COMPILE) @@ -431,69 +142,7 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testTransitiveImplement() { - createProjectSubFile( - "settings.gradle", - "include ':project1', ':project2', ':project3'" - ) - - val kotlinVersion = "1.1.51" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - } - } - - project('project1') { - apply plugin: 'kotlin-platform-common' - - sourceSets { - custom - } - } - - project('project2') { - repositories { - mavenCentral() - } - - apply plugin: 'kotlin-platform-jvm' - - sourceSets { - custom - } - - dependencies { - implement project(':project1') - } - } - - project('project3') { - repositories { - mavenCentral() - } - - apply plugin: 'kotlin-platform-jvm' - apply plugin: 'kotlin' - - sourceSets { - custom - } - - dependencies { - compile project(':project2') - customCompile project(':project2') - testCompile(project(':project2').sourceSets.test.output) - } - } - """ - ) + configureByFiles() val isResolveModulePerSourceSet = getCurrentExternalProjectSettings().isResolveModulePerSourceSet @@ -536,74 +185,7 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testTransitiveImplementWithNonDefaultConfig() { - createProjectSubFile( - "settings.gradle", - "include ':project1', ':project2', ':project3'" - ) - - val kotlinVersion = "1.2.31" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - } - } - - project('project1') { - apply plugin: 'kotlin-platform-common' - } - - project('project2') { - repositories { - mavenCentral() - } - - apply plugin: 'kotlin-platform-jvm' - - sourceSets { - main - main2 - } - - task myJar(type: Jar) { - baseName = 'project2-jar' - from sourceSets.main.output - from sourceSets.main2.output - } - - configurations { - myConfig - } - - artifacts { - myConfig myJar - } - - dependencies { - implement project(':project1') - } - } - - project('project3') { - repositories { - mavenCentral() - } - - apply plugin: 'kotlin-platform-jvm' - apply plugin: 'kotlin' - - dependencies { - compile(project(path: ':project2', configuration: 'myConfig')) { transitive = false } - } - } - """ - ) + configureByFiles() val isResolveModulePerSourceSet = getCurrentExternalProjectSettings().isResolveModulePerSourceSet @@ -642,84 +224,8 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testTransitiveImplementWithAndroid() { - createProjectSubFile( - "settings.gradle", - "include ':project1', ':project2', ':project3'" - ) + configureByFiles() - val kotlinVersion = "1.1.51" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - jcenter() - maven { url 'https://maven.google.com' } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - classpath 'com.android.tools.build:gradle:2.3.3' - } - } - - project('project1') { - apply plugin: 'kotlin-platform-common' - - sourceSets { - custom - } - } - - project('project2') { - repositories { - mavenCentral() - } - - apply plugin: 'kotlin-platform-jvm' - - sourceSets { - custom - } - - dependencies { - implement project(':project1') - } - } - - project('project3') { - repositories { - mavenCentral() - } - - apply plugin: 'com.android.application' - apply plugin: 'kotlin-android' - - sourceSets { - custom - } - - android { - compileSdkVersion 26 - buildToolsVersion "23.0.1" - defaultConfig { - applicationId "org.jetbrains.kotlin" - minSdkVersion 18 - targetSdkVersion 26 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - } - } - - dependencies { - compile project(':project2') - customCompile project(':project2') - testCompile(project(':project2').sourceSets.test.output) - } - } - """ - ) createProjectSubFile( "local.properties", """ sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()} @@ -748,65 +254,8 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun simpleAndroidAppWithCommonModule() { - createProjectSubFile( - "settings.gradle", - "include ':app', ':jvm', ':cmn'" - ) + configureByFiles() - val kotlinVersion = "1.2.41" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - jcenter() - maven { url 'https://maven.google.com' } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - classpath 'com.android.tools.build:gradle:2.3.3' - } - } - - project('cmn') { - apply plugin: 'kotlin-platform-common' - } - - project('jvm') { - apply plugin: 'kotlin-platform-jvm' - - dependencies { - expectedBy project(":cmn") - } - } - - project('app') { - repositories { - mavenCentral() - } - - apply plugin: 'com.android.application' - apply plugin: 'kotlin-android' - - android { - compileSdkVersion 26 - buildToolsVersion "23.0.1" - defaultConfig { - applicationId "org.jetbrains.kotlin" - minSdkVersion 18 - targetSdkVersion 26 - versionCode 1 - versionName "1.0" - } - } - - dependencies { - compile project(":jvm") - } - } - """ - ) createProjectSubFile( "local.properties", """ sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()} @@ -833,44 +282,7 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testJsTestOutputFile() { - createProjectSubFile( - "settings.gradle", - "include ':project1', ':project2', ':project3'" - ) - - val kotlinVersion = "1.1.51" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - jcenter() - maven { url 'https://maven.google.com' } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - classpath 'com.android.tools.build:gradle:2.3.3' - } - } - - project('project1') { - apply plugin: 'kotlin-platform-common' - } - - project('project2') { - repositories { - mavenCentral() - } - - apply plugin: 'kotlin-platform-js' - - dependencies { - implement project(':project1') - } - } - """ - ) + configureByFiles() importProject() @@ -886,45 +298,7 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testJsProductionOutputFile() { - createProjectSubFile( - "settings.gradle", - "include ':project1', ':project2', ':project3'" - ) - - val kotlinVersion = "1.1.51" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - jcenter() - maven { url 'https://maven.google.com' } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - classpath 'com.android.tools.build:gradle:2.3.3' - } - } - - project('project1') { - apply plugin: 'kotlin-platform-common' - } - - project('project2') { - repositories { - mavenCentral() - } - - apply plugin: 'kotlin-platform-js' - - dependencies { - implement project(':project1') - } - } - """ - ) - + configureByFiles() importProject() TestCase.assertEquals( @@ -939,70 +313,7 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { @Test fun testJsTestOutputFileInProjectWithAndroid() { - createProjectSubFile( - "settings.gradle", - "include ':project1', ':project2', ':project3'" - ) - - val kotlinVersion = "1.1.51" - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - jcenter() - maven { url 'https://maven.google.com' } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - classpath 'com.android.tools.build:gradle:2.3.3' - } - } - - project('project1') { - apply plugin: 'kotlin-platform-common' - } - - project('project2') { - repositories { - mavenCentral() - } - - apply plugin: 'kotlin-platform-js' - - dependencies { - implement project(':project1') - } - } - - project('project3') { - repositories { - mavenCentral() - } - - apply plugin: 'com.android.application' - apply plugin: 'kotlin-android' - - sourceSets { - custom - } - - android { - compileSdkVersion 26 - buildToolsVersion "23.0.1" - defaultConfig { - applicationId "org.jetbrains.kotlin" - minSdkVersion 18 - targetSdkVersion 26 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - } - } - } - """ - ) + configureByFiles() createProjectSubFile( "local.properties", """ sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()} @@ -1016,4 +327,8 @@ class MultiplatformProjectImportingTest : GradleImportingTestCase() { PathUtil.toSystemIndependentName(KotlinFacet.get(getModule("project2"))!!.configuration.settings.testOutputPath) ) } + + override fun testDataDirName(): String { + return "multiplatform" + } } \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/dependenciesReachableViaImpl/build.gradle b/idea/testData/gradle/multiplatform/dependenciesReachableViaImpl/build.gradle new file mode 100644 index 00000000000..55ea851797a --- /dev/null +++ b/idea/testData/gradle/multiplatform/dependenciesReachableViaImpl/build.gradle @@ -0,0 +1,43 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") + } +} + +project('common-lib1') { + apply plugin: 'kotlin-platform-common' +} + +project('common-lib2') { + apply plugin: 'kotlin-platform-common' +} + +project('jvm-lib1') { + apply plugin: 'kotlin-platform-jvm' + + dependencies { + implement project(':common-lib1') + } +} + +project('jvm-lib2') { + apply plugin: 'kotlin-platform-jvm' + + dependencies { + implement project(':common-lib2') + compile project(':jvm-lib1') + } +} + +project('jvm-app') { + apply plugin: 'kotlin-platform-jvm' + + dependencies { + compile project(':jvm-lib2') + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/dependenciesReachableViaImpl/settings.gradle b/idea/testData/gradle/multiplatform/dependenciesReachableViaImpl/settings.gradle new file mode 100644 index 00000000000..c44146531c5 --- /dev/null +++ b/idea/testData/gradle/multiplatform/dependenciesReachableViaImpl/settings.gradle @@ -0,0 +1 @@ +include ':common-lib1', ':common-lib2', ':jvm-lib1', ':jvm-lib2', ':jvm-app' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/jsProductionOutputFile/build.gradle b/idea/testData/gradle/multiplatform/jsProductionOutputFile/build.gradle new file mode 100644 index 00000000000..7243bce447b --- /dev/null +++ b/idea/testData/gradle/multiplatform/jsProductionOutputFile/build.gradle @@ -0,0 +1,28 @@ +buildscript { + repositories { + jcenter() + maven { url 'https://maven.google.com' } + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51") + classpath 'com.android.tools.build:gradle:2.3.3' + } +} + +project('project1') { + apply plugin: 'kotlin-platform-common' +} + +project('project2') { + repositories { + mavenCentral() + } + + apply plugin: 'kotlin-platform-js' + + dependencies { + implement project(':project1') + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/jsProductionOutputFile/settings.gradle b/idea/testData/gradle/multiplatform/jsProductionOutputFile/settings.gradle new file mode 100644 index 00000000000..3f1a49379f9 --- /dev/null +++ b/idea/testData/gradle/multiplatform/jsProductionOutputFile/settings.gradle @@ -0,0 +1 @@ +include ':project1', ':project2', ':project3' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/jsTestOutputFile/build.gradle b/idea/testData/gradle/multiplatform/jsTestOutputFile/build.gradle new file mode 100644 index 00000000000..7243bce447b --- /dev/null +++ b/idea/testData/gradle/multiplatform/jsTestOutputFile/build.gradle @@ -0,0 +1,28 @@ +buildscript { + repositories { + jcenter() + maven { url 'https://maven.google.com' } + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51") + classpath 'com.android.tools.build:gradle:2.3.3' + } +} + +project('project1') { + apply plugin: 'kotlin-platform-common' +} + +project('project2') { + repositories { + mavenCentral() + } + + apply plugin: 'kotlin-platform-js' + + dependencies { + implement project(':project1') + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/jsTestOutputFile/settings.gradle b/idea/testData/gradle/multiplatform/jsTestOutputFile/settings.gradle new file mode 100644 index 00000000000..3f1a49379f9 --- /dev/null +++ b/idea/testData/gradle/multiplatform/jsTestOutputFile/settings.gradle @@ -0,0 +1 @@ +include ':project1', ':project2', ':project3' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/jsTestOutputFileInProjectWithAndroid/build.gradle b/idea/testData/gradle/multiplatform/jsTestOutputFileInProjectWithAndroid/build.gradle new file mode 100644 index 00000000000..4187ba3302c --- /dev/null +++ b/idea/testData/gradle/multiplatform/jsTestOutputFileInProjectWithAndroid/build.gradle @@ -0,0 +1,54 @@ +buildscript { + repositories { + jcenter() + maven { url 'https://maven.google.com' } + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51") + classpath 'com.android.tools.build:gradle:2.3.3' + } +} + +project('project1') { + apply plugin: 'kotlin-platform-common' +} + +project('project2') { + repositories { + mavenCentral() + } + + apply plugin: 'kotlin-platform-js' + + dependencies { + implement project(':project1') + } +} + +project('project3') { + repositories { + mavenCentral() + } + + apply plugin: 'com.android.application' + apply plugin: 'kotlin-android' + + sourceSets { + custom + } + + android { + compileSdkVersion 26 + buildToolsVersion "23.0.1" + defaultConfig { + applicationId "org.jetbrains.kotlin" + minSdkVersion 18 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/jsTestOutputFileInProjectWithAndroid/settings.gradle b/idea/testData/gradle/multiplatform/jsTestOutputFileInProjectWithAndroid/settings.gradle new file mode 100644 index 00000000000..3f1a49379f9 --- /dev/null +++ b/idea/testData/gradle/multiplatform/jsTestOutputFileInProjectWithAndroid/settings.gradle @@ -0,0 +1 @@ +include ':project1', ':project2', ':project3' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/multiProject/build.gradle b/idea/testData/gradle/multiplatform/multiProject/build.gradle new file mode 100644 index 00000000000..ad99760d5da --- /dev/null +++ b/idea/testData/gradle/multiplatform/multiProject/build.gradle @@ -0,0 +1,56 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") + } +} + +project('common-lib') { + apply plugin: 'kotlin-platform-common' +} + +project('jvm-lib') { + apply plugin: 'kotlin-platform-jvm' + + dependencies { + implement project(':common-lib') + } +} + +project('js-lib') { + apply plugin: 'kotlin-platform-js' + + dependencies { + implement project(':common-lib') + } +} + +project('common-app') { + apply plugin: 'kotlin-platform-common' + + dependencies { + compile project(':common-lib') + } +} + +project('jvm-app') { + apply plugin: 'kotlin-platform-jvm' + + dependencies { + implement project(':common-app') + compile project(':jvm-lib') + } +} + +project('js-app') { + apply plugin: 'kotlin-platform-js' + + dependencies { + implement project(':common-app') + compile project(':js-lib') + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/multiProject/settings.gradle b/idea/testData/gradle/multiplatform/multiProject/settings.gradle new file mode 100644 index 00000000000..dba7cda4da7 --- /dev/null +++ b/idea/testData/gradle/multiplatform/multiProject/settings.gradle @@ -0,0 +1 @@ +include ':common-lib', ':jvm-lib', ':js-lib', ':common-app', ':jvm-app', ':js-app' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/platformToCommonDependency/build.gradle b/idea/testData/gradle/multiplatform/platformToCommonDependency/build.gradle new file mode 100644 index 00000000000..383955eb1eb --- /dev/null +++ b/idea/testData/gradle/multiplatform/platformToCommonDependency/build.gradle @@ -0,0 +1,30 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") + } +} + +project('common') { + apply plugin: 'kotlin-platform-common' +} + +project('jvm') { + apply plugin: 'kotlin-platform-jvm' + + dependencies { + implement project(':common') + } +} + +project('js') { + apply plugin: 'kotlin-platform-js' + + dependencies { + implement project(':common') + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/platformToCommonDependency/common/src/test/kotlin/test.kt b/idea/testData/gradle/multiplatform/platformToCommonDependency/common/src/test/kotlin/test.kt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/testData/gradle/multiplatform/platformToCommonDependency/js/src/test/kotlin/test.kt b/idea/testData/gradle/multiplatform/platformToCommonDependency/js/src/test/kotlin/test.kt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/testData/gradle/multiplatform/platformToCommonDependency/jvm/src/test/kotlin/test.kt b/idea/testData/gradle/multiplatform/platformToCommonDependency/jvm/src/test/kotlin/test.kt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/testData/gradle/multiplatform/platformToCommonDependency/settings.gradle b/idea/testData/gradle/multiplatform/platformToCommonDependency/settings.gradle new file mode 100644 index 00000000000..c84217fae11 --- /dev/null +++ b/idea/testData/gradle/multiplatform/platformToCommonDependency/settings.gradle @@ -0,0 +1 @@ +include ':common', ':jvm', ':js' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/platformToCommonDependencyRoot/build.gradle b/idea/testData/gradle/multiplatform/platformToCommonDependencyRoot/build.gradle new file mode 100644 index 00000000000..f96b529169b --- /dev/null +++ b/idea/testData/gradle/multiplatform/platformToCommonDependencyRoot/build.gradle @@ -0,0 +1,28 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") + } +} + +apply plugin: 'kotlin-platform-common' + +project('jvm') { + apply plugin: 'kotlin-platform-jvm' + + dependencies { + implement project(':') + } +} + +project('js') { + apply plugin: 'kotlin-platform-js' + + dependencies { + implement project(':') + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/platformToCommonDependencyRoot/settings.gradle b/idea/testData/gradle/multiplatform/platformToCommonDependencyRoot/settings.gradle new file mode 100644 index 00000000000..994e97f60e7 --- /dev/null +++ b/idea/testData/gradle/multiplatform/platformToCommonDependencyRoot/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'foo' +include ':jvm', ':js' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependency/build.gradle b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependency/build.gradle new file mode 100644 index 00000000000..35864cb20d3 --- /dev/null +++ b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependency/build.gradle @@ -0,0 +1,36 @@ +buildscript { + repositories { + mavenCentral() + maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.40-dev-610") + } +} + +project('common1') { + apply plugin: 'kotlin-platform-common' +} + +project('common2') { + apply plugin: 'kotlin-platform-common' +} + +project('jvm') { + apply plugin: 'kotlin-platform-jvm' + + dependencies { + expectedBy project(':common1') + expectedBy project(':common2') + } +} + +project('js') { + apply plugin: 'kotlin-platform-js' + + dependencies { + expectedBy project(':common1') + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependency/settings.gradle b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependency/settings.gradle new file mode 100644 index 00000000000..70043c01e3d --- /dev/null +++ b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependency/settings.gradle @@ -0,0 +1 @@ +include ':common1', ':common2', ':jvm', ':js' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/build.gradle b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/build.gradle new file mode 100644 index 00000000000..748a4300b0f --- /dev/null +++ b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/build.gradle @@ -0,0 +1,12 @@ +buildscript { + repositories { + mavenCentral() + maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-beta-74") + } +} + +apply plugin: 'kotlin' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/settings.gradle b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/settings.gradle new file mode 100644 index 00000000000..30270d817c4 --- /dev/null +++ b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/settings.gradle @@ -0,0 +1 @@ +includeBuild('toInclude') \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/toInclude/build.gradle b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/toInclude/build.gradle new file mode 100644 index 00000000000..fb4ba6a65c1 --- /dev/null +++ b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/toInclude/build.gradle @@ -0,0 +1,32 @@ + + buildscript { + repositories { + mavenCentral() + maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-beta-74") + } + } + + project('common') { + apply plugin: 'kotlin-platform-common' + } + + project('jvm') { + apply plugin: 'kotlin-platform-jvm' + + dependencies { + expectedBy project(':common') + } + } + + project('js') { + apply plugin: 'kotlin-platform-js' + + dependencies { + expectedBy project(':common') + } + } + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/toInclude/settings.gradle b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/toInclude/settings.gradle new file mode 100644 index 00000000000..c84217fae11 --- /dev/null +++ b/idea/testData/gradle/multiplatform/platformToCommonExpectedByDependencyInComposite/toInclude/settings.gradle @@ -0,0 +1 @@ +include ':common', ':jvm', ':js' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/simpleAndroidAppWithCommonModule/build.gradle b/idea/testData/gradle/multiplatform/simpleAndroidAppWithCommonModule/build.gradle new file mode 100644 index 00000000000..1def5dca1c7 --- /dev/null +++ b/idea/testData/gradle/multiplatform/simpleAndroidAppWithCommonModule/build.gradle @@ -0,0 +1,49 @@ +buildscript { + repositories { + jcenter() + maven { url 'https://maven.google.com' } + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.41") + classpath 'com.android.tools.build:gradle:2.3.3' + } +} + +project('cmn') { + apply plugin: 'kotlin-platform-common' +} + +project('jvm') { + apply plugin: 'kotlin-platform-jvm' + + dependencies { + expectedBy project(":cmn") + } +} + +project('app') { + repositories { + mavenCentral() + } + + apply plugin: 'com.android.application' + apply plugin: 'kotlin-android' + + android { + compileSdkVersion 26 + buildToolsVersion "23.0.1" + defaultConfig { + applicationId "org.jetbrains.kotlin" + minSdkVersion 18 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + } + } + + dependencies { + compile project(":jvm") + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/simpleAndroidAppWithCommonModule/settings.gradle b/idea/testData/gradle/multiplatform/simpleAndroidAppWithCommonModule/settings.gradle new file mode 100644 index 00000000000..34327dad3c8 --- /dev/null +++ b/idea/testData/gradle/multiplatform/simpleAndroidAppWithCommonModule/settings.gradle @@ -0,0 +1 @@ +include ':app', ':jvm', ':cmn' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/transitiveImplement/build.gradle b/idea/testData/gradle/multiplatform/transitiveImplement/build.gradle new file mode 100644 index 00000000000..af0b75567e3 --- /dev/null +++ b/idea/testData/gradle/multiplatform/transitiveImplement/build.gradle @@ -0,0 +1,53 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51") + } +} + +project('project1') { + apply plugin: 'kotlin-platform-common' + + sourceSets { + custom + } +} + +project('project2') { + repositories { + mavenCentral() + } + + apply plugin: 'kotlin-platform-jvm' + + sourceSets { + custom + } + + dependencies { + implement project(':project1') + } +} + +project('project3') { + repositories { + mavenCentral() + } + + apply plugin: 'kotlin-platform-jvm' + apply plugin: 'kotlin' + + sourceSets { + custom + } + + dependencies { + compile project(':project2') + customCompile project(':project2') + testCompile(project(':project2').sourceSets.test.output) + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/transitiveImplement/settings.gradle b/idea/testData/gradle/multiplatform/transitiveImplement/settings.gradle new file mode 100644 index 00000000000..3f1a49379f9 --- /dev/null +++ b/idea/testData/gradle/multiplatform/transitiveImplement/settings.gradle @@ -0,0 +1 @@ +include ':project1', ':project2', ':project3' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/transitiveImplementWithAndroid/build.gradle b/idea/testData/gradle/multiplatform/transitiveImplementWithAndroid/build.gradle new file mode 100644 index 00000000000..ea40b9abfa4 --- /dev/null +++ b/idea/testData/gradle/multiplatform/transitiveImplementWithAndroid/build.gradle @@ -0,0 +1,68 @@ +buildscript { + repositories { + jcenter() + maven { url 'https://maven.google.com' } + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51") + classpath 'com.android.tools.build:gradle:2.3.3' + } +} + +project('project1') { + apply plugin: 'kotlin-platform-common' + + sourceSets { + custom + } +} + +project('project2') { + repositories { + mavenCentral() + } + + apply plugin: 'kotlin-platform-jvm' + + sourceSets { + custom + } + + dependencies { + implement project(':project1') + } +} + +project('project3') { + repositories { + mavenCentral() + } + + apply plugin: 'com.android.application' + apply plugin: 'kotlin-android' + + sourceSets { + custom + } + + android { + compileSdkVersion 26 + buildToolsVersion "23.0.1" + defaultConfig { + applicationId "org.jetbrains.kotlin" + minSdkVersion 18 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + } + + dependencies { + compile project(':project2') + customCompile project(':project2') + testCompile(project(':project2').sourceSets.test.output) + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/transitiveImplementWithAndroid/settings.gradle b/idea/testData/gradle/multiplatform/transitiveImplementWithAndroid/settings.gradle new file mode 100644 index 00000000000..3f1a49379f9 --- /dev/null +++ b/idea/testData/gradle/multiplatform/transitiveImplementWithAndroid/settings.gradle @@ -0,0 +1 @@ +include ':project1', ':project2', ':project3' \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/transitiveImplementWithNonDefaultConfig/build.gradle b/idea/testData/gradle/multiplatform/transitiveImplementWithNonDefaultConfig/build.gradle new file mode 100644 index 00000000000..d7008c988b2 --- /dev/null +++ b/idea/testData/gradle/multiplatform/transitiveImplementWithNonDefaultConfig/build.gradle @@ -0,0 +1,58 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.31") + } +} + +project('project1') { + apply plugin: 'kotlin-platform-common' +} + +project('project2') { + repositories { + mavenCentral() + } + + apply plugin: 'kotlin-platform-jvm' + + sourceSets { + main + main2 + } + + task myJar(type: Jar) { + baseName = 'project2-jar' + from sourceSets.main.output + from sourceSets.main2.output + } + + configurations { + myConfig + } + + artifacts { + myConfig myJar + } + + dependencies { + implement project(':project1') + } +} + +project('project3') { + repositories { + mavenCentral() + } + + apply plugin: 'kotlin-platform-jvm' + apply plugin: 'kotlin' + + dependencies { + compile(project(path: ':project2', configuration: 'myConfig')) { transitive = false } + } +} + \ No newline at end of file diff --git a/idea/testData/gradle/multiplatform/transitiveImplementWithNonDefaultConfig/settings.gradle b/idea/testData/gradle/multiplatform/transitiveImplementWithNonDefaultConfig/settings.gradle new file mode 100644 index 00000000000..3f1a49379f9 --- /dev/null +++ b/idea/testData/gradle/multiplatform/transitiveImplementWithNonDefaultConfig/settings.gradle @@ -0,0 +1 @@ +include ':project1', ':project2', ':project3' \ No newline at end of file