Skip to content

Commit

Permalink
Add Wasm support for KSP annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Feb 14, 2025
1 parent ea76c99 commit 5a93ac6
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 25 deletions.
12 changes: 3 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,20 @@ allprojects {
conf.resolutionStrategy.eachDependency {
if (requested.group == "dev.kord.codegen") {
when (requested.name) {
"kotlinpoet" -> useVersion("main-20240811.165308-18")
"ksp" -> useVersion("main-20240811.165308-20")
"kotlinpoet" -> useVersion("main-20240819.155859-19")
"ksp" -> useVersion("main-20240819.155859-21")
}
}
}
}
}

dependencies {
// dokka(projects.ksp.annotations)
dokka(projects.ksp.annotations)
dokka(projects.ksp)
dokka(projects.kotlinpoet)
}

subprojects {
configureJVMTarget()
}

tasks {
dokkaGeneratePublicationHtml {

}
}
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/code-generator.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

val codeGenerationExtension = extensions.create("codeGeneration", CodeGenerationExtension::class)
val downloadSources by tasks.creating(DownloadSourceTask::class) {
val downloadSources by tasks.registering(DownloadSourceTask::class) {
dependency = codeGenerationExtension.dependency
}

Expand All @@ -32,7 +32,7 @@ kotlin {
}

named("generationSource") {
kotlin.srcDir(downloadSources.destinationDirectory.map { it.dir("jvmMain") })
kotlin.srcDir(downloadSources.map { it.destinationDirectory.map { dir -> dir.dir("jvmMain") } })
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
kotlin.code.style=official
#dokka will run out of memory with the default meta space
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1024m

# 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
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
kotlin = "2.0.21"
kotlin = "2.1.10"
kotlinpoet = "2.0.0"
ksp = "2.0.21-1.0.26"
ksp = "2.1.10-1.0.29"

# The compiled binary of codegen.kt we use to compile codegen.kt itself
codegen-kt = "main-SNAPSHOT"
Expand All @@ -15,14 +15,14 @@ codegen-kotlinpoet = { group = "dev.kord.codegen", name = "kotlinpoet", version
codegen-ksp = { group = "dev.kord.codegen", name = "ksp", version = "main-20240811.165308-20" }
codegen-ksp-processor = { group = "dev.kord.codegen", name = "ksp-processor", version = "main-20240811.165308-19" }

mockk = { group = "io.mockk", name = "mockk", version = "1.13.12" }
mockk = { group = "io.mockk", name = "mockk", version = "1.13.16" }

kotlin-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
ksp-plugin = { group = "com.google.devtools.ksp", name = "symbol-processing-gradle-plugin", version.ref = "ksp" }
dokka-plugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version = "2.0.0-Beta" }
dokka-plugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version = "2.0.0" }
maven-publish-plugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.30.0" }

binary-compatibility-validator-plugin = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version = "0.16.3" }
binary-compatibility-validator-plugin = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version = "0.17.0" }

[bundles]
pluginsForBuildSrc = ["kotlin-plugin", "ksp-plugin", "dokka-plugin", "maven-publish-plugin", "binary-compatibility-validator-plugin"]
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
13 changes: 11 additions & 2 deletions ksp/annotations/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)

import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl

plugins {
org.jetbrains.kotlin.multiplatform
Expand All @@ -13,6 +12,7 @@ base {
archivesName = "ksp-annotations"
}

@OptIn(ExperimentalWasmDsl::class)
kotlin {
explicitApi()

Expand All @@ -22,6 +22,15 @@ kotlin {
nodejs()
}

wasmJs {
browser()
nodejs()
}

wasmWasi {
nodejs()
}

mingwX64()
linuxX64()
linuxArm64()
Expand Down

0 comments on commit 5a93ac6

Please sign in to comment.