Tests of import with latest gradle plugin are implemented

This commit is contained in:
Andrey Uskov
2019-11-13 20:11:32 +03:00
parent 51590ef1b7
commit e963b71921
43 changed files with 271 additions and 187 deletions
+1
View File
@@ -58,6 +58,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-ide-plugin"))
testRuntime(project(":kotlin-gradle-plugin"))
// TODO: the order of the plugins matters here, consider avoiding order-dependency
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("testng"))
@@ -329,6 +329,7 @@ class HierarchicalMultiplatformProjectImportingTest : MultiplePluginVersionGradl
libraryDependency("Kotlin/Native ${gradleKotlinPluginVersion} - stdlib", DependencyScope.PROVIDED)
libraryDependency("Kotlin/Native ${gradleKotlinPluginVersion} - zlib [linux_x64]", DependencyScope.PROVIDED)
}
module("jvm-on-mpp.hmpp-mod-a.main") {}
module("jvm-on-mpp.hmpp-mod-a.test") {}
}
@@ -812,6 +812,7 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin
}
@Test
@PluginTargetVersions(gradleVersion = "4.0+", pluginVersion = "1.3.30+")
fun testJvmWithJava() {
configureByFiles()
importProject(true)
@@ -13,6 +13,7 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import org.junit.Rule
import org.junit.runners.Parameterized
import java.io.File
import java.util.*
abstract class MultiplePluginVersionGradleImportingTestCase : GradleImportingTestCase() {
@@ -42,13 +43,21 @@ abstract class MultiplePluginVersionGradleImportingTestCase : GradleImportingTes
const val MINIMAL_SUPPORTED_VERSION = "minimal"// minimal supported version
const val LATEST_STABLE_VERSUON = "latest stable"
const val LATEST_SUPPORTED_VERSION = "master"// gradle plugin from current build
private val KOTLIN_GRADLE_PLUGIN_VERSIONS = listOf(MINIMAL_SUPPORTED_VERSION, LATEST_STABLE_VERSUON/*, LATEST_SUPPORTED_VERSION*/)
//should be extended with LATEST_SUPPORTED_VERSION
private val KOTLIN_GRADLE_PLUGIN_VERSIONS = listOf(MINIMAL_SUPPORTED_VERSION, LATEST_STABLE_VERSUON)
private val KOTLIN_GRADLE_PLUGIN_VERSION_DESCRIPTION_TO_VERSION = mapOf(
MINIMAL_SUPPORTED_VERSION to MINIMAL_SUPPORTED_GRADLE_PLUGIN_VERSION,
LATEST_STABLE_VERSUON to LATEST_STABLE_GRADLE_PLUGIN_VERSION,
LATEST_SUPPORTED_VERSION to "master"
LATEST_SUPPORTED_VERSION to readPluginVersion()
)
private fun readPluginVersion() =
File("libraries/tools/kotlin-gradle-plugin/build/libs").listFiles()?.map { it.name }?.firstOrNull { it.contains("-original.jar") }?.replace(
"kotlin-gradle-plugin-",
""
)?.replace("-original.jar", "") ?: "1.3-SNAPSHOT"
@JvmStatic
@Parameterized.Parameters(name = "{index}: Gradle-{0}, KotlinGradlePlugin-{1}")
fun data(): Collection<Array<Any>> {
@@ -63,17 +72,67 @@ abstract class MultiplePluginVersionGradleImportingTestCase : GradleImportingTes
}
}
fun repositories(useKts: Boolean, useMaster: Boolean): String {
val flatDirs = arrayOf(
"libraries/tools/kotlin-gradle-plugin/build/libs",
"libraries/tools/kotlin-gradle-plugin/build/libs",
"prepare/compiler-client-embeddable/build/libs",
"prepare/compiler-embeddable/build/libs",
"libraries/tools/kotlin-gradle-plugin-api/build/libs",
"compiler/compiler-runner/build/libs",
"libraries/tools/kotlin-gradle-plugin-model/build/libs",
"plugins/scripting/scripting-compiler-embeddable/build/libs",
"konan/utils/build/libs"
)
val customRepositories = arrayOf("https://dl.bintray.com/kotlin/kotlin-dev", "http://dl.bintray.com/kotlin/kotlin-eap")
val customMavenRepositories = customRepositories.map { if (useKts) "maven { setUrl(\"$it\") }" else "maven { url '$it' } " }.joinToString("\n")
val baseFolder = File(".").absolutePath.replace("\\", "/")
val quote = if (useKts) '"' else '\''
val flatDirRepositories = if (useMaster)
flatDirs.map { "$quote$baseFolder/$it$quote" }.joinToString(
",\n",
if (useKts) "flatDir { dirs(" else "flatDir { dirs ",
if (useKts) ")}" else "}"
)
else
""
return """
google()
jcenter()
$customMavenRepositories
$flatDirRepositories
""".trimIndent()
}
override fun configureByFiles(properties: Map<String, String>?): List<VirtualFile> {
val unitedProperties = HashMap(properties ?: emptyMap())
unitedProperties["kotlin_plugin_version"] = gradleKotlinPluginVersion
unitedProperties["kotlin_plugin_repositories"] = """
google()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap' }
mavenLocal()
//maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
""".trimIndent()
unitedProperties["kotlin_plugin_repositories"] = repositories(false, gradleKotlinPluginVersionType == LATEST_SUPPORTED_VERSION)
unitedProperties["kts_kotlin_plugin_repositories"] = repositories(true, gradleKotlinPluginVersionType == LATEST_SUPPORTED_VERSION)
unitedProperties["extraPluginDependencies"] = if (gradleKotlinPluginVersionType == LATEST_SUPPORTED_VERSION)
"""
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$gradleKotlinPluginVersion")
classpath("org.jetbrains.kotlin:kotlin-compiler-embeddable:$gradleKotlinPluginVersion")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin-api:$gradleKotlinPluginVersion")
classpath("org.jetbrains.kotlin:kotlin-native-utils:$gradleKotlinPluginVersion")
classpath("org.jetbrains.kotlin:kotlin-compiler-runner:$gradleKotlinPluginVersion")
classpath("org.jetbrains.kotlin:kotlin-compiler-client-embeddable:$gradleKotlinPluginVersion")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin-model:$gradleKotlinPluginVersion")
""".trimIndent()
else
""
unitedProperties["kts_resolution_strategy"] = if (gradleKotlinPluginVersionType == LATEST_SUPPORTED_VERSION)
"""resolutionStrategy {
eachPlugin {
if(requested.id.id == "org.jetbrains.kotlin.multiplatform") {
useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:$gradleKotlinPluginVersion")
}
}
}""".trimIndent()
else ""
return super.configureByFiles(unitedProperties)
}
}
@@ -1,11 +1,20 @@
buildscript {
repositories {
{{kts_kotlin_plugin_repositories}}
}
dependencies {
{{extraPluginDependencies}}
}
}
repositories {
{{kts_kotlin_plugin_repositories}}
}
plugins {
kotlin("multiplatform").version("{{kotlin_plugin_version}}")
}
repositories {
maven("https://kotlin.bintray.com/kotlin-dev")
jcenter()
}
group = "project"
version = "1.0"
@@ -1,8 +1,8 @@
pluginManagement {
repositories {
maven("https://dl.bintray.com/kotlin/kotlin-dev")
gradlePluginPortal()
{{kts_kotlin_plugin_repositories}}
}
{{kts_resolution_strategy}}
}
rootProject.name = "my-app"
@@ -1,10 +1,18 @@
plugins {
kotlin("multiplatform").version("{{kotlin_plugin_version}}")
buildscript {
repositories {
{{kts_kotlin_plugin_repositories}}
}
dependencies {
{{extraPluginDependencies}}
}
}
repositories {
maven("https://kotlin.bintray.com/kotlin-dev")
jcenter()
{{kts_kotlin_plugin_repositories}}
}
plugins {
kotlin("multiplatform").version("{{kotlin_plugin_version}}")
}
group = "project"
@@ -1,8 +1,8 @@
pluginManagement {
repositories {
maven("https://dl.bintray.com/kotlin/kotlin-dev")
gradlePluginPortal()
{{kts_kotlin_plugin_repositories}}
}
{{kts_resolution_strategy}}
}
rootProject.name = "my-app"
@@ -1,21 +1,18 @@
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
{{kotlin_plugin_repositories}}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
{{extraPluginDependencies}}
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
{{kotlin_plugin_repositories}}
}
}
@@ -1,4 +1,3 @@
kotlin_version = {{kotlin_plugin_version}}
coroutines_version = 1.1.1
moowork_node = 1.2.0
@@ -4,20 +4,15 @@ apply plugin: 'kotlin-multiplatform'
buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version"
{{extraPluginDependencies}}
}
repositories {
mavenLocal()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
{{kotlin_plugin_repositories}}
}
}
repositories {
mavenLocal()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
{{kotlin_plugin_repositories}}
}
kotlin {
@@ -5,9 +5,7 @@ plugins {
version 'unspecified'
repositories {
mavenLocal()
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
{{kotlin_plugin_repositories}}
}
dependencies {
@@ -1,14 +1,6 @@
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/' }
{{kotlin_plugin_repositories}}
}
}
rootProject.name = 'jvm-on-mpp'
@@ -6,49 +6,6 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
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"
}
}
}
@@ -0,0 +1,13 @@
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
apply plugin: 'kotlin-platform-common'
@@ -0,0 +1,21 @@
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
repositories {
mavenCentral()
}
apply plugin: 'kotlin-platform-js'
dependencies {
implement project(':project1')
}
@@ -0,0 +1,35 @@
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
repositories {
mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
sourceSets {
custom
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "org.jetbrains.kotlin"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
@@ -6,7 +6,7 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
@@ -6,63 +6,6 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
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)
}
}
@@ -0,0 +1,5 @@
apply plugin: 'kotlin-platform-common'
sourceSets {
custom
}
@@ -0,0 +1,14 @@
repositories {
mavenCentral()
}
apply plugin: 'kotlin-platform-jvm'
sourceSets {
custom
}
dependencies {
implement project(':project1')
}
@@ -0,0 +1,29 @@
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)
}
@@ -6,6 +6,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
{{extraPluginDependencies}}
}
}
@@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
apply plugin: 'kotlin-multiplatform'
@@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
@@ -10,6 +10,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
{{extraPluginDependencies}}
}
}
@@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
@@ -1,7 +1,14 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '{{kotlin_plugin_version}}' apply false
buildscript {
repositories {
{{kotlin_plugin_repositories}}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
{{extraPluginDependencies}}
}
}
allprojects {
repositories {
{{kotlin_plugin_repositories}}
@@ -1,10 +1,20 @@
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '{{kotlin_plugin_version}}'
}
repositories {
{{kotlin_plugin_repositories}}
buildscript {
repositories {
{{kotlin_plugin_repositories}}
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
allprojects {
repositories {
{{kotlin_plugin_repositories}}
}
}
apply plugin: 'kotlin-multiplatform'
group 'com.example'
version '0.0.1'
@@ -1,9 +1,2 @@
pluginManagement {
repositories {
{{kotlin_plugin_repositories}}
}
}
rootProject.name = 'project'
enableFeaturePreview('GRADLE_METADATA')
@@ -6,6 +6,7 @@ buildscript {
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
{{extraPluginDependencies}}
}
}
@@ -5,6 +5,7 @@ buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
{{extraPluginDependencies}}
}
}
@@ -1,4 +1,4 @@
kotlin_version = 1.3.40
kotlin_version = {{kotlin_plugin_version}}
coroutines_version = 1.1.1
moowork_node = 1.2.0
@@ -1,23 +1,6 @@
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 {
{{kotlin_plugin_repositories}}
}
}
repositories {
{{kotlin_plugin_repositories}}
}
kotlin {
jvm {
@@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
@@ -5,6 +5,7 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
@@ -5,6 +5,7 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
@@ -12,10 +13,8 @@ repositories {
{{kotlin_plugin_repositories}}
}
apply plugin: 'kotlin-multiplatform'
kotlin {
jvm()
js()
@@ -5,6 +5,7 @@ subprojects {
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}"
{{extraPluginDependencies}}
}
}
@@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
@@ -5,6 +5,7 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
@@ -5,6 +5,7 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
@@ -5,6 +5,7 @@ buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}
@@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:{{kotlin_plugin_version}}")
{{extraPluginDependencies}}
}
}