Setup project versions

Build parameters (with corresponding project properties):
- build.number (buildNumber) - build number from build server, goes into manifest, by default snapshot
- deployVersion (kotlinVersion, project.version) - version of artifacts, by default build.number
- bootstrap.kotlin.version (bootstrapKotlinVersion) - version of bootstrap compiler
This commit is contained in:
Ilya Gorbunov
2017-09-16 07:43:42 +03:00
committed by Ilya Chernikov
parent df04efcf14
commit 678caa5676
9 changed files with 32 additions and 28 deletions
+18 -16
View File
@@ -12,9 +12,8 @@ buildscript {
"https://plugins.gradle.org/m2",
"http://repository.jetbrains.com/utils/").filterNotNull()
extra["kotlin_version"] = bootstrapKotlinVersion
extra["kotlinVersion"] = bootstrapKotlinVersion
extra["kotlin_language_version"] = "1.1"
extra["bootstrapKotlinVersion"] = bootstrapKotlinVersion
extra["repos"] = repos
extra["versions.shadow"] = "2.0.1"
@@ -47,8 +46,16 @@ val configuredJdks: List<JdkId> =
}
}
val buildNumber = "1.1-SNAPSHOT"
extra["build.number"] = buildNumber
val defaultSnapshotVersion = "1.1-SNAPSHOT"
val buildNumber by extra(findProperty("build.number")?.toString() ?: defaultSnapshotVersion)
val kotlinVersion by extra(findProperty("deployVersion")?.toString() ?: buildNumber)
val kotlinLanguageVersion by extra("1.1")
allprojects {
group = "org.jetbrains.kotlin"
version = kotlinVersion
}
extra["kotlin_root"] = rootDir
@@ -165,11 +172,6 @@ val gradlePluginProjects = listOf(
":kotlin-sam-with-receiver"
)
allprojects {
group = "org.jetbrains.kotlin"
version = buildNumber
}
apply {
from("libraries/commonConfiguration.gradle")
from("libraries/gradlePluginsConfiguration.gradle")
@@ -230,12 +232,12 @@ allprojects {
}
configureJvmProject(javaHome!!, jvmTarget!!)
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package")
}
tasks.withType<Kotlin2JsCompile> {
kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package")
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
kotlinOptions {
languageVersion = kotlinLanguageVersion
apiVersion = kotlinLanguageVersion
freeCompilerArgs = listOf("-Xallow-kotlin-package")
}
}
tasks.withType<Javadoc> {
+1 -1
View File
@@ -38,7 +38,7 @@ fun Jar.setupRuntimeJar(implementationTitle: String): Unit {
put("Built-By", project.rootProject.extra["manifest.impl.vendor"])
put("Implementation-Vendor", project.rootProject.extra["manifest.impl.vendor"])
put("Implementation-Title", implementationTitle)
put("Implementation-Version", project.rootProject.extra["build.number"])
put("Implementation-Version", project.rootProject.extra["buildNumber"])
}
// from(project.configurations.getByName("build-version").files, action = { into("META-INF/") })
}
+6 -4
View File
@@ -130,15 +130,16 @@ fun Project.publish(body: Upload.() -> Unit = {}): Upload {
}
fun Project.ideaPlugin(subdir: String = "lib", body: AbstractCopyTask.() -> Unit): Copy {
val thisProject = this
val pluginTask = task<Copy>("ideaPlugin") {
body()
into(File(rootProject.extra["ideaPluginDir"].toString(), subdir).path)
rename("-${java.util.regex.Pattern.quote(rootProject.extra["build.number"].toString())}", "")
rename("-${java.util.regex.Pattern.quote(thisProject.version.toString())}", "")
}
task("idea-plugin") {
dependsOn(pluginTask)
}
}
return pluginTask
}
@@ -156,6 +157,7 @@ fun Project.dist(targetDir: File? = null,
val distJarCfg = configurations.getOrCreate("distJar")
val distLibDir: File by rootProject.extra
val distJarName = targetName ?: (the<BasePluginConvention>().archivesBaseName + ".jar")
val thisProject = this
return task<Copy>("dist") {
body()
@@ -165,7 +167,7 @@ fun Project.dist(targetDir: File? = null,
rename(it.outputs.files.singleFile.name, targetName)
}
}
rename("-${java.util.regex.Pattern.quote(rootProject.extra["build.number"].toString())}", "")
rename("-${java.util.regex.Pattern.quote(thisProject.version.toString())}", "")
into(targetDir ?: distLibDir)
project.addArtifact(distJarCfg, this, File(targetDir ?: distLibDir, distJarName))
}
@@ -185,7 +187,7 @@ fun Jar.setupPublicJar(classifier: String = "", classifierDescr: String? = null)
put("Built-By", project.rootProject.extra["manifest.impl.vendor"])
put("Implementation-Vendor", project.rootProject.extra["manifest.impl.vendor"])
put("Implementation-Title", "${project.description} ${classifierDescr ?: classifier}".trim())
put("Implementation-Version", project.rootProject.extra["build.number"])
put("Implementation-Version", project.rootProject.extra["buildNumber"])
}
// from(project.configurations.getByName("build-version").files, action = { into("META-INF/") })
}
+2 -2
View File
@@ -77,13 +77,13 @@ ext.manifestAttributes = { Manifest manifest, Project project, String component
attributes \
'Implementation-Vendor': 'JetBrains',
'Implementation-Title': project.archivesBaseName,
'Implementation-Version': project.version,
'Implementation-Version': project.buildNumber,
'Build-Jdk': System.getProperty('java.version')
if (component != null) {
attributes \
'Kotlin-Runtime-Component': component,
'Kotlin-Version': project.kotlin_language_version
'Kotlin-Version': project.kotlinLanguageVersion
}
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ configure([project(':kotlin-gradle-plugin'), project(':kotlin-allopen'), project
}
publishPlugins.doFirst {
assert !kotlin_version.contains('SNAPSHOT')
assert !kotlinVersion.contains('SNAPSHOT')
}
pluginBundle {
+1 -1
View File
@@ -26,7 +26,7 @@ configure([project(':kotlin-gradle-plugin'), project(':kotlin-allopen'), project
}
publishPlugins.doFirst {
assert !kotlin_version.contains('SNAPSHOT')
assert !kotlinVersion.contains('SNAPSHOT')
}
pluginBundle {
@@ -5,7 +5,7 @@ sourceSets {
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$bootstrapKotlinVersion"
}
compileKotlin {
@@ -3,7 +3,7 @@ description = 'Merge utility for Kotlin Standard Library for JS'
apply plugin: 'kotlin'
dependencies {
compile "org.jetbrains.kotlin:kotlin-compiler:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-compiler:$bootstrapKotlinVersion"
}
sourceSets {
+1 -1
View File
@@ -6,7 +6,7 @@ val buildVersionFilePath = "${rootProject.extra["distDir"]}/build.txt"
val buildVersion by configurations.creating
val prepare = task("prepare") {
val versionString = rootProject.extra["build.number"].toString()
val versionString = rootProject.extra["buildNumber"].toString()
val versionFile = File(buildVersionFilePath)
outputs.file(buildVersionFilePath)
outputs.upToDateWhen {