File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
main/src/kotlinx/benchmark/gradle Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,24 @@ dependencies {
9696 compileOnly " org.openjdk.jmh:jmh-generator-bytecode:$jmhVersion " // used in worker
9797}
9898
99+ tasks. register(" overridePluginVersion" ) {
100+ description = " Overrides BenchmarksPlugin.PLUGIN_VERSION during release builds"
101+ onlyIf {
102+ project. findProperty(" releaseVersion" ) != null
103+ }
104+ doLast {
105+ def benchmarksPluginFile = " ${ projectDir} /main/src/kotlinx/benchmark/gradle/BenchmarksPlugin.kt"
106+ def releaseVersion = project. findProperty(" releaseVersion" )
107+ ant. replaceregexp(
108+ file : benchmarksPluginFile,
109+ match : " const val PLUGIN_VERSION = \" [\\ d.]+-SNAPSHOT\" " ,
110+ replace : " const val PLUGIN_VERSION = \" $releaseVersion \" " ,
111+ encoding : " UTF-8"
112+ )
113+ }
114+ }
115+
116+ tasks. compileKotlin. dependsOn overridePluginVersion
99117
100118if (project. findProperty(" publication_repository" ) == " space" ) {
101119 // publish to Space repository
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import org.gradle.util.*
77class BenchmarksPlugin : Plugin <Project > {
88 companion object {
99 const val PLUGIN_ID = " org.jetbrains.kotlinx.benchmark"
10+ // This value is overridden by `overridePluginVersion` task during release builds.
1011 const val PLUGIN_VERSION = " 0.5.0-SNAPSHOT"
1112
1213 const val BENCHMARKS_TASK_GROUP = " benchmark"
You can’t perform that action at this time.
0 commit comments