Skip to content

Commit 8648263

Browse files
committed
Migrate build.gradle.kts
1 parent e9ebc0f commit 8648263

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

buildSrc/build.gradle.kts

+18-14
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,47 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
12
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
2-
import java.net.URI
33

44
plugins {
55
`kotlin-dsl`
6+
`version-catalog`
67
}
78

89
repositories {
910
google()
1011
jcenter()
1112
mavenCentral()
13+
gradlePluginPortal()
1214
maven {
13-
url = URI("https://www.jitpack.io")
15+
setUrl("https://plugins.gradle.org/m2/")
1416
}
1517
}
1618

17-
tasks.withType(KotlinJvmCompile::class.java) {
19+
tasks.withType(KotlinCompile::class) {
20+
sourceCompatibility = "11"
21+
targetCompatibility = "11"
22+
}
23+
24+
tasks.withType(KotlinJvmCompile::class) {
1825
kotlinOptions {
1926
jvmTarget = "11"
2027
}
2128
}
2229

23-
java {
24-
sourceCompatibility = JavaVersion.VERSION_11
25-
targetCompatibility = JavaVersion.VERSION_11
26-
}
27-
28-
val buildToolsVersion = "7.3.1"
29-
val kotlinVersion = "1.7.21"
30-
val manesVersion = "0.44.0"
30+
fun Project.library(alias: String) =
31+
extensions.getByType<VersionCatalogsExtension>()
32+
.named("libs")
33+
.findLibrary(alias)
34+
.get()
3135

3236
dependencies {
3337
/* Depend on the android gradle plugin, since we want to access it in our plugin */
34-
implementation("com.android.tools.build:gradle:$buildToolsVersion")
38+
implementation(library("android-gradle-plugin"))
3539

3640
/* Depend on the kotlin plugin, since we want to access it in our plugin */
37-
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
41+
implementation(library("jetbrains-kotlin-gradle"))
3842

3943
/** Dependency management */
40-
implementation("com.github.ben-manes:gradle-versions-plugin:$manesVersion")
44+
implementation(library("gradle-versions"))
4145

4246
/* Depend on the default Gradle API's since we want to build a custom plugin */
4347
implementation(gradleApi())

0 commit comments

Comments
 (0)