Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into docs-docs-docs
Browse files Browse the repository at this point in the history
# Conflicts:
#	core/src/commonMain/kotlin/entity/Guild.kt
#	core/src/commonMain/kotlin/entity/Icon.kt
#	core/src/commonMain/kotlin/entity/PartialGuild.kt
#	core/src/commonMain/kotlin/entity/Role.kt
#	core/src/commonMain/kotlin/entity/Sticker.kt
#	core/src/commonMain/kotlin/entity/User.kt
#	core/src/commonMain/kotlin/event/channel/thread/ThreadListSyncEvent.kt
#	core/src/commonMain/kotlin/event/gateway/Events.kt
#	core/src/commonMain/kotlin/event/message/MessageBulkDeleteEvent.kt
#	core/src/commonMain/kotlin/event/message/MessageDeleteEvent.kt
#	core/src/commonMain/kotlin/event/message/ReactionAddEvent.kt
#	core/src/commonMain/kotlin/event/message/ReactionRemoveAllEvent.kt
#	core/src/commonMain/kotlin/event/message/ReactionRemoveEvent.kt
  • Loading branch information
NoComment1105 committed Aug 2, 2023
2 parents fd92e97 + 235ed1d commit ec1be50
Show file tree
Hide file tree
Showing 296 changed files with 3,391 additions and 3,461 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/deployment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ jobs:
with:
distribution: temurin
java-version: 8
- name: Set SHORT_SHA environment variable to short commit hash
run: echo "SHORT_SHA=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
Expand All @@ -44,10 +42,8 @@ jobs:
KORD_TEST_TOKEN: ${{ secrets.KORD_TEST_TOKEN }}
NEXUS_USER: ${{ secrets.NEXUS_USER }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.signingKey }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.signingPassword }}
GITHUB_TAG_NAME: ${{ github.event.release.tag_name }}
GITHUB_BRANCH_NAME: ${{ github.ref }}
SIGNING_KEY: ${{ secrets.signingKey }}
SIGNING_PASSWORD: ${{ secrets.signingPassword }}
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -57,8 +53,6 @@ jobs:
with:
distribution: temurin
java-version: 8
- name: Set SHORT_SHA environment variable to short commit hash
run: echo "SHORT_SHA=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# This workflow will build and deploy docs to GitHub Pages whenever something is pushed to the default branch
# This workflow will build and deploy docs to GitHub Pages whenever something is pushed to the main branch

name: Docs

on: push # but only to default branch, see if below
on:
push:
branches:
- main

permissions:
contents: write
Expand All @@ -11,13 +14,9 @@ jobs:
docs:
name: Build and deploy docs
runs-on: ubuntu-latest
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
concurrency: # Allow one concurrent deployment
group: pages
cancel-in-progress: true
env:
GITHUB_TAG_NAME: ${{ github.event.release.tag_name }}
GITHUB_BRANCH_NAME: ${{ github.ref }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ out/
**/build/*
!**/build/generated/
# re-exclude BuildConfigGenerated.kt
common/build/generated/source/buildConfig/main/main/dev/kord/common/BuildConfigGenerated.kt
common/build/generated/sources/buildConfig/main/dev/kord/common/BuildConfigGenerated.kt
74 changes: 74 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,77 @@
# 0.10.0

## Additions

* Support new username system (by @lukellmann in #825)
* Add `Permission.UseExternalSounds` (by @lukellmann in #833)
* Add new error codes (by @lukellmann in #834)
* Add mention raid protection to Auto Moderation (by @lukellmann in #830)
* Add support for Application Role Connection Metadata (by @lukellmann in #836)
* Add support for join raid protection (by @lukellmann in #832)

## Changes

* Bump `DeprecationLevel`s (by @lukellmann in #821)
* Remove no longer needed pipeline interception (by @lukellmann in #824)
* Change `parentId` and `lockPermissionsToParent` to Optionals (by @Tmpod in #828)

## Fixes

* Fix deserializing embeds with `null` author url (by @lukellmann in #839)

## Dependencies

Updated in #826

* Kotlin 1.8.10 -> 1.8.21
* Ktor 2.2.4 -> 2.3.0
* kotlinx.coroutines 1.6.4 -> 1.7.1
* kotlinx.serialization 1.5.0 -> 1.5.1
* kotlin-node 18.14.0-pre.502 -> 18.16.3-pre.546
* KSP 1.8.10-1.0.9 -> 1.8.21-1.0.11
* KotlinPoet 1.12.0 -> 1.13.2
* JUnit 5 5.9.2 -> 5.9.3
* MockK 1.13.4 -> 1.13.5
* AtomicFU 0.20.0 -> 0.20.2
* Binary compatibility validator 0.13.0 -> 0.13.1
* gradle-buildconfig-plugin 3.1.0 -> 4.0.4

## House-keeping

* Simplify CI (by @lukellmann in #823)
* Use main as the permanent default branch (by @lukellmann in #831)

# 0.9.0

## Additions

* Support Kotlin/JS (by @DRSchlaubi and @Lukellmann in #775)
* Add support for voice messages (by @DRSchlaubi and @Lukellmann in #814)

## Changes

* Bump `DeprecationLevel`s (by @Lukellmann in #794)
* Replace `Icon` with `Asset` (by @oluiss and @Lukellmann in #703)

## Fixes

* Fix some `EntitySupplyStrategy` `toString`s being incorrect (by @GreemDev in #811)
* Fix List Nitro Sticker Packs endpoint (by @Lukellmann in #816)
* Fix `InstantInEpochMillisecondsSerializerTest` on JS (by @Lukellmann in #818)

## Dependencies

Updated in #783

* Gradle 8.0.2 -> 8.1

## House-keeping

* Add inspection for missing `@KordDsl` (by @DRSchlaubi in #800)
* Fix Qodana findings (by @Lukellmann and @DRSchlaubi in #812)
* Clean up (by @Lukellmann in #813)
* Improve `GenerateKordEnum` and `AnnotationArguments` (by @Lukellmann in #817)

# 0.8.3

## Additions
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Discord](https://img.shields.io/discord/556525343595298817.svg?color=&label=Kord&logo=discord&style=for-the-badge)](https://discord.gg/6jcx5ev)
[![Download](https://img.shields.io/maven-central/v/dev.kord/kord-core.svg?label=Maven%20Central&style=for-the-badge)](https://search.maven.org/search?q=g:%22dev.kord%22%20AND%20a:%22kord-core%22)
[![Github CI status (branch)](https://img.shields.io/github/actions/workflow/status/kordlib/kord/deployment-ci.yml?branch=0.9.x&label=CI&style=for-the-badge)]()
[![Github CI status (branch)](https://img.shields.io/github/actions/workflow/status/kordlib/kord/deployment-ci.yml?branch=main&label=CI&style=for-the-badge)]()

__Kord is still in an experimental stage, as such we can't guarantee API stability between releases. While we'd love for
you to try out our library, we don't recommend you use this in production just yet.__
Expand Down Expand Up @@ -61,7 +61,10 @@ Replace `{version}` with the latest version number on maven central.

For Snapshots replace `{version}` with `{branch}-SNAPSHOT`

e.g: `0.9.x-SNAPSHOT` for the branch `0.9.x` or `feature-mpp-SNAPSHOT` for the branch `feature/mpp`
e.g: `feature-mpp-SNAPSHOT` for the branch `feature/mpp`

For Snapshots for the branch `main` replace `{version}` with `{nextPlannedVersion}-SNAPSHOT` (see `nextPlannedVersion`
in [`gradle.properties`](gradle.properties))

[![Download](https://img.shields.io/maven-central/v/dev.kord/kord-core.svg?label=Maven%20Central&style=for-the-badge)](https://search.maven.org/search?q=g:%22dev.kord%22%20AND%20a:%22kord-core%22)

Expand Down
6 changes: 4 additions & 2 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
`java-platform`
`kord-publishing`
`maven-publish`
}

val me = project
Expand All @@ -27,7 +27,9 @@ dependencies {
}

publishing {
publications.withType<MavenPublication>().configureEach {
publications.register<MavenPublication>(Library.name) {
from(components["javaPlatform"])
}
}

apply(plugin = "kord-publishing")
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ repositories {
}

group = Library.group
version = Library.version
version = libraryVersion
8 changes: 4 additions & 4 deletions buildSrc/src/main/kotlin/Compiler.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import kotlinx.atomicfu.plugin.gradle.AtomicFUPluginExtension
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getByType
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompilerOptions
Expand All @@ -11,7 +12,6 @@ object OptIns {
}

val kordOptIns = listOf(
"kotlin.time.ExperimentalTime",
"kotlin.contracts.ExperimentalContracts",

"dev.kord.common.annotation.KordInternal",
Expand All @@ -25,13 +25,13 @@ object Jvm {
}

fun KotlinCommonCompilerOptions.applyKordCompilerOptions() {
// TODO: set to true again once https://github.com/Kotlin/kotlinx-atomicfu/issues/289 is fixed
allWarningsAsErrors.set(false)
freeCompilerArgs.add("-progressive")
allWarningsAsErrors = true
progressiveMode = true
}

fun KotlinSourceSet.applyKordOptIns() {
languageSettings {
// allow `ExperimentalCoroutinesApi` for `TestScope.currentTime`
if ("Test" in name) optIn(OptIns.coroutines)
kordOptIns.forEach(::optIn)
}
Expand Down
20 changes: 12 additions & 8 deletions buildSrc/src/main/kotlin/Documentation.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import org.gradle.kotlin.dsl.assign
import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
import java.net.URL

fun AbstractDokkaLeafTask.applyKordDokkaOptions() {
failOnWarning.set(true)

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

failOnWarning = true

dokkaSourceSets.configureEach {

jdkVersion.set(Jvm.target)
jdkVersion = Jvm.target

suppressGeneratedFiles.set(false)
suppressGeneratedFiles = false

sourceLink {
localDirectory.set(project.projectDir)
remoteUrl.set(URL("https://github.com/kordlib/kord/blob/${Library.commitHashOrDefault("0.9.x")}/${project.name}"))
remoteLineSuffix.set("#L")
localDirectory = project.projectDir
remoteUrl = URL("https://github.com/kordlib/kord/blob/${project.commitHash}/${project.name}")
remoteLineSuffix = "#L"
}

externalDocumentationLink("https://kotlinlang.org/api/kotlinx.coroutines/")
Expand All @@ -26,8 +30,8 @@ fun AbstractDokkaLeafTask.applyKordDokkaOptions() {

// don't list `TweetNaclFast` in docs
perPackageOption {
matchingRegex.set("""com\.iwebpp\.crypto""")
suppress.set(true)
matchingRegex = """com\.iwebpp\.crypto"""
suppress = true
}
}
}
13 changes: 13 additions & 0 deletions buildSrc/src/main/kotlin/Git.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import org.gradle.api.Project
import java.io.ByteArrayOutputStream

internal fun Project.git(vararg command: String): String {
val output = ByteArrayOutputStream()
exec {
commandLine("git", *command)
standardOutput = output
errorOutput = output
workingDir = rootDir
}.rethrowFailure().assertNormalExitValue()
return output.toString().trim()
}
47 changes: 19 additions & 28 deletions buildSrc/src/main/kotlin/Projects.kt
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
/**
* whether the process has been invoked by JitPack
*/
val isJitPack get() = "true" == System.getenv("JITPACK")
import org.gradle.api.Project

object Library {
const val name = "kord"
const val group = "dev.kord"
val version: String
get() = if (isJitPack) System.getenv("RELEASE_TAG")
else {
val tag = System.getenv("GITHUB_TAG_NAME")
val branch = System.getenv("GITHUB_BRANCH_NAME")
when {
!tag.isNullOrBlank() -> tag
!branch.isNullOrBlank() && branch.startsWith("refs/heads/") ->
branch.substringAfter("refs/heads/").replace("/", "-") + "-SNAPSHOT"
else -> "undefined"
}

}

val commitHash get() = System.getenv("GITHUB_SHA") ?: "unknown"
fun commitHashOrDefault(default: String) = System.getenv("GITHUB_SHA") ?: default

// this environment variable isn't available out of the box, we set it ourselves
val shortCommitHash get() = System.getenv("SHORT_SHA") ?: "unknown"

const val description = "Idiomatic Kotlin Wrapper for The Discord API"
const val projectUrl = "https://github.com/kordlib/kord"
}

val isSnapshot: Boolean get() = version.endsWith("-SNAPSHOT")
private val Project.tag
get() = git("tag", "--no-column", "--points-at", "HEAD")
.takeIf { it.isNotBlank() }
?.lines()
?.single()

val Project.libraryVersion
get() = tag ?: run {
val snapshotPrefix = when (val branch = git("branch", "--show-current")) {
"main" -> providers.gradleProperty("nextPlannedVersion").get()
else -> branch.replace('/', '-')
}
"$snapshotPrefix-SNAPSHOT"
}

val isRelease: Boolean get() = !isSnapshot && !isUndefined
val Project.commitHash get() = git("rev-parse", "--verify", "HEAD")
val Project.shortCommitHash get() = git("rev-parse", "--short", "HEAD")

val isUndefined get() = version == "undefined"
}
val Project.isRelease get() = tag != null

object Repo {
const val releasesUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
Expand Down
5 changes: 0 additions & 5 deletions buildSrc/src/main/kotlin/kord-internal-module.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
org.jetbrains.kotlin.jvm
}
Expand All @@ -10,9 +8,6 @@ repositories {

kotlin {
jvmToolchain(Jvm.target)
}

tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
applyKordCompilerOptions()
}
Expand Down
18 changes: 6 additions & 12 deletions buildSrc/src/main/kotlin/kord-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,27 @@ kotlin {

jvmToolchain(Jvm.target)

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

sourceSets {
// allow `ExperimentalCoroutinesApi` for `runTest {}`
// allow `ExperimentalCoroutinesApi` for `TestScope.currentTime`
test { languageSettings.optIn(OptIns.coroutines) }
}
}

configureAtomicFU()

tasks {
withType<KotlinCompile>().configureEach {
compilerOptions {
applyKordCompilerOptions()
freeCompilerArgs.addAll(kordOptIns.map { "-opt-in=$it" })
}
}

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

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

withType<PublishToMavenRepository>().configureEach {
doFirst { require(!Library.isUndefined) { "No release/snapshot version found." } }
}
}

publishing {
Expand Down
Loading

0 comments on commit ec1be50

Please sign in to comment.