Skip to content

Commit 1ba169a

Browse files
committed
chore: move to version catalog, ensuring versioning on all dependencies
1 parent c5a1c14 commit 1ba169a

2 files changed

Lines changed: 25 additions & 24 deletions

File tree

gradle/libs.versions.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[versions]
2+
kotlin = "2.3.10"
3+
[libraries]
4+
kotlin_bom = { group = "org.jetbrains.kotlin", name = "kotlin-bom", version.ref = "kotlin" }
5+
kotlin_stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" }
6+
kotlin_test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" }
7+
kotlin_junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" }
8+
[bundles]
9+
kotlin = [ "kotlin_stdlib" ]
10+
test = [ "kotlin_test", "kotlin_junit" ]
11+
[plugins]
12+
kotlin_jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

lib/build.gradle.kts

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,18 @@
1-
val jvmVersion = 21
2-
31
plugins {
4-
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
5-
id("org.jetbrains.kotlin.jvm") version "2.2.20"
6-
7-
// Apply the java-library plugin for API and implementation separation.
2+
alias(libs.plugins.kotlin.jvm)
83
`java-library`
94
`maven-publish`
105
}
116

127
repositories {
13-
// Use Maven Central for resolving dependencies.
148
mavenCentral()
9+
mavenLocal()
1510
}
1611

1712
dependencies {
18-
// Align versions of all Kotlin components
19-
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
20-
21-
// Use the Kotlin JDK 8 standard library.
22-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
23-
24-
// Use the Kotlin test library.
25-
testImplementation("org.jetbrains.kotlin:kotlin-test")
26-
27-
// Use the Kotlin JUnit integration.
28-
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
13+
implementation(platform(libs.kotlin.bom))
14+
implementation(libs.bundles.kotlin)
15+
testImplementation(libs.bundles.test)
2916
}
3017

3118
publishing {
@@ -34,28 +21,30 @@ publishing {
3421
name = "GitHubPackages"
3522
url = uri("https://maven.pkg.github.com/venture-falcon/capsule")
3623
credentials {
37-
username = System.getenv("GPR_USER")
38-
password = System.getenv("GPR_TOKEN")
24+
val user = properties["gpr.user"] ?: System.getenv("GPR_USER")
25+
val token = properties["gpr.token"] ?: System.getenv("GPR_TOKEN")
26+
username = requireNotNull(user.toString()) { "Found no username for GitHub packages access" }
27+
password = requireNotNull(token.toString()) { "Found no token for GitHub packages access" }
3928
}
4029
}
4130
}
4231
publications {
4332
register<MavenPublication>("gpr") {
4433
groupId = "io.nexure"
4534
artifactId = "capsule"
46-
version = project.findProperty("versionId") as String?
35+
version = "3.2.1"
4736
from(components["java"])
4837
}
4938
}
5039
}
5140

41+
kotlin { jvmToolchain(21) }
42+
5243
java {
5344
sourceCompatibility = JavaVersion.VERSION_21
5445
targetCompatibility = JavaVersion.VERSION_21
5546
withJavadocJar()
5647
withSourcesJar()
5748
}
5849

59-
kotlin {
60-
jvmToolchain(jvmVersion)
61-
}
50+

0 commit comments

Comments
 (0)