Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/codegen.kt' into feature/codegen-kt
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle/libs.versions.toml
#	ksp-processors/build.gradle.kts
#	ksp-processors/src/main/kotlin/KSPUtils.kt
#	ksp-processors/src/main/kotlin/generation/GenerationProcessor.kt
#	ksp-processors/src/main/kotlin/generation/bitflags/Builder.kt
#	ksp-processors/src/main/kotlin/generation/bitflags/ContainsPlusMinusCopy.kt
#	ksp-processors/src/main/kotlin/generation/bitflags/Serializer.kt
#	ksp-processors/src/main/kotlin/generation/kordenum/KordEnumGeneration.kt
#	ksp-processors/src/main/kotlin/generation/shared/EqualsHashCodeToString.kt
#	ksp-processors/src/main/kotlin/generation/shared/SharedContent.kt
  • Loading branch information
DRSchlaubi committed Oct 22, 2024
2 parents 4b3dc02 + cca4a66 commit 0e91a3d
Show file tree
Hide file tree
Showing 156 changed files with 5,622 additions and 1,050 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/deployment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 21
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew --stacktrace --info build
release:
Expand All @@ -42,6 +42,8 @@ jobs:
KORD_TEST_TOKEN: ${{ secrets.KORD_TEST_TOKEN }}
NEXUS_USER: ${{ secrets.NEXUS_USER }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
KORD_REPO_USER: ${{ secrets.KORD_REPO_USER }}
KORD_REPO_PASSWORD: ${{ secrets.KORD_REPO_PASSWORD }}
SIGNING_KEY: ${{ secrets.signingKey }}
SIGNING_PASSWORD: ${{ secrets.signingPassword }}
steps:
Expand All @@ -52,9 +54,9 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 21
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew --stacktrace --info build
- name: Publish with Gradle
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 21
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
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
14 changes: 0 additions & 14 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

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
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ in [`gradle.properties`](gradle.properties))
```kotlin
repositories {
mavenCentral()
// Kord Snapshots Repository (Optional):
// Kord Snapshot Repositories (optional, choose one of these):
maven("https://repo.kord.dev/snapshots")
maven("https://oss.sonatype.org/content/repositories/snapshots")
}

Expand All @@ -82,7 +83,10 @@ dependencies {
```groovy
repositories {
mavenCentral()
// Kord Snapshots Repository (Optional):
// Kord Snapshot Repositories (optional, choose one of these):
maven {
url "https://repo.kord.dev/snapshots"
}
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
Expand All @@ -95,9 +99,19 @@ dependencies {

### Maven

##### Kord Snapshots Repository (Optional):
##### Kord Snapshot Repositories (optional, choose one of these):

```xml
<repository>
<id>snapshots-repo</id>
<url>https://repo.kord.dev/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>

<repository>
<id>snapshots-repo</id>
Expand All @@ -114,7 +128,6 @@ dependencies {
---

```xml

<dependency>
<groupId>dev.kord</groupId>
<artifactId>kord-core-jvm</artifactId>
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 @@ -8,3 +8,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)
}
16 changes: 11 additions & 5 deletions buildSrc/src/main/kotlin/Compiler.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import org.gradle.api.NamedDomainObjectSet
import org.gradle.kotlin.dsl.assign
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet

val kordOptIns = listOf(
Expand All @@ -12,16 +14,20 @@ val kordOptIns = listOf(
"dev.kord.common.annotation.KordVoice",
)

object Jvm {
const val target = 8
}

fun KotlinCommonCompilerOptions.applyKordCompilerOptions() {
internal fun KotlinCommonCompilerOptions.applyKordCommonCompilerOptions() {
allWarningsAsErrors = true
progressiveMode = true
freeCompilerArgs.add("-Xexpect-actual-classes")
}

internal const val KORD_JVM_TARGET = 8

internal fun KotlinJvmCompilerOptions.applyKordJvmCompilerOptions() {
applyKordCommonCompilerOptions()
jvmTarget = JVM_1_8
freeCompilerArgs.add("-Xjdk-release=1.8")
}

internal fun NamedDomainObjectSet<KotlinSourceSet>.applyKordTestOptIns() {
named { it.contains("test", ignoreCase = true) }.configureEach {
// allow `ExperimentalCoroutinesApi` for `TestScope.currentTime`
Expand Down
41 changes: 28 additions & 13 deletions buildSrc/src/main/kotlin/Documentation.kt
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
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 {

jdkVersion = Jvm.target
jdkVersion = 23

suppressGeneratedFiles = false

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
9 changes: 7 additions & 2 deletions buildSrc/src/main/kotlin/kord-internal-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ repositories {
}

kotlin {
jvmToolchain(Jvm.target)
compilerOptions {
applyKordCompilerOptions()
applyKordJvmCompilerOptions()
}
}

tasks {
withType<JavaCompile>().configureEach {
options.release = KORD_JVM_TARGET
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ repositories {
mavenCentral()
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
kotlin {
jvm()
compilerOptions {
applyKordCommonCompilerOptions()
}

jvm {
compilerOptions {
applyKordJvmCompilerOptions()
}
}
js {
nodejs()
useCommonJs()
}
jvmToolchain(Jvm.target)

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
applyKordCompilerOptions()
}
}

tasks {
Expand Down
16 changes: 8 additions & 8 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 All @@ -12,6 +10,7 @@ plugins {

repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots")
}

dependencies {
Expand All @@ -24,11 +23,8 @@ apiValidation {

kotlin {
explicitApi()

jvmToolchain(Jvm.target)

compilerOptions {
applyKordCompilerOptions()
applyKordJvmCompilerOptions()
optIn.addAll(kordOptIns)
}

Expand All @@ -37,13 +33,17 @@ kotlin {
}
}

dokka {
applyKordDokkaOptions(project)
}

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

withType<AbstractDokkaLeafTask>().configureEach {
applyKordDokkaOptions()
withType<JavaCompile>().configureEach {
options.release = KORD_JVM_TARGET
}
}

Expand Down
Loading

0 comments on commit 0e91a3d

Please sign in to comment.