From b84559b27a1ada42e43415873fa2242dce77d08a Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Mon, 25 Feb 2019 15:28:33 +0300 Subject: [PATCH] Fix IDE import after switching to the long plugin version --- .../kotlin-native-gradle-plugin/build.gradle | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/kotlin-native-gradle-plugin/build.gradle b/tools/kotlin-native-gradle-plugin/build.gradle index 773e3894a03..2f0049ed891 100644 --- a/tools/kotlin-native-gradle-plugin/build.gradle +++ b/tools/kotlin-native-gradle-plugin/build.gradle @@ -19,8 +19,6 @@ * built plugin to bintray repository. */ -import org.jetbrains.kotlin.konan.KonanVersion - buildscript { ext.rootBuildDirectory = file('../../') @@ -41,7 +39,6 @@ buildscript { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4' classpath "com.gradle.publish:plugin-publish-plugin:0.9.10" - classpath "org.jetbrains.kotlin:kotlin-native-shared:$konanVersion" } } @@ -54,12 +51,24 @@ apply plugin: 'com.github.johnrengelman.shadow' apply plugin: "com.gradle.plugin-publish" String determineVersion() { + // With Gradle 5.1 adding a dependency on the 'shared' build + // in this buildscript causes an IDE import error. + // So we are not able to use the KonanVersion API and + // have to manually construct the version. + // TODO: Remove this code when 'shared' is built separately (from a separate repo). + def meta = findProperty('konanMetaVersion') ?: 'dev' def overriddenVersion = findProperty('pluginVersionOverride') as String + if (overriddenVersion != null && !overriddenVersion.empty) { return overriddenVersion - } else { - return "$kotlinVersion-native-${KonanVersion.Companion.CURRENT.toString()}" } + + def buildNumber = findProperty("build.number")?.tokenize('-')?.get(2) + def result = "$kotlinVersion-native-$konanVersion-$meta" + if (buildNumber != null) { + result += "-$buildNumber" + } + return result } group = 'org.jetbrains.kotlin'