Skip to content

Commit

Permalink
project: Update to Kotlin 1.8.10 and Gradle 8
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobkmar committed Mar 4, 2023
1 parent 9a9a386 commit 3641296
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 39 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {

allprojects {
group = "net.silkmc"
version = "1.9.5"
version = "1.9.6"
if (this.name.startsWith("silk")) {
description = "Silk is a Minecraft API for Kotlin"
}
Expand Down
18 changes: 8 additions & 10 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,34 @@ repositories {
gradlePluginPortal()
maven("https://maven.fabricmc.net/")
maven("https://maven.quiltmc.org/repository/release")
maven("https://server.bbkr.space/artifactory/libs-release/")
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://repo.papermc.io/repository/maven-public/")
}

dependencies {
fun pluginDep(id: String, version: String) = "${id}:${id}.gradle.plugin:${version}"

val kotlinVersion = "1.7.21"
val kotlinVersion = "1.8.10"

compileOnly(kotlin("gradle-plugin", embeddedKotlinVersion))
runtimeOnly(kotlin("gradle-plugin", kotlinVersion))
compileOnly(pluginDep("org.jetbrains.kotlin.plugin.serialization", embeddedKotlinVersion))
runtimeOnly(pluginDep("org.jetbrains.kotlin.plugin.serialization", kotlinVersion))

implementation(pluginDep("fabric-loom", "1.0-SNAPSHOT"))
implementation(pluginDep("fabric-loom", "1.1-SNAPSHOT"))
implementation(pluginDep("io.github.juuxel.loom-quiltflower", "1.8.0"))
implementation(pluginDep("org.quiltmc.quilt-mappings-on-loom", "4.2.3"))
implementation(pluginDep("com.matthewprenger.cursegradle", "1.4.0"))
implementation(pluginDep("com.modrinth.minotaur", "2.3.1"))
implementation(pluginDep("com.modrinth.minotaur", "2.7.2"))

implementation(pluginDep("io.papermc.paperweight.userdev", "1.3.11"))
implementation(pluginDep("io.papermc.paperweight.userdev", "1.5.0"))
implementation(pluginDep("xyz.jpenilla.run-paper", "1.1.0"))

val compileDokkaVersion = "1.7.10"
val dokkaVersion = "1.7.20"
val compileDokkaVersion = "1.8.10"
val dokkaVersion = "1.8.10"

compileOnly("org.jetbrains.dokka:dokka-gradle-plugin:$compileDokkaVersion")
runtimeOnly("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion")
compileOnly("org.jetbrains.dokka:dokka-base:$compileDokkaVersion")
runtimeOnly("org.jetbrains.dokka:dokka-base:$dokkaVersion")

implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
}
16 changes: 7 additions & 9 deletions buildSrc/src/main/kotlin/BuildConstants.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import com.modrinth.minotaur.request.VersionType
import org.gradle.api.Project

object BuildConstants {
val Project.isSnapshot get() = version.toString().endsWith("-SNAPSHOT")
val Project.projectState get() = if (isSnapshot) "beta" else "release"
val Project.projectStateType get() = if (isSnapshot) VersionType.BETA else VersionType.RELEASE

const val projectTitle = "Silk"

Expand All @@ -16,15 +14,15 @@ object BuildConstants {

const val majorMinecraftVersion = "1.19"

// check these values here: https://axay.net/mcdev
// check these values here: https://jakobk.net/mcdev
const val minecraftVersion = "1.19.3"
const val parchmentMappingsVersion = "1.19.2:2022.11.20"
const val fabricLoaderVersion = "0.14.11"
const val fabricApiVersion = "0.69.0+1.19.3"
const val fabricLanguageKotlinVersion = "1.8.6+kotlin.1.7.21"
const val parchmentMappingsVersion = "1.19.3:2023.02.26"
const val fabricLoaderVersion = "0.14.14"
const val fabricApiVersion = "0.75.1+1.19.3"
const val fabricLanguageKotlinVersion = "1.9.1+kotlin.1.8.10"

const val kotestVersion = "5.5.4"
const val mockkVersion = "1.13.2"
const val kotestVersion = "5.5.5"
const val mockkVersion = "1.13.4"

val uploadModules = listOf(
"commands",
Expand Down
22 changes: 9 additions & 13 deletions buildSrc/src/main/kotlin/kotlin-project-script.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,22 @@ repositories {
}

tasks {
withType<JavaCompile> {
options.apply {
release.set(17)
encoding = "UTF-8"
}
}

withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs += "-Xcontext-receivers"
}
}
}

kotlin.sourceSets.all {
languageSettings {
if (project.name.removePrefix(rootProject.name + "-") in BuildConstants.uploadModules) {
listOf("InternalSilkApi", "DelicateSilkApi", "ExperimentalSilkApi").forEach {
optIn("net.silkmc.silk.core.annotations.${it}")
kotlin {
jvmToolchain(17)

sourceSets.all {
languageSettings {
if (project.name.removePrefix(rootProject.name + "-") in BuildConstants.uploadModules) {
listOf("InternalSilkApi", "DelicateSilkApi", "ExperimentalSilkApi").forEach {
optIn("net.silkmc.silk.core.annotations.${it}")
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion buildSrc/src/main/kotlin/mod-build-script.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ plugins {
kotlin("jvm")
id("fabric-loom")
id("io.github.juuxel.loom-quiltflower")
id("org.quiltmc.quilt-mappings-on-loom")
}

repositories {
Expand Down
3 changes: 1 addition & 2 deletions buildSrc/src/main/kotlin/mod-upload-script.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import BuildConstants.majorMinecraftVersion
import BuildConstants.minecraftVersion
import BuildConstants.modrinthId
import BuildConstants.projectState
import BuildConstants.projectStateType
import com.matthewprenger.cursegradle.CurseProject
import com.matthewprenger.cursegradle.CurseRelation
import com.matthewprenger.cursegradle.Options
Expand Down Expand Up @@ -32,7 +31,7 @@ modrinth {

projectId.set(modrinthId)
versionNumber.set(rootProject.version.toString())
versionType.set(projectStateType.name)
versionType.set(projectState)
gameVersions.set(listOf(minecraftVersion))
loaders.set(listOf("fabric"))

Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
kotlin.code.style=official
org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true
#org.gradle.parallel=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion silk-all/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

dependencies {
BuildConstants.uploadModules.forEach {
include(modProject(":${rootProject.name}-${it}"))
implementation(include(modProject(":${rootProject.name}-${it}"))!!)
}
}

Expand Down

0 comments on commit 3641296

Please sign in to comment.