11import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
2- import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
2+ import kotlinx.team.infra.InfraExtension
33
44buildscript {
5- ext. kotlinDevUrl = rootProject. properties[" kotlin_repo_url" ]
65 repositories {
7- maven { url ' https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/maven' }
6+ maven( " https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/maven" )
87 mavenCentral()
9- if (kotlinDevUrl != null ) {
10- maven { url = kotlinDevUrl }
8+ val kotlinRepoUrl = providers.gradleProperty(" kotlin_repo_url" ).orNull
9+ if (kotlinRepoUrl != null ) {
10+ maven(kotlinRepoUrl)
1111 }
1212 }
1313
@@ -21,16 +21,16 @@ buildscript {
2121}
2222
2323plugins {
24- id ' java-gradle-plugin'
25- id ' maven-publish'
24+ ` java- gradle- plugin`
25+ ` maven- publish`
2626 alias(libs.plugins.gradle.pluginPublish)
2727 alias(libs.plugins.kotlinx.binaryCompatibilityValidator)
2828 alias(libs.plugins.kotlin.jvm)
2929}
3030
31- apply(plugin : ' kotlinx.team.infra' )
31+ apply (plugin = " kotlinx.team.infra" )
3232
33- infra {
33+ extensions.configure< InfraExtension > {
3434 teamcity {
3535 libraryStagingRepoDescription = project.name
3636 }
@@ -47,20 +47,21 @@ repositories {
4747 mavenCentral()
4848 gradlePluginPortal()
4949
50- if (kotlinDevUrl != null ) {
51- maven { url = kotlinDevUrl }
50+ val kotlinRepoUrl = providers.gradleProperty(" kotlin_repo_url" ).orNull
51+ if (kotlinRepoUrl != null ) {
52+ maven(kotlinRepoUrl)
5253 }
5354}
5455
5556pluginBundle {
56- website = ' https://github.com/Kotlin/kotlinx-benchmark'
57- vcsUrl = ' https://github.com/Kotlin/kotlinx-benchmark.git'
58- tags = [ ' benchmarking' , ' multiplatform' , ' kotlin' ]
57+ website = " https://github.com/Kotlin/kotlinx-benchmark"
58+ vcsUrl = " https://github.com/Kotlin/kotlinx-benchmark.git"
59+ tags = listOf ( " benchmarking" , " multiplatform" , " kotlin" )
5960}
6061
6162gradlePlugin {
6263 plugins {
63- benchmarkPlugin {
64+ register( " benchmarkPlugin" ) {
6465 id = " org.jetbrains.kotlinx.benchmark"
6566 implementationClass = " kotlinx.benchmark.gradle.BenchmarksPlugin"
6667 displayName = " Gradle plugin for benchmarking"
@@ -71,24 +72,24 @@ gradlePlugin {
7172
7273sourceSets {
7374 main {
74- kotlin. srcDirs = [ ' main/src' ]
75- java. srcDirs = [ ' main/src' ]
76- resources. srcDirs = [ ' main/resources' ]
75+ kotlin.srcDirs( listOf ( " main/src" ))
76+ java.srcDirs( listOf ( " main/src" ))
77+ resources.srcDirs( listOf ( " main/resources" ))
7778 }
7879 test {
79- kotlin. srcDirs = [ ' test/src' ]
80- java. srcDirs = [ ' test/src' ]
81- resources. srcDirs = [ ' test/resources' ]
80+ kotlin.srcDirs( " test/src" )
81+ java.srcDirs( " test/src" )
82+ resources.srcDirs( " test/resources" )
8283 }
8384}
8485
85- tasks. named( " compileKotlin" , KotlinCompilationTask . class) {
86+ tasks.compileKotlin {
8687 compilerOptions {
8788 optIn.addAll(
8889 " kotlinx.benchmark.gradle.internal.KotlinxBenchmarkPluginInternalApi" ,
8990 " kotlin.RequiresOptIn" ,
9091 )
91- // noinspection GrDeprecatedAPIUsage
92+ @Suppress( " DEPRECATION " )
9293 apiVersion = KotlinVersion .KOTLIN_1_4 // the version of Kotlin embedded in Gradle
9394 }
9495}
@@ -107,34 +108,34 @@ dependencies {
107108 compileOnly(libs.jmh.generatorBytecode) // used in worker
108109}
109110
110- def generatePluginConstants = tasks. register( " generatePluginConstants " ) {
111+ val generatePluginConstants by tasks.registering {
111112 description = " Generates constants file used by BenchmarksPlugin"
112113
113- File outputDir = temporaryDir
114+ val outputDir = temporaryDir
114115 outputs.dir(outputDir).withPropertyName(" outputDir" )
115116
116- File constantsKtFile = new File (outputDir, " BenchmarksPluginConstants.kt" )
117+ val constantsKtFile = File (outputDir, " BenchmarksPluginConstants.kt" )
117118
118- Provider< String > benchmarkPluginVersion = project. providers. gradleProperty(" releaseVersion" )
119+ val benchmarkPluginVersion = project.providers.gradleProperty(" releaseVersion" )
119120 .orElse(project.version.toString())
120121 inputs.property(" benchmarkPluginVersion" , benchmarkPluginVersion)
121122
122- Provider< String > minSupportedGradleVersion = libs. versions. minSupportedGradle
123+ val minSupportedGradleVersion = libs.versions.minSupportedGradle
123124 inputs.property(" minSupportedGradleVersion" , minSupportedGradleVersion)
124125
125- Provider< String > kotlinCompilerVersion = libs. versions. kotlin
126+ val kotlinCompilerVersion = libs.versions.kotlin
126127 inputs.property(" kotlinCompilerVersion" , kotlinCompilerVersion)
127128
128129 doLast {
129- constantsKtFile. write (
130+ constantsKtFile.writeText (
130131 """ |package kotlinx.benchmark.gradle.internal
131132 |
132133 |internal object BenchmarksPluginConstants {
133134 | const val BENCHMARK_PLUGIN_VERSION = "${benchmarkPluginVersion.get()} "
134135 | const val MIN_SUPPORTED_GRADLE_VERSION = "${minSupportedGradleVersion.get()} "
135136 | const val DEFAULT_KOTLIN_COMPILER_VERSION = "${kotlinCompilerVersion.get()} "
136137 |}
137- |""" . stripMargin ()
138+ |""" .trimMargin ()
138139 )
139140 }
140141}
@@ -151,16 +152,16 @@ if (project.findProperty("publication_repository") == "space") {
151152 repositories {
152153 maven {
153154 name = " space"
154- url = " https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/dev"
155+ url = uri( " https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/dev" )
155156 credentials {
156- username = project. findProperty(" space.user" )
157- password = project. findProperty(" space.token" )
157+ username = project.findProperty(" space.user" ) as ? String?
158+ password = project.findProperty(" space.token" ) as ? String?
158159 }
159160 }
160161 }
161162 }
162163}
163164
164165apiValidation {
165- nonPublicMarkers + = [ " kotlinx.benchmark.gradle.internal.KotlinxBenchmarkPluginInternalApi" ]
166+ nonPublicMarkers + = listOf ( " kotlinx.benchmark.gradle.internal.KotlinxBenchmarkPluginInternalApi" )
166167}
0 commit comments