generated from JavierSegoviaCordoba/kotlin-template-javiersc
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
settings.gradle.kts
93 lines (80 loc) · 2.8 KB
/
settings.gradle.kts
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
import com.javiersc.semver.project.gradle.plugin.SemverExtension
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
pluginManagement {
val hubdleVersion: String =
file("$rootDir/gradle/libs.versions.toml")
.readLines()
.first { it.contains("hubdle") }
.split("\"")[1]
repositories {
gradlePluginPortal()
mavenCentral()
google()
// maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
// maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
// maven("https://oss.sonatype.org/content/repositories/snapshots")
// mavenLocal()
}
plugins { //
id("com.javiersc.hubdle") version hubdleVersion
}
}
plugins { //
id("com.javiersc.hubdle")
}
dependencyResolutionManagement {
repositories {
gradlePluginPortal()
mavenCentral()
google()
// maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
// maven(url = "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
// sonatypeSnapshot()
// mavenLocal()
}
}
buildscript {
dependencies {
val kotlinVersion: String =
file("$rootDir/gradle/libs.versions.toml")
.readLines()
.first { it.contains("jetbrains-kotlin") }
.split("\"")[1]
val kotlinModule =
file("$rootDir/gradle/libs.versions.toml")
.readLines()
.first { it.contains("jetbrains-kotlin-gradle-plugin") }
.split("\"")[1]
val kotlinDependency = "$kotlinModule:$kotlinVersion"
classpath(kotlinDependency)
}
}
val catalogFile = file("$rootDir/gradle/libs.versions.toml").readLines()
val hubdleCatalogVersion: String =
catalogFile.first { it.contains("hubdleCatalog =") }.split("\"")[1]
val kotlinCompilerExtensionsVersion: String =
catalogFile.first { it.contains("javiersc-kotlin-compiler-extensions =") }.split("\"")[1]
val kotlinVersion: String =
catalogFile
.first { it.contains("jetbrains-kotlin") }
.split("\"")[1]
hubdleSettings {
catalog { //
version(hubdleCatalogVersion)
replaceVersion(
"javiersc-kotlin-compiler-extensions" to kotlinCompilerExtensionsVersion,
"jetbrains-kotlin" to kotlinVersion,
)
}
}
settings.gradle.beforeProject {
pluginManager.withPlugin("com.javiersc.semver") {
val kotlinVersion: String = getKotlinPluginVersion(logger)
project.configure<SemverExtension> {
mapVersion { gradleVersion ->
val metadata = gradleVersion.metadata?.let { "$kotlinVersion-$it" } ?: kotlinVersion
"${gradleVersion.copy(metadata = metadata)}"
}
}
}
}