1
1
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
2
- import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
2
+ import kotlinx.team.infra.InfraExtension
3
3
4
4
buildscript {
5
- ext. kotlinDevUrl = rootProject. properties[" kotlin_repo_url" ]
6
5
repositories {
7
- maven { url ' https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/maven' }
6
+ maven( " https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/maven" )
8
7
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)
11
11
}
12
12
}
13
13
@@ -21,16 +21,16 @@ buildscript {
21
21
}
22
22
23
23
plugins {
24
- id ' java-gradle-plugin'
25
- id ' maven-publish'
24
+ ` java- gradle- plugin`
25
+ ` maven- publish`
26
26
alias(libs.plugins.gradle.pluginPublish)
27
27
alias(libs.plugins.kotlinx.binaryCompatibilityValidator)
28
28
alias(libs.plugins.kotlin.jvm)
29
29
}
30
30
31
- apply(plugin : ' kotlinx.team.infra' )
31
+ apply (plugin = " kotlinx.team.infra" )
32
32
33
- infra {
33
+ extensions.configure< InfraExtension > {
34
34
teamcity {
35
35
libraryStagingRepoDescription = project.name
36
36
}
@@ -47,20 +47,21 @@ repositories {
47
47
mavenCentral()
48
48
gradlePluginPortal()
49
49
50
- if (kotlinDevUrl != null ) {
51
- maven { url = kotlinDevUrl }
50
+ val kotlinRepoUrl = providers.gradleProperty(" kotlin_repo_url" ).orNull
51
+ if (kotlinRepoUrl != null ) {
52
+ maven(kotlinRepoUrl)
52
53
}
53
54
}
54
55
55
56
pluginBundle {
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" )
59
60
}
60
61
61
62
gradlePlugin {
62
63
plugins {
63
- benchmarkPlugin {
64
+ register( " benchmarkPlugin" ) {
64
65
id = " org.jetbrains.kotlinx.benchmark"
65
66
implementationClass = " kotlinx.benchmark.gradle.BenchmarksPlugin"
66
67
displayName = " Gradle plugin for benchmarking"
@@ -71,24 +72,24 @@ gradlePlugin {
71
72
72
73
sourceSets {
73
74
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" ))
77
78
}
78
79
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" )
82
83
}
83
84
}
84
85
85
- tasks. named( " compileKotlin" , KotlinCompilationTask . class) {
86
+ tasks.compileKotlin {
86
87
compilerOptions {
87
88
optIn.addAll(
88
89
" kotlinx.benchmark.gradle.internal.KotlinxBenchmarkPluginInternalApi" ,
89
90
" kotlin.RequiresOptIn" ,
90
91
)
91
- // noinspection GrDeprecatedAPIUsage
92
+ @Suppress( " DEPRECATION " )
92
93
apiVersion = KotlinVersion .KOTLIN_1_4 // the version of Kotlin embedded in Gradle
93
94
}
94
95
}
@@ -107,34 +108,34 @@ dependencies {
107
108
compileOnly(libs.jmh.generatorBytecode) // used in worker
108
109
}
109
110
110
- def generatePluginConstants = tasks. register( " generatePluginConstants " ) {
111
+ val generatePluginConstants by tasks.registering {
111
112
description = " Generates constants file used by BenchmarksPlugin"
112
113
113
- File outputDir = temporaryDir
114
+ val outputDir = temporaryDir
114
115
outputs.dir(outputDir).withPropertyName(" outputDir" )
115
116
116
- File constantsKtFile = new File (outputDir, " BenchmarksPluginConstants.kt" )
117
+ val constantsKtFile = File (outputDir, " BenchmarksPluginConstants.kt" )
117
118
118
- Provider< String > benchmarkPluginVersion = project. providers. gradleProperty(" releaseVersion" )
119
+ val benchmarkPluginVersion = project.providers.gradleProperty(" releaseVersion" )
119
120
.orElse(project.version.toString())
120
121
inputs.property(" benchmarkPluginVersion" , benchmarkPluginVersion)
121
122
122
- Provider< String > minSupportedGradleVersion = libs. versions. minSupportedGradle
123
+ val minSupportedGradleVersion = libs.versions.minSupportedGradle
123
124
inputs.property(" minSupportedGradleVersion" , minSupportedGradleVersion)
124
125
125
- Provider< String > kotlinCompilerVersion = libs. versions. kotlin
126
+ val kotlinCompilerVersion = libs.versions.kotlin
126
127
inputs.property(" kotlinCompilerVersion" , kotlinCompilerVersion)
127
128
128
129
doLast {
129
- constantsKtFile. write (
130
+ constantsKtFile.writeText (
130
131
""" |package kotlinx.benchmark.gradle.internal
131
132
|
132
133
|internal object BenchmarksPluginConstants {
133
134
| const val BENCHMARK_PLUGIN_VERSION = "${benchmarkPluginVersion.get()} "
134
135
| const val MIN_SUPPORTED_GRADLE_VERSION = "${minSupportedGradleVersion.get()} "
135
136
| const val DEFAULT_KOTLIN_COMPILER_VERSION = "${kotlinCompilerVersion.get()} "
136
137
|}
137
- |""" . stripMargin ()
138
+ |""" .trimMargin ()
138
139
)
139
140
}
140
141
}
@@ -151,16 +152,16 @@ if (project.findProperty("publication_repository") == "space") {
151
152
repositories {
152
153
maven {
153
154
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" )
155
156
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?
158
159
}
159
160
}
160
161
}
161
162
}
162
163
}
163
164
164
165
apiValidation {
165
- nonPublicMarkers + = [ " kotlinx.benchmark.gradle.internal.KotlinxBenchmarkPluginInternalApi" ]
166
+ nonPublicMarkers + = listOf ( " kotlinx.benchmark.gradle.internal.KotlinxBenchmarkPluginInternalApi" )
166
167
}
0 commit comments