Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into kotlin-2.1.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	buildSrc/src/main/kotlin/kord-multiplatform-module.gradle.kts
#	gradle/libs.versions.toml
  • Loading branch information
lukellmann committed Oct 18, 2024
2 parents 4afb307 + 8dad2e7 commit 6c7a852
Show file tree
Hide file tree
Showing 21 changed files with 169 additions and 97 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build docs with Gradle
run: ./gradlew --stacktrace --info dokkaHtmlMultiModule
run: ./gradlew --stacktrace --info :dokkaGeneratePublicationHtml
- name: Deploy docs to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/dokka/htmlMultiModule
folder: build/dokka/html
branch: gh-pages
git-config-name: GitHub Actions
git-config-email: [email protected]
Expand Down
43 changes: 42 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
# 0.15.0

## Additions

* Add `User.isSelf` (by @Taubsie in #950)
* Publish snapshots to https://repo.kord.dev/snapshots (#961)
* Document deprecation cycle of deprecated declarations (#969)
* Add `UserMessageCreateBuilder.enforceNonce` (by @DRSchlaubi in #971)
* Implement Monetization (by @viztea in #932)
* Add `MemberProfileAutoModerationRule` (#974)

## Changes

* Bump `DeprecationLevel`s after 0.14.0 (#944)
* Update Auto Moderation builders (#979)
* Link to JDK 23 in Dokka output (#980)

## Fixes

* Fix deserialization of members (by @NoComment1105 in #955)
* Fix deserialization of `Heartbeat` events (#957)
* Fix `getMemberOrNull` and `getGuildMembers` caching only user data (by @Galarzaa90 in #964)
* Fix misuse of reified type parameters (#981)

## Dependencies

Updated in #942, #954, #958, #975, #976, and #986 (not including dependencies only needed for developing Kord)

* Kotlin 1.9.24 -> 2.0.21
* Ktor 2.3.11 -> 3.0.0
* kotlinx.coroutines 1.8.1 -> 1.9.0
* kotlinx.serialization 1.6.3 -> 1.7.3
* kotlinx-datetime 0.6.0 -> 0.6.1
* kord-cache 0.4.0 -> 0.5.4
* kotlin-logging 6.0.9 -> 7.0.0
* SLF4J 2.0.13 -> 2.0.16
* kotlin-node 20.11.30-pre.751 -> 22.5.4-pre.818
* kotlin-multiplatform-bignum 0.3.9 -> 0.3.10
* Stately 2.0.7 -> 2.1.0
* AtomicFU 0.24.0 -> 0.25.0

# 0.14.0

## Additions
Expand Down Expand Up @@ -30,7 +71,7 @@ Updated in #920, #929 and #943
* kotlinx-datetime 0.5.0 -> 0.6.0
* kotlin-logging 6.0.1 -> 6.0.9
* SLF4J 2.0.9 -> 2.0.13
* kotlin-node 18.16.12-pre.619 -> 20.11.5-pre.751
* kotlin-node 18.16.12-pre.619 -> 20.11.30-pre.751
* kotlin-multiplatform-bignum 0.3.8 -> 0.3.9
* Stately 2.0.6 -> 2.0.7
* KSP 1.9.21-1.0.16 -> 1.9.24-1.0.20
Expand Down
11 changes: 10 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
org.jetbrains.dokka // for dokkaHtmlMultiModule task
org.jetbrains.dokka // for dokkaGeneratePublicationHtml task
}

repositories {
Expand All @@ -10,3 +10,12 @@ repositories {

group = Library.group
version = libraryVersion

dependencies {
dokka(projects.common)
dokka(projects.core)
dokka(projects.coreVoice)
dokka(projects.gateway)
dokka(projects.rest)
dokka(projects.voice)
}
39 changes: 27 additions & 12 deletions buildSrc/src/main/kotlin/Documentation.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import org.gradle.api.Project
import org.gradle.kotlin.dsl.assign
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
import java.net.URI
import org.gradle.kotlin.dsl.invoke
import org.jetbrains.dokka.gradle.DokkaExtension
import org.jetbrains.dokka.gradle.workers.ProcessIsolation

fun AbstractDokkaLeafTask.applyKordDokkaOptions() {
internal fun DokkaExtension.applyKordDokkaOptions(project: Project) {

// Dokka runs out of memory with the default maxHeapSize when ProcessIsolation is used
(dokkaGeneratorIsolation.get() as? ProcessIsolation)?.maxHeapSize = "1g"

moduleName = "kord-${project.name}"

failOnWarning = true
dokkaPublications.configureEach {
failOnWarning = true
}

dokkaSourceSets.configureEach {

Expand All @@ -16,17 +23,25 @@ fun AbstractDokkaLeafTask.applyKordDokkaOptions() {

sourceLink {
localDirectory = project.projectDir
remoteUrl = URI("https://github.com/kordlib/kord/blob/${project.commitHash}/${project.name}").toURL()
remoteUrl("https://github.com/kordlib/kord/blob/${project.commitHash}/${project.name}")
remoteLineSuffix = "#L"
}

externalDocumentationLink("https://kotlinlang.org/api/kotlinx.coroutines/")
externalDocumentationLink("https://kotlinlang.org/api/kotlinx.serialization/")
externalDocumentationLink(
url = "https://kotlinlang.org/api/kotlinx-datetime/",
packageListUrl = "https://kotlinlang.org/api/kotlinx-datetime/kotlinx-datetime/package-list",
)
externalDocumentationLink("https://api.ktor.io/")
externalDocumentationLinks {
register("kotlinx.coroutines") {
url("https://kotlinlang.org/api/kotlinx.coroutines/")
}
register("kotlinx.serialization") {
url("https://kotlinlang.org/api/kotlinx.serialization/")
}
register("kotlinx-datetime") {
url("https://kotlinlang.org/api/kotlinx-datetime/")
packageListUrl("https://kotlinlang.org/api/kotlinx-datetime/kotlinx-datetime/package-list")
}
register("Ktor") {
url("https://api.ktor.io/")
}
}

// don't list `TweetNaclFast` in docs
perPackageOption {
Expand Down
10 changes: 4 additions & 6 deletions buildSrc/src/main/kotlin/kord-module.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask

plugins {
org.jetbrains.kotlin.jvm
org.jetbrains.kotlin.plugin.serialization
Expand Down Expand Up @@ -36,15 +34,15 @@ kotlin {
}
}

dokka {
applyKordDokkaOptions(project)
}

tasks {
withType<Test>().configureEach {
useJUnitPlatform()
}

withType<AbstractDokkaLeafTask>().configureEach {
applyKordDokkaOptions()
}

withType<JavaCompile>().configureEach {
options.release = KORD_JVM_TARGET
}
Expand Down
19 changes: 12 additions & 7 deletions buildSrc/src/main/kotlin/kord-multiplatform-module.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest

plugins {
Expand Down Expand Up @@ -71,6 +70,10 @@ kotlin {
}
}

dokka {
applyKordDokkaOptions(project)
}

tasks {
withType<Test>().configureEach {
useJUnitPlatform()
Expand All @@ -80,7 +83,14 @@ tasks {
environment("PROJECT_ROOT", rootProject.projectDir.absolutePath)
}

for (task in listOf("compileKotlinJvm", "compileKotlinJs", "jvmSourcesJar", "jsSourcesJar")) {
for (task in listOf(
"compileKotlinJvm",
"compileKotlinJs",
"jvmSourcesJar",
"jsSourcesJar",
"dokkaGenerateModuleHtml",
"dokkaGeneratePublicationHtml",
)) {
named(task) {
dependsOn("kspCommonMainKotlinMetadata")
}
Expand All @@ -91,9 +101,4 @@ tasks {
dependsOn("kspCommonMainKotlinMetadata")
}
}

withType<AbstractDokkaLeafTask>().configureEach {
applyKordDokkaOptions()
dependsOn("kspCommonMainKotlinMetadata")
}
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/kord-publishing.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fun MavenPublication.registerDokkaJar() =
tasks.register<Jar>("${name}DokkaJar") {
archiveClassifier = "javadoc"
destinationDirectory = destinationDirectory.get().dir(name)
from(tasks.named("dokkaHtml"))
from(tasks.named("dokkaGeneratePublicationHtml"))
}

publishing {
Expand Down
1 change: 0 additions & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ kotlin {
}
nonJvmMain {
dependencies {
implementation(libs.ktor.utils)
implementation(libs.bignum)
implementation(libs.stately.collections)
}
Expand Down
23 changes: 17 additions & 6 deletions common/src/nonJvmMain/kotlin/DiscordBitSet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@ package dev.kord.common

import com.ionspin.kotlin.bignum.integer.BigInteger
import com.ionspin.kotlin.bignum.integer.Sign
import io.ktor.utils.io.core.*

internal actual fun formatIntegerFromLittleEndianLongArray(data: LongArray) =
withBuffer(data.size * Long.SIZE_BYTES) {
// need to convert from little-endian data to big-endian expected by BigInteger
writeFully(data.reversedArray())
BigInteger.fromByteArray(readBytes(), Sign.POSITIVE).toString()
internal actual fun formatIntegerFromLittleEndianLongArray(data: LongArray): String {
// need to convert from little-endian data to big-endian expected by BigInteger
val bytes = ByteArray(size = data.size * Long.SIZE_BYTES)
val lastIndex = data.lastIndex
for (i in 0..lastIndex) {
val offset = (lastIndex - i) * Long.SIZE_BYTES
val long = data[i]
bytes[offset] = (long ushr 56).toByte()
bytes[offset + 1] = (long ushr 48).toByte()
bytes[offset + 2] = (long ushr 40).toByte()
bytes[offset + 3] = (long ushr 32).toByte()
bytes[offset + 4] = (long ushr 24).toByte()
bytes[offset + 5] = (long ushr 16).toByte()
bytes[offset + 6] = (long ushr 8).toByte()
bytes[offset + 7] = long.toByte()
}
return BigInteger.fromByteArray(bytes, Sign.POSITIVE).toString()
}

internal actual fun parseNonNegativeIntegerToBigEndianByteArray(value: String): ByteArray = BigInteger
.parseString(value)
Expand Down
6 changes: 0 additions & 6 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,3 @@ apiValidation {
// https://github.com/Kotlin/binary-compatibility-validator/issues/88
ignoredProjects += "live-tests"
}

tasks {
dokkaHtmlMultiModule {
enabled = false
}
}
1 change: 0 additions & 1 deletion gateway/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ kotlin {
api(projects.common)

api(libs.bundles.ktor.client.serialization)
api(libs.ktor.client.websockets)

implementation(libs.kotlin.logging)

Expand Down
11 changes: 8 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# the version that is planned to be released next, snapshot versions for the 'main' branch are based on this
nextPlannedVersion=0.15.0
nextPlannedVersion=0.16.0

#dokka will run out of memory with the default meta space
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1024m
org.gradle.parallel=true
org.gradle.warning.mode=all
org.gradle.kotlin.dsl.allWarningsAsErrors=true
kotlin.code.style=official

# the Kotlin daemon runs out of memory with the default maximum heap size
kotlin.daemon.jvmargs=-Xmx2g

# https://kotlinlang.org/docs/dokka-migration.html#set-the-opt-in-flag
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true

# https://github.com/Kotlin/kotlinx-atomicfu/issues/448
# https://youtrack.jetbrains.com/issue/KT-64109#focus=Comments-27-10064206.0-0
kotlin.suppressGradlePluginWarnings=IncorrectCompileOnlyDependencyWarning
Expand Down
23 changes: 11 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

# api dependencies
kotlin = "2.1.0-dev-7621" # https://github.com/JetBrains/kotlin
ktor = "2.3.12" # https://github.com/ktorio/ktor
kotlinx-coroutines = "1.8.1" # https://github.com/Kotlin/kotlinx.coroutines
kotlinx-serialization = "1.7.2" # https://github.com/Kotlin/kotlinx.serialization
ktor = "3.0.0" # https://github.com/ktorio/ktor
kotlinx-coroutines = "1.9.0" # https://github.com/Kotlin/kotlinx.coroutines
kotlinx-serialization = "1.7.3" # https://github.com/Kotlin/kotlinx.serialization
kotlinx-datetime = "0.6.1" # https://github.com/Kotlin/kotlinx-datetime
kord-cache = "0.5.4" # https://github.com/kordlib/cache

# implementation dependencies
kotlin-logging = "7.0.0" # https://github.com/oshai/kotlin-logging
kotlin-logging-old = "3.0.5" # TODO remove after dependency is removed in rest, gateway, voice and core
slf4j = "2.0.16" # https://www.slf4j.org
kotlin-node = "20.14.10-pre.800" # https://github.com/JetBrains/kotlin-wrappers
kotlin-node = "22.5.4-pre.818" # https://github.com/JetBrains/kotlin-wrappers
bignum = "0.3.10" # https://github.com/ionspin/kotlin-multiplatform-bignum
stately = "2.1.0" # https://github.com/touchlab/Stately
fastZlib = "2.0.1" # https://github.com/timotejroiko/fast-zlib
Expand All @@ -22,16 +22,16 @@ ksp = "2.0.255-SNAPSHOT" # https://github.com/google/ksp
kotlinpoet = "1.18.1" # https://github.com/square/kotlinpoet

# tests
junit-jupiter = "5.11.0" # https://github.com/junit-team/junit5
junit-platform = "1.11.0"
mockk = "1.13.12" # https://github.com/mockk/mockk
junit-jupiter = "5.11.2" # https://github.com/junit-team/junit5
junit-platform = "1.11.2"
mockk = "1.13.13" # https://github.com/mockk/mockk
kbson = "0.4.0" # https://github.com/mongodb/kbson

# plugins
dokka = "1.9.20" # https://github.com/Kotlin/dokka
dokka = "2.0.0-Beta" # https://github.com/Kotlin/dokka
kotlinx-atomicfu = "0.25.0" # https://github.com/Kotlin/kotlinx-atomicfu
binary-compatibility-validator = "0.16.3" # https://github.com/Kotlin/binary-compatibility-validator
buildconfig = "5.4.0" # https://github.com/gmazzo/gradle-buildconfig-plugin
buildconfig = "5.5.0" # https://github.com/gmazzo/gradle-buildconfig-plugin


[libraries]
Expand All @@ -46,10 +46,9 @@ ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" }
ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" }
ktor-network = { module = "io.ktor:ktor-network", version.ref = "ktor" }
ktor-utils = { module = "io.ktor:ktor-utils", version.ref = "ktor" }
ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" }

# kotlinx
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
Expand Down Expand Up @@ -85,7 +84,7 @@ slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
kbson = { module = "org.mongodb.kbson:kbson", version.ref = "kbson" }

# actually plugins, not libraries, but used is 'buildSrc/build.gradle.kts' as implementation dependencies:
# https://docs.gradle.org/current/userguide/custom_plugins.html#applying_external_plugins_in_precompiled_script_plugins
# https://docs.gradle.org/current/userguide/implementing_gradle_plugins_precompiled.html#sec:applying_external_plugins
kotlin-jvm-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-serialization-plugin = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
dokka-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=5b9c5eb3f9fc2c94abaea57d90bd78747ca117ddbbf96c859d3741181a12bf2a
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 1 addition & 3 deletions ksp-annotations/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask

plugins {
`kord-internal-multiplatform-module`

Expand All @@ -10,7 +8,7 @@ plugins {
`kord-publishing`
}

tasks.withType<AbstractDokkaLeafTask>().configureEach {
dokka {
dokkaSourceSets.configureEach {
suppress = true
}
Expand Down
Loading

0 comments on commit 6c7a852

Please sign in to comment.