1 import org.jetbrains.kotlin.config.KotlinCompilerVersion 2 import org.jetbrains.kotlin.gradle.dsl.* 3 import org.gradle.kotlin.dsl.* 4 <lambda>null5buildscript { 6 if (shouldUseLocalMaven(rootProject)) { 7 repositories { 8 mavenLocal() 9 } 10 } 11 12 repositories { 13 mavenCentral() 14 maven(url = "https://plugins.gradle.org/m2/") 15 addDevRepositoryIfEnabled(this, project) 16 mavenLocal() 17 } 18 19 dependencies { 20 // Please ensure that atomicfu-gradle-plugin is added to the classpath first, do not change the order, for details see #3984. 21 // The corresponding issue in kotlinx-atomicfu: https://github.com/Kotlin/kotlinx-atomicfu/issues/384 22 classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${version("atomicfu")}") 23 classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${version("kotlin")}") 24 classpath("org.jetbrains.dokka:dokka-gradle-plugin:${version("dokka")}") 25 classpath("org.jetbrains.kotlinx:kotlinx-knit:${version("knit")}") 26 classpath("org.jetbrains.kotlinx:binary-compatibility-validator:${version("binary_compatibility_validator")}") 27 classpath("ru.vyarus:gradle-animalsniffer-plugin:${version("animalsniffer")}") // Android API check 28 classpath("org.jetbrains.kotlin:atomicfu:${version("kotlin")}") 29 classpath("org.jetbrains.kotlinx:kover-gradle-plugin:${version("kover")}") 30 31 // JMH plugins 32 classpath("gradle.plugin.com.github.johnrengelman:shadow:${version("shadow")}") 33 } 34 35 with(CacheRedirector) { buildscript.configureBuildScript(rootProject) } 36 } 37 38 // Configure subprojects with Kotlin sources 39 apply(plugin = "configure-compilation-conventions") 40 <lambda>null41allprojects { 42 val deployVersion = properties["DeployVersion"] 43 if (deployVersion != null) version = deployVersion 44 45 if (isSnapshotTrainEnabled(rootProject)) { 46 val skipSnapshotChecks = rootProject.properties["skip_snapshot_checks"] != null 47 if (!skipSnapshotChecks && version != version("atomicfu")) { 48 throw IllegalStateException("Current deploy version is $version, but atomicfu version is not overridden (${version("atomicfu")}) for $this") 49 } 50 } 51 52 if (shouldUseLocalMaven(rootProject)) { 53 repositories { 54 mavenLocal() 55 } 56 } 57 58 // This project property is set during nightly stress test 59 val stressTest = project.properties["stressTest"] 60 // Copy it to all test tasks 61 tasks.withType(Test::class).configureEach { 62 if (stressTest != null) { 63 systemProperty("stressTest", stressTest) 64 } 65 } 66 } 67 <lambda>null68plugins { 69 id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2" 70 } 71 72 apply(plugin = "base") 73 apply(plugin = "kover-conventions") 74 <lambda>null75apiValidation { 76 ignoredProjects += unpublished + listOf("kotlinx-coroutines-bom") 77 if (isSnapshotTrainEnabled(rootProject)) { 78 ignoredProjects += coreModule 79 } 80 ignoredPackages += "kotlinx.coroutines.internal" 81 } 82 83 // Configure repositories <lambda>null84allprojects { 85 repositories { 86 /* 87 * google should be first in the repository list because some of the play services 88 * transitive dependencies was removed from jcenter, thus breaking gradle dependency resolution 89 */ 90 google() 91 mavenCentral() 92 addDevRepositoryIfEnabled(this, project) 93 } 94 } 95 96 // needs to be before evaluationDependsOn due to weird Gradle ordering 97 apply(plugin = "animalsniffer-conventions") 98 <lambda>null99configure(subprojects.filter { !sourceless.contains(it.name) }) { 100 if (isMultiplatform) { 101 apply(plugin = "kotlin-multiplatform") 102 apply(plugin = "kotlin-multiplatform-conventions") 103 } else if (platformOf(this) == "jvm") { 104 apply(plugin = "kotlin-jvm-conventions") 105 } else { 106 val platform = platformOf(this) 107 throw IllegalStateException("No configuration rules for $platform") 108 } 109 } 110 <lambda>null111configure(subprojects.filter { !sourceless.contains(it.name) && it.name != testUtilsModule }) { 112 if (isMultiplatform) { <lambda>null113 configure<KotlinMultiplatformExtension> { 114 sourceSets.commonTest.dependencies { implementation(project(":$testUtilsModule")) } 115 } 116 } else { <lambda>null117 dependencies { add("testImplementation", project(":$testUtilsModule")) } 118 } 119 } 120 121 // Add dependency to the core module in all the other subprojects. <lambda>null122configure(subprojects.filter { !sourceless.contains(it.name) && it.name != coreModule }) { 123 evaluationDependsOn(":$coreModule") 124 if (isMultiplatform) { <lambda>null125 configure<KotlinMultiplatformExtension> { 126 sourceSets.commonMain.dependencies { api(project(":$coreModule")) } 127 } 128 } else { <lambda>null129 dependencies { add("api", project(":$coreModule")) } 130 } 131 } 132 133 apply(plugin = "bom-conventions") 134 apply(plugin = "java-modularity-conventions") 135 apply(plugin = "version-file-conventions") 136 137 rootProject.configureCommunityBuildTweaks() 138 139 apply(plugin = "source-set-conventions") 140 apply(plugin = "dokka-conventions") 141 apply(plugin = "knit-conventions") 142 143 /* 144 * TODO: core and non-core cannot be configured via 'configure(subprojects)' 145 * because of 'afterEvaluate' issue. This one should be migrated to 146 * `plugins { id("pub-conventions") }` eventually 147 */ <lambda>null148configure(subprojects.filter { 149 !unpublished.contains(it.name) && it.name != coreModule 150 }) { 151 apply(plugin = "pub-conventions") 152 } 153 154 AuxBuildConfiguration.configure(rootProject) 155 rootProject.registerTopLevelDeployTask() 156 157 // Report Kotlin compiler version when building project 158 println("Using Kotlin compiler version: ${KotlinCompilerVersion.VERSION}") 159 160