|
| 1 | +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
1 | 2 | import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
|
2 |
| -import java.net.URI |
3 | 3 |
|
4 | 4 | plugins {
|
5 | 5 | `kotlin-dsl`
|
| 6 | + `version-catalog` |
6 | 7 | }
|
7 | 8 |
|
8 | 9 | repositories {
|
9 | 10 | google()
|
10 | 11 | jcenter()
|
11 | 12 | mavenCentral()
|
| 13 | + gradlePluginPortal() |
12 | 14 | maven {
|
13 |
| - url = URI("https://www.jitpack.io") |
| 15 | + setUrl("https://plugins.gradle.org/m2/") |
14 | 16 | }
|
15 | 17 | }
|
16 | 18 |
|
17 |
| -tasks.withType(KotlinJvmCompile::class.java) { |
| 19 | +tasks.withType(KotlinCompile::class) { |
| 20 | + sourceCompatibility = "11" |
| 21 | + targetCompatibility = "11" |
| 22 | +} |
| 23 | + |
| 24 | +tasks.withType(KotlinJvmCompile::class) { |
18 | 25 | kotlinOptions {
|
19 | 26 | jvmTarget = "11"
|
20 | 27 | }
|
21 | 28 | }
|
22 | 29 |
|
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() |
31 | 35 |
|
32 | 36 | dependencies {
|
33 | 37 | /* 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")) |
35 | 39 |
|
36 | 40 | /* 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")) |
38 | 42 |
|
39 | 43 | /** Dependency management */
|
40 |
| - implementation("com.github.ben-manes:gradle-versions-plugin:$manesVersion") |
| 44 | + implementation(library("gradle-versions")) |
41 | 45 |
|
42 | 46 | /* Depend on the default Gradle API's since we want to build a custom plugin */
|
43 | 47 | implementation(gradleApi())
|
|
0 commit comments