Skip to content

Commit 678caa5

Browse files
ilya-gligee
authored andcommitted
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
1 parent df04efc commit 678caa5

File tree

9 files changed

+32
-28
lines changed

9 files changed

+32
-28
lines changed

build.gradle.kts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ buildscript {
1212
"https://plugins.gradle.org/m2",
1313
"http://repository.jetbrains.com/utils/").filterNotNull()
1414

15-
extra["kotlin_version"] = bootstrapKotlinVersion
16-
extra["kotlinVersion"] = bootstrapKotlinVersion
17-
extra["kotlin_language_version"] = "1.1"
15+
extra["bootstrapKotlinVersion"] = bootstrapKotlinVersion
16+
1817
extra["repos"] = repos
1918

2019
extra["versions.shadow"] = "2.0.1"
@@ -47,8 +46,16 @@ val configuredJdks: List<JdkId> =
4746
}
4847
}
4948

50-
val buildNumber = "1.1-SNAPSHOT"
51-
extra["build.number"] = buildNumber
49+
val defaultSnapshotVersion = "1.1-SNAPSHOT"
50+
val buildNumber by extra(findProperty("build.number")?.toString() ?: defaultSnapshotVersion)
51+
val kotlinVersion by extra(findProperty("deployVersion")?.toString() ?: buildNumber)
52+
53+
val kotlinLanguageVersion by extra("1.1")
54+
55+
allprojects {
56+
group = "org.jetbrains.kotlin"
57+
version = kotlinVersion
58+
}
5259

5360
extra["kotlin_root"] = rootDir
5461

@@ -165,11 +172,6 @@ val gradlePluginProjects = listOf(
165172
":kotlin-sam-with-receiver"
166173
)
167174

168-
allprojects {
169-
group = "org.jetbrains.kotlin"
170-
version = buildNumber
171-
}
172-
173175
apply {
174176
from("libraries/commonConfiguration.gradle")
175177
from("libraries/gradlePluginsConfiguration.gradle")
@@ -230,12 +232,12 @@ allprojects {
230232
}
231233
configureJvmProject(javaHome!!, jvmTarget!!)
232234

233-
tasks.withType<KotlinCompile> {
234-
kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package")
235-
}
236-
237-
tasks.withType<Kotlin2JsCompile> {
238-
kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package")
235+
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
236+
kotlinOptions {
237+
languageVersion = kotlinLanguageVersion
238+
apiVersion = kotlinLanguageVersion
239+
freeCompilerArgs = listOf("-Xallow-kotlin-package")
240+
}
239241
}
240242

241243
tasks.withType<Javadoc> {

buildSrc/src/main/kotlin/CommonUtil.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fun Jar.setupRuntimeJar(implementationTitle: String): Unit {
3838
put("Built-By", project.rootProject.extra["manifest.impl.vendor"])
3939
put("Implementation-Vendor", project.rootProject.extra["manifest.impl.vendor"])
4040
put("Implementation-Title", implementationTitle)
41-
put("Implementation-Version", project.rootProject.extra["build.number"])
41+
put("Implementation-Version", project.rootProject.extra["buildNumber"])
4242
}
4343
// from(project.configurations.getByName("build-version").files, action = { into("META-INF/") })
4444
}

buildSrc/src/main/kotlin/artifacts.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,16 @@ fun Project.publish(body: Upload.() -> Unit = {}): Upload {
130130
}
131131

132132
fun Project.ideaPlugin(subdir: String = "lib", body: AbstractCopyTask.() -> Unit): Copy {
133+
val thisProject = this
133134
val pluginTask = task<Copy>("ideaPlugin") {
134135
body()
135136
into(File(rootProject.extra["ideaPluginDir"].toString(), subdir).path)
136-
rename("-${java.util.regex.Pattern.quote(rootProject.extra["build.number"].toString())}", "")
137+
rename("-${java.util.regex.Pattern.quote(thisProject.version.toString())}", "")
137138
}
138139

139140
task("idea-plugin") {
140141
dependsOn(pluginTask)
141-
}
142+
}
142143

143144
return pluginTask
144145
}
@@ -156,6 +157,7 @@ fun Project.dist(targetDir: File? = null,
156157
val distJarCfg = configurations.getOrCreate("distJar")
157158
val distLibDir: File by rootProject.extra
158159
val distJarName = targetName ?: (the<BasePluginConvention>().archivesBaseName + ".jar")
160+
val thisProject = this
159161

160162
return task<Copy>("dist") {
161163
body()
@@ -165,7 +167,7 @@ fun Project.dist(targetDir: File? = null,
165167
rename(it.outputs.files.singleFile.name, targetName)
166168
}
167169
}
168-
rename("-${java.util.regex.Pattern.quote(rootProject.extra["build.number"].toString())}", "")
170+
rename("-${java.util.regex.Pattern.quote(thisProject.version.toString())}", "")
169171
into(targetDir ?: distLibDir)
170172
project.addArtifact(distJarCfg, this, File(targetDir ?: distLibDir, distJarName))
171173
}
@@ -185,7 +187,7 @@ fun Jar.setupPublicJar(classifier: String = "", classifierDescr: String? = null)
185187
put("Built-By", project.rootProject.extra["manifest.impl.vendor"])
186188
put("Implementation-Vendor", project.rootProject.extra["manifest.impl.vendor"])
187189
put("Implementation-Title", "${project.description} ${classifierDescr ?: classifier}".trim())
188-
put("Implementation-Version", project.rootProject.extra["build.number"])
190+
put("Implementation-Version", project.rootProject.extra["buildNumber"])
189191
}
190192
// from(project.configurations.getByName("build-version").files, action = { into("META-INF/") })
191193
}

libraries/commonConfiguration.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ ext.manifestAttributes = { Manifest manifest, Project project, String component
7777
attributes \
7878
'Implementation-Vendor': 'JetBrains',
7979
'Implementation-Title': project.archivesBaseName,
80-
'Implementation-Version': project.version,
80+
'Implementation-Version': project.buildNumber,
8181
'Build-Jdk': System.getProperty('java.version')
8282

8383
if (component != null) {
8484
attributes \
8585
'Kotlin-Runtime-Component': component,
86-
'Kotlin-Version': project.kotlin_language_version
86+
'Kotlin-Version': project.kotlinLanguageVersion
8787
}
8888
}
8989
}

libraries/configureGradleTools.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ configure([project(':kotlin-gradle-plugin'), project(':kotlin-allopen'), project
2020
}
2121

2222
publishPlugins.doFirst {
23-
assert !kotlin_version.contains('SNAPSHOT')
23+
assert !kotlinVersion.contains('SNAPSHOT')
2424
}
2525

2626
pluginBundle {

libraries/gradlePluginsConfiguration.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ configure([project(':kotlin-gradle-plugin'), project(':kotlin-allopen'), project
2626
}
2727

2828
publishPlugins.doFirst {
29-
assert !kotlin_version.contains('SNAPSHOT')
29+
assert !kotlinVersion.contains('SNAPSHOT')
3030
}
3131

3232
pluginBundle {

libraries/tools/kotlin-stdlib-gen/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sourceSets {
55
}
66

77
dependencies {
8-
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
8+
compile "org.jetbrains.kotlin:kotlin-stdlib:$bootstrapKotlinVersion"
99
}
1010

1111
compileKotlin {

libraries/tools/kotlin-stdlib-js-merger/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description = 'Merge utility for Kotlin Standard Library for JS'
33
apply plugin: 'kotlin'
44

55
dependencies {
6-
compile "org.jetbrains.kotlin:kotlin-compiler:$kotlin_version"
6+
compile "org.jetbrains.kotlin:kotlin-compiler:$bootstrapKotlinVersion"
77
}
88

99
sourceSets {

prepare/build.version/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ val buildVersionFilePath = "${rootProject.extra["distDir"]}/build.txt"
66
val buildVersion by configurations.creating
77

88
val prepare = task("prepare") {
9-
val versionString = rootProject.extra["build.number"].toString()
9+
val versionString = rootProject.extra["buildNumber"].toString()
1010
val versionFile = File(buildVersionFilePath)
1111
outputs.file(buildVersionFilePath)
1212
outputs.upToDateWhen {

0 commit comments

Comments
 (0)