Skip to content

Commit

Permalink
Fix gradle plugin versioning and the plugin version used by samples
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmat192 committed Apr 26, 2018
1 parent 89cc1b3 commit bee7dcd
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 32 deletions.
2 changes: 1 addition & 1 deletion backend.native/tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ buildscript {
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$gradlePluginVersion"
}
ext.useCustomDist = project.hasProperty("konan.home")
if (!useCustomDist) {
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ ext {
kotlinStdLibModule="org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}"
kotlinReflectModule="org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
kotlinScriptRuntimeModule="org.jetbrains.kotlin:kotlin-script-runtime:${kotlinVersion}"

gradlePluginVersion = KonanVersion.CURRENT.gradlePluginVersion
}

allprojects {
Expand Down Expand Up @@ -385,7 +387,7 @@ task bundle(type: (isWindows()) ? Zip : Tar) {
return it.replace("/dist", "")
}
if (it.startsWith("konan.plugin.version=")) {
return "konan.plugin.version=$konanVersion"
return "konan.plugin.version=$gradlePluginVersion"
}
return it
}
Expand Down
2 changes: 1 addition & 1 deletion klib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
buildscript {
apply from: "$rootDir/gradle/kotlinGradlePlugin.gradle"
dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$gradlePluginVersion"
}

ext.useCustomDist = project.hasProperty("konan.home")
Expand Down
2 changes: 1 addition & 1 deletion performance/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$konanVersion"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$gradlePluginVersion"
}
}

Expand Down
2 changes: 1 addition & 1 deletion platformLibs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ buildscript {
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$gradlePluginVersion"
}

ext.konanHome = distDir.absolutePath
Expand Down
2 changes: 1 addition & 1 deletion samples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ subprojects {
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+"
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:${project.property('konan.plugin.version')}"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ include ':utilities'
include ':performance'
include ':platformLibs'

includeBuild 'tools/kotlin-native-gradle-plugin'
includeBuild 'shared'
includeBuild 'tools/kotlin-native-gradle-plugin'

if (hasProperty("kotlinProjectPath")) {
includeBuild(kotlinProjectPath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,32 @@ open class VersionGenerator: DefaultTask() {
| companion object {
| val CURRENT = KonanVersion($meta, $major, $minor, $maintenance, $build)
| }
| private val versionString by lazy {
| buildString {
| append(major)
| append('.')
| append(minor)
| if (maintenance != 0) {
| append('.')
| append(maintenance)
| }
| append('-')
| append(meta.metaString)
| if (build != -1) {
| append('-')
| append(build)
| }
| }
| private fun versionToString(showMeta: Boolean = true, showBuild: Boolean = true) = buildString {
| append(major)
| append('.')
| append(minor)
| if (maintenance != 0) {
| append('.')
| append(maintenance)
| }
| if (showMeta) {
| append('-')
| append(meta.metaString)
| }
| if (showBuild && build != -1) {
| append('-')
| append(build)
| }
| }
| private val versionString by lazy { versionToString(true, true) }
| override fun toString() = versionString
|
| val gradlePluginVersion by lazy {
| if (meta == MetaVersion.RELEASE)
| versionToString(false, false)
| else
| versionString
| }
|}
""".trimMargin()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ enum class MetaVersion(val metaString:String) {
BETA("beta"),
RC1("rc1"),
RC2("rc2"),
REL("release")
RELEASE("release")
}
12 changes: 4 additions & 8 deletions tools/kotlin-native-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

import org.jetbrains.kotlin.konan.KonanVersion

/**
* One may use bintrayUser/bintrayKey project properties or BINTRAY_USER/BINTRAY_KEY environment variables to upload
* built plugin to bintray repository.
Expand All @@ -30,6 +32,7 @@ buildscript {
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-shared:$konanVersion"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
}
Expand All @@ -42,14 +45,7 @@ apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.johnrengelman.shadow'

group = 'org.jetbrains.kotlin'

// Gradle doesn't allow using the KonanVersion class defined in `shared` from this build.
// TODO: Investigate if we can workaround this issue in better way.
def metaVersion = project.findProperty("konanMetaVersion")?.toString()?.toLowerCase() ?: "dev"
version = "$konanVersion-$metaVersion"
if (project.hasProperty("build.number")) {
version <<= "-${project.findProperty("build.number")?.toString().split('-')[2]}"
}
version = KonanVersion.CURRENT.gradlePluginVersion

repositories {
mavenCentral()
Expand Down

0 comments on commit bee7dcd

Please sign in to comment.