Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Kotlin/Native #855

Open
wants to merge 93 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
ab37ea3
Add native targets to KMP modules
DRSchlaubi Aug 5, 2023
537a01b
Disable CI for now
DRSchlaubi Aug 5, 2023
540aee2
Use hierarchies for all KMP targets
DRSchlaubi Aug 5, 2023
e019272
Add missing generated files
DRSchlaubi Aug 5, 2023
6d91b32
Add missing generated types
DRSchlaubi Aug 5, 2023
1ed902e
Fix tests
DRSchlaubi Aug 5, 2023
92ab453
Fix weird atomic issues on native
DRSchlaubi Aug 5, 2023
e8007c1
Implement Throwable.isTimeout() on native
DRSchlaubi Apr 15, 2023
850b2d8
Add publishing utility functions
DRSchlaubi Aug 5, 2023
cc1eca9
Fix darwin compilation
DRSchlaubi Aug 5, 2023
4c4d38a
Fix darwin compilation v2
DRSchlaubi Aug 5, 2023
7bca8ba
Enable signing if possible
DRSchlaubi Aug 5, 2023
bc672ad
Add simulator targets
DRSchlaubi Aug 6, 2023
1599a8e
Replace toInt() with convert()
DRSchlaubi Aug 6, 2023
996bd00
Rebase on main
DRSchlaubi Jan 24, 2024
e42dbea
Remove wrongly added classes
DRSchlaubi Jan 24, 2024
640141d
Linux support
Jan 24, 2024
9cbd7d7
Code cleanup
Jan 24, 2024
bb2acbe
Add voice support on native
Jan 25, 2024
45ef6fc
Use zError in inflater for proper error codes
Jan 25, 2024
855733c
Print error of inflateEnd
Jan 25, 2024
45bb300
Update to published cache library
Jan 29, 2024
ba758c9
Sadly the Ktor bug is not fixed yet
Jan 29, 2024
30f072c
Finalize snapshot builds
Jan 29, 2024
79dfd50
Ignore file based tests on Apple Simulators
Jan 29, 2024
dfaae75
Fix resolution of test files on Kotlin/Native
Jan 29, 2024
091f1a8
Replace withWasm() with withWatchos() as intended
Jan 29, 2024
f5f3d10
Fix build
Jan 29, 2024
7580dd7
Disable flaky tests
Jan 29, 2024
3ffd8c8
Fix stack trace recovery tests on Kotlin/Native
Jan 29, 2024
3dbc6dc
Fix build agian
Jan 29, 2024
7227398
Fix build again
Jan 29, 2024
3d145e6
Fix broken StackTraceRecovery test on Windows
Jan 29, 2024
1ca3ea6
Api dump
Jan 29, 2024
c584c6d
Fix invalid coordinates
Jan 29, 2024
0745018
Enable linuxArm64 & disable broken test
DRSchlaubi Jan 30, 2024
1f64eff
ci test
DRSchlaubi Jan 31, 2024
91b6de5
Remove workaround for ktor
Jan 31, 2024
70c6458
Update libs.versions.toml
DRSchlaubi Jan 31, 2024
9a270ea
Upgrade gradle-tools to 1.3.0
DRSchlaubi Feb 29, 2024
0066b28
Fix dokka jar not being generated
DRSchlaubi Mar 4, 2024
19c809f
Merge branch 'main' into feature/native
lukellmann Mar 4, 2024
1200bd6
Merge branch 'main' into feature/native
lukellmann Mar 4, 2024
3b3dbb5
Remove kotlin-logging-old version
lukellmann Mar 4, 2024
dd69ed9
Apply suggestions from code review
DRSchlaubi Mar 4, 2024
5869b9a
Suggestions
DRSchlaubi Mar 4, 2024
92d05e7
Replace kotlin-targets with Targets.kt
DRSchlaubi Mar 4, 2024
2e1f52e
Apply gradle plugin everywhere
DRSchlaubi Mar 5, 2024
3dfbe1c
Really apply gradle plugin everywhere
DRSchlaubi Mar 5, 2024
3d90b89
Update gradle-tools
DRSchlaubi Mar 5, 2024
7a1f87a
Configure targets compiler options in Targets.kt
DRSchlaubi Mar 10, 2024
0b3848c
Improve native inflater
DRSchlaubi Mar 11, 2024
0053079
Switch to OkHttp as http client on jvm
DRSchlaubi Mar 20, 2024
450323e
Revert "Switch to OkHttp as http client on jvm"
DRSchlaubi Mar 20, 2024
3944b8d
Improve initializing and ending z_stream
lukellmann Mar 25, 2024
89cf26e
Merge branch 'refs/heads/main' into feature/native
lukellmann Apr 4, 2024
0f4df33
More inflater improvements
lukellmann Apr 5, 2024
9baf82f
Fix duplicate jvm class name
lukellmann Apr 6, 2024
b8021fe
Update libsodium
DRSchlaubi Apr 9, 2024
35227fc
feat(voice)!: add support for node.js (#931)
viztea Apr 12, 2024
dc42c76
Add stubs for Windows
DRSchlaubi Apr 12, 2024
078dce7
Minor cleanup
DRSchlaubi Apr 12, 2024
6c49fbd
Update target chart
DRSchlaubi Apr 12, 2024
c6d35ee
Merge remote-tracking branch 'origin/main' into feature/native
DRSchlaubi Apr 12, 2024
644f5a7
Fix compilation
DRSchlaubi Apr 12, 2024
6ba4d9b
API dump
DRSchlaubi Apr 12, 2024
5e97756
Ignore empty string returned by zError
lukellmann Apr 17, 2024
ecf227a
Merge branch 'refs/heads/main' into feature/native
lukellmann Apr 17, 2024
b655c64
Fix compilation
lukellmann Apr 17, 2024
6a139e3
Prevent use after free and double free
lukellmann Apr 17, 2024
f5ce70a
Pedantic exception handling in init and close
lukellmann Apr 17, 2024
3500c53
Fix warnings again that were fixed in #936
lukellmann Apr 17, 2024
0796312
Actually build voice on Windows and fix KLib dump
lukellmann Apr 17, 2024
379c7f6
Fix file location warning
lukellmann Apr 17, 2024
26aa8db
Trailing , ❤️
lukellmann Apr 22, 2024
4dd54e7
decompressedLen can be a local variable
lukellmann Apr 22, 2024
e7583a2
Merge branch 'refs/heads/main' into feature/native
lukellmann Apr 22, 2024
c598338
Tweaks to native Inflater
lukellmann Apr 22, 2024
3a4c92a
Merge remote-tracking branch 'origin/main' into feature/native
DRSchlaubi Jul 2, 2024
fa06f85
Remaining upgrades
DRSchlaubi Jul 2, 2024
00d8b98
Add missing opt ins
DRSchlaubi Jul 2, 2024
0bb2550
Fix build
DRSchlaubi Jul 2, 2024
9d86e31
Fix build
DRSchlaubi Jul 2, 2024
fc4007a
Merge remote-tracking branch 'origin/main' into feature/native
DRSchlaubi Jul 18, 2024
4ea3199
Update to Ktor 3.0.0-beta-2
DRSchlaubi Jul 18, 2024
8c8b869
Merge remote-tracking branch 'origin/main' into feature/native
DRSchlaubi Sep 12, 2024
6cf5769
More fixes in regards to merge
DRSchlaubi Sep 12, 2024
a08068b
Remove duplicate -Xexpect-actual-classes
lukellmann Sep 12, 2024
10834bf
Imports, formatting
lukellmann Sep 12, 2024
3dd43e1
Remove unused version
lukellmann Sep 12, 2024
86ddabb
Remove unused -Xcontext-receivers in buildSrc
lukellmann Sep 12, 2024
d4d792c
Merge remote-tracking branch 'origin/main' into feature/native
DRSchlaubi Oct 21, 2024
1362153
Update to current state of main
DRSchlaubi Oct 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions .github/workflows/deployment-ci.yml

This file was deleted.

36 changes: 5 additions & 31 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,12 @@
# This workflow will build and deploy docs to GitHub Pages whenever something is pushed to the main branch

name: Docs

name: Documentation CI
on:
push:
branches:
- main
pull_request:

permissions:
contents: write
id-token: write
pages: write

jobs:
docs:
name: Build and deploy docs
runs-on: ubuntu-latest
concurrency: # Allow one concurrent deployment
group: pages
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build docs with Gradle
run: ./gradlew --stacktrace --info :dokkaGeneratePublicationHtml
- name: Deploy docs to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/dokka/html
branch: gh-pages
git-config-name: GitHub Actions
git-config-email: [email protected]
commit-message: Update docs
uses: kordlib/.teamcity/.github/workflows/documentation.yml@main
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,17 @@ mapping of the Voice API on Kotlin/JVM

## Modules

| Module | Docs | Artifact | JVM | JS | Native² |
|--------------------------|---------------------------------------------------------|-------------------|-----|----|---------|
| [common](common) | [common](https://kordlib.github.io/kord/common) | `kord-common`¹ | ✅ | ✅ | ❌ |
| [rest](rest) | [rest](https://kordlib.github.io/kord/rest) | `kord-rest`¹ | ✅ | ✅ | ❌ |
| [gateway](gateway) | [gateway](https://kordlib.github.io/kord/gateway) | `kord-gateway`¹ | ✅ | ✅ | ❌ |
| [core](core) | [core](https://kordlib.github.io/kord/core) | `kord-core`¹ | ✅ | ✅ | ❌ |
| [voice](voice) | [voice](https://kordlib.github.io/kord/voice) | `kord-voice` | ✅ | ❌³ | ❌ |
| [core-voice](core-voice) | [core-voice](https://kordlib.github.io/kord/core-voice) | `kord-core-voice` | ✅ | ❌ | ❌ |
| Module | Docs | Artifact | JVM | JS (NodeJS) | Native |
|--------------------------|---------------------------------------------------------|--------------------|-----|-------------|--------|
| [common](common) | [common](https://kordlib.github.io/kord/common) | `kord-common`¹ | ✅ | ✅ | ✅ |
| [rest](rest) | [rest](https://kordlib.github.io/kord/rest) | `kord-rest`¹ | ✅ | ✅ | ✅ |
| [gateway](gateway) | [gateway](https://kordlib.github.io/kord/gateway) | `kord-gateway`¹ | ✅ | ✅ | ✅ |
| [core](core) | [core](https://kordlib.github.io/kord/core) | `kord-core`¹ | ✅ | ✅ | ✅ |
| [voice](voice) | [voice](https://kordlib.github.io/kord/voice) | `kord-voice`¹ | ✅ | ✅ | ✅² |
| [core-voice](core-voice) | [core-voice](https://kordlib.github.io/kord/core-voice) | `kord-core-voice`¹ | ✅ | ✅ | ✅² |

¹ These artifacts only supports Gradle Version 5.3 or higher, for older Gradle versions and Maven please append `-jvm`
² For Native Support please see #69
³ For Voice JS please see #69
² Currently not on Windows(MinGW) targets, see #69

## Installation

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

val me = project
Expand Down Expand Up @@ -31,5 +31,3 @@ publishing {
from(components["javaPlatform"])
}
}

apply(plugin = "kord-publishing")
10 changes: 7 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ plugins {
org.jetbrains.dokka // for dokkaGeneratePublicationHtml task
}

repositories {
mavenCentral()
allprojects {
repositories {
// TODO: Remove wants https://github.com/ktorio/ktor/pull/3950 lands
maven("https://europe-west3-maven.pkg.dev/mik-music/kord")
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots/")
}
}

group = Library.group
version = libraryVersion

dependencies {
dokka(projects.common)
Expand Down
3 changes: 3 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ plugins {
}

repositories {
gradlePluginPortal()
mavenCentral()
// Repo providing the Kord Gradle plugin
maven("https://europe-west3-maven.pkg.dev/mik-music/kord")
}

kotlin {
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Compiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ val kordOptIns = listOf(
"dev.kord.common.annotation.KordVoice",
)

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

internal const val KORD_JVM_TARGET = 8
const val KORD_JVM_TARGET = 8

internal fun KotlinJvmCompilerOptions.applyKordJvmCompilerOptions() {
applyKordCommonCompilerOptions()
Expand Down
5 changes: 3 additions & 2 deletions buildSrc/src/main/kotlin/Documentation.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import dev.kord.gradle.tools.util.commitHash
import org.gradle.api.Project
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.invoke
import java.net.URI
import org.jetbrains.dokka.gradle.DokkaExtension
import org.jetbrains.dokka.gradle.workers.ProcessIsolation

Expand All @@ -27,7 +28,7 @@ internal fun DokkaExtension.applyKordDokkaOptions(project: Project) {
remoteLineSuffix = "#L"
}

externalDocumentationLinks {
externalDocumentationLinks.apply {
register("kotlinx.coroutines") {
url("https://kotlinlang.org/api/kotlinx.coroutines/")
}
Expand Down
13 changes: 0 additions & 13 deletions buildSrc/src/main/kotlin/Git.kt

This file was deleted.

27 changes: 0 additions & 27 deletions buildSrc/src/main/kotlin/Projects.kt
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
import org.gradle.api.Project

object Library {
const val name = "kord"
const val group = "dev.kord"
const val description = "Idiomatic Kotlin Wrapper for The Discord API"
const val projectUrl = "https://github.com/kordlib/kord"
}

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 Project.commitHash get() = git("rev-parse", "--verify", "HEAD")
val Project.shortCommitHash get() = git("rev-parse", "--short", "HEAD")

val Project.isRelease get() = tag != null

object Repo {
const val releasesUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
const val snapshotsUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
}
58 changes: 58 additions & 0 deletions buildSrc/src/main/kotlin/Targets.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import org.gradle.api.tasks.TaskContainer
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.konan.target.HostManager

@OptIn(ExperimentalKotlinGradlePluginApi::class)
fun KotlinMultiplatformExtension.targets() {
jvm {
compilerOptions {
applyKordJvmCompilerOptions()
}
}

js {
nodejs {
testTask {
useMocha {
// disable timeouts, some tests are too slow for default 2-second timeout:
// https://mochajs.org/#-timeout-ms-t-ms
timeout = "0"
}
}
}
useCommonJs()
}

linuxX64()
linuxArm64()

mingwX64()

macosArm64()
macosX64()

iosArm64()
iosX64()
iosSimulatorArm64()

watchosArm64()
watchosSimulatorArm64()

tvosX64()
tvosArm64()
tvosSimulatorArm64()
}

// There are issues with linking the linux variant on windows.
// Please use WSL if you need to work on the linux port.
fun TaskContainer.disableLinuxLinkTestTasksOnWindows() {
if (HostManager.hostIsMingw) {
val linuxLinkTestTasks = listOf("linkDebugTestLinuxX64", "linkDebugTestLinuxArm64")
for (task in linuxLinkTestTasks) {
named(task) {
enabled = false
}
}
}
}
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/kord-internal-module.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
org.jetbrains.kotlin.jvm
dev.kord.`gradle-tools`
}

repositories {
Expand Down
DRSchlaubi marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

Loading