forked from Kotlin/kotlinx-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
113 lines (91 loc) · 3.26 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapperKt
import tasks.CheckReadmeTask
buildscript {
repositories {
maven { url 'https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/maven' }
gradlePluginPortal()
KotlinCommunity.addDevRepositoryIfEnabled(delegate, project)
}
dependencies {
classpath(libs.kotlinx.teamInfraGradlePlugin)
String kotlinVersion = providers.gradleProperty("kotlin_version").orNull
if (kotlinVersion != null && !kotlinVersion.isBlank()) {
// In addition to overriding the Kotlin version in the Version Catalog,
// also enforce the KGP version using a dependency constraint.
// Constraints are stricter than Version Catalog.
constraints {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}
}
}
plugins {
id("base")
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlinx.binaryCompatibilityValidator)
}
apply plugin: 'kotlinx.team.infra'
infra {
teamcity {
libraryStagingRepoDescription = project.name
}
publishing {
include(":kotlinx-benchmark-runtime")
libraryRepoUrl = "https://github.com/Kotlin/kotlinx-benchmark"
if (project.findProperty("publication_repository") == "sonatype") {
sonatype {}
}
}
}
// https://youtrack.jetbrains.com/issue/KT-48410
repositories {
mavenCentral()
}
// region Workarounds for https://github.com/gradle/gradle/issues/22335
tasks.register("apiDump") {
it.dependsOn(gradle.includedBuild("plugin").task(":apiDump"))
}
afterEvaluate {
gradle.includedBuilds.forEach { included ->
project(":kotlinx-benchmark-runtime").tasks.named("publishToMavenLocal") { dependsOn(included.task(":publishToMavenLocal")) }
}
}
//endregion
String currentKgpVersion = KotlinPluginWrapperKt.getKotlinPluginVersion(project)
logger.info("Using Kotlin Gradle Plugin ${currentKgpVersion}")
String kotlinVersionOverride = providers.gradleProperty("kotlin_version").getOrNull()
if (kotlinVersionOverride != null) {
String versionCatalogKotlinVersion = libs.versions.kotlin.get()
if (kotlinVersionOverride != versionCatalogKotlinVersion) {
throw new IllegalStateException("Kotlin version in Version Catalog was not overridden. Expected:$kotlinVersionOverride, actual:$versionCatalogKotlinVersion.")
}
if (kotlinVersionOverride != currentKgpVersion) {
throw new IllegalStateException("Kotlin Gradle Plugin version was not overridden. Expected:$kotlinVersionOverride, actual:$currentKgpVersion.")
}
}
allprojects {
repositories {
KotlinCommunity.addDevRepositoryIfEnabled(delegate, project)
}
}
apiValidation {
ignoredProjects += [
"examples",
"java",
"kotlin",
"kotlin-kts",
"kotlin-multiplatform",
"integration",
]
nonPublicMarkers += ["kotlinx.benchmark.internal.KotlinxBenchmarkRuntimeInternalApi"]
klib {
it.enabled = true
}
}
tasks.register("checkReadme", CheckReadmeTask) {
minSupportedGradleVersion = libs.versions.minSupportedGradle
readme = file("README.md")
}
tasks.check {
dependsOn(tasks.named("checkReadme"))
}