diff --git a/.github/workflows/docs-ci.yml b/.github/workflows/docs-ci.yml index af80c23d..9c754879 100644 --- a/.github/workflows/docs-ci.yml +++ b/.github/workflows/docs-ci.yml @@ -1,26 +1,12 @@ -# This workflow will upload docs to the gh-pages branch whenever something is pushed to main. - -name: Docs +name: Documentation CI on: push: - branches: - - main + pull_request: -jobs: - upload_docs: - name: upload docs - runs-on: ubuntu-20.04 - env: - GRGIT_USER: ${{ secrets.GRGIT_USER }} - ACTIONS_ALLOW_UNSECURE_COMMANDS: true +permissions: + id-token: write + pages: write - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 20 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 22 - - uses: gradle/actions/setup-gradle@v3 - - name: Publish docs with Gradle - run: gradle gitPublishPush +jobs: + docs: + uses: kordlib/.teamcity/.github/workflows/documentation.yml@main diff --git a/.github/workflows/github-ci.yml b/.github/workflows/github-ci.yml deleted file mode 100644 index 3ff2d410..00000000 --- a/.github/workflows/github-ci.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: CI - -on: - push: - pull_request: - types: - - opened - - synchronize - -jobs: - build: - runs-on: ubuntu-20.04 - env: - BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} - BINTRAY_USER: ${{ secrets.BINTRAY_USER }} - - steps: - - run: export GRADLE_USER_HOME=`pwd`/.gradle - - run: echo "name=RELEASE_TAG::${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - uses: actions/checkout@v4 - - name: Setup Java JDK 20 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 22 - - uses: gradle/actions/setup-gradle@v3 - - name: Build with Gradle - run: ./gradlew assemble - - name: Build with Gradle - run: ./gradlew jvmTest - release: - name: Publish artifacts - runs-on: ubuntu-20.04 - needs: build - if: github.event_name != 'pull_request' - env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_KEY }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.signingKey }} - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signingPassword }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDK 20 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 22 - - uses: gradle/actions/setup-gradle@v3 - - name: Build with Gradle - run: ./gradlew publishAllPublicationsToMavenRepository diff --git a/.gitignore b/.gitignore index 6090b450..b0a57966 100644 --- a/.gitignore +++ b/.gitignore @@ -134,3 +134,4 @@ docs/ .idea/artifacts !**/build/generated/ core/gradle.properties +.kotlin diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index ae3f30ae..6d0ee1c2 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index a52b6e72..8ffd03c0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,3 @@ -import org.ajoberstar.gradle.git.publish.GitPublishExtension import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin @@ -6,11 +5,11 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin plugins { id("org.jetbrains.dokka") alias(libs.plugins.kotlinx.atomicfu) apply false - alias(libs.plugins.git.publish) + alias(libs.plugins.gradle.tools) apply false } group = "dev.schlaubi.lavakord" -version = "6.2.0" +version = "6.3.0" allprojects { repositories { @@ -26,26 +25,9 @@ tasks { dokkaHtmlMultiModule { outputDirectory = rootProject.file("docs") } - - gitPublishCopy { - dependsOn(dokkaHtmlMultiModule) - } -} - -configure { - repoUri = "https://github.com/DRSchlaubi/lavakord.git" - branch = "gh-pages" - - contents { - from(file("docs")) - from(file("CNAME")) - } - - commitMessage = "Update Docs" } subprojects { - version = libraryVersion group = rootProject.group tasks { diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 047dbf71..8077e82d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -9,12 +9,12 @@ repositories { } dependencies { - val kotlinVersion = "1.9.24" + val kotlinVersion = "2.0.0" implementation(kotlin("gradle-plugin", kotlinVersion)) implementation(kotlin("serialization", kotlinVersion)) implementation(kotlin("gradle-plugin-api", kotlinVersion)) - implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0") - implementation("org.jetbrains.dokka", "dokka-gradle-plugin", "1.9.10") + implementation("com.vanniktech:gradle-maven-publish-plugin:0.29.0") + implementation("org.jetbrains.dokka", "dokka-gradle-plugin", "1.9.20") implementation(gradleApi()) implementation(localGroovy()) } diff --git a/buildSrc/src/main/kotlin/Projects.kt b/buildSrc/src/main/kotlin/Projects.kt index b4b66dad..dceca394 100644 --- a/buildSrc/src/main/kotlin/Projects.kt +++ b/buildSrc/src/main/kotlin/Projects.kt @@ -1,24 +1,8 @@ import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.NamedDomainObjectProvider -import org.gradle.api.Project import org.gradle.kotlin.dsl.named import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet -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")) { - else -> branch.replace('/', '-') - } - "$snapshotPrefix-SNAPSHOT" - } - - val NamedDomainObjectContainer.jvmMain: NamedDomainObjectProvider get() = named("jvmMain") diff --git a/buildSrc/src/main/kotlin/lavalink-module.gradle.kts b/buildSrc/src/main/kotlin/lavalink-module.gradle.kts index eca2e635..eb30edf7 100644 --- a/buildSrc/src/main/kotlin/lavalink-module.gradle.kts +++ b/buildSrc/src/main/kotlin/lavalink-module.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { @@ -17,10 +18,9 @@ kotlin { explicitApi() jvm { - compilations.all { - compilerOptions.configure { - jvmTarget = JvmTarget.JVM_1_8 - } + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + jvmTarget = JvmTarget.JVM_1_8 } } @@ -32,12 +32,9 @@ kotlin { useCommonJs() } - targets.all { - compilations.all { - compilerOptions.configure { - freeCompilerArgs.add("-Xexpect-actual-classes") - } - } + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + freeCompilerArgs.add("-Xexpect-actual-classes") } sourceSets { diff --git a/buildSrc/src/main/kotlin/lavalink-publishing.gradle.kts b/buildSrc/src/main/kotlin/lavalink-publishing.gradle.kts index e91f7d3c..3d092208 100644 --- a/buildSrc/src/main/kotlin/lavalink-publishing.gradle.kts +++ b/buildSrc/src/main/kotlin/lavalink-publishing.gradle.kts @@ -5,7 +5,7 @@ plugins { } mavenPublishing { - publishToMavenCentral(SonatypeHost.S01, true) + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) signAllPublications() pom { diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 917cbb9c..22a471bf 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -47,8 +47,11 @@ kotlin { } jvmMain { + kotlin.srcDir("build/generated/ksp/jvm/jvmMain") dependencies { implementation(libs.ktor.client.okhttp) + compileOnly(libs.ksp.api) + compileOnly(libs.codegen.ksp) } } @@ -76,7 +79,7 @@ kotlin { } dependencies { - //kspJvm(libs.codegen.ksp.processor) +// kspJvm(libs.codegen.ksp.processor) } mavenPublishing { diff --git a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/internal/GenerateQueryHelper.kt b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/internal/GenerateQueryHelper.kt index c2bba226..a68f04a1 100644 --- a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/internal/GenerateQueryHelper.kt +++ b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/internal/GenerateQueryHelper.kt @@ -1,6 +1,7 @@ package dev.schlaubi.lavakord.internal import dev.kord.codegen.ksp.annotations.ProcessorAnnotation +import dev.schlaubi.lavakord.PluginApi /** * Annotation to generate utility functions for search queries. @@ -9,7 +10,8 @@ import dev.kord.codegen.ksp.annotations.ProcessorAnnotation @Retention(AnnotationRetention.SOURCE) @Repeatable @ProcessorAnnotation("dev.schlaubi.lavakord.internal.processing") -internal annotation class GenerateQueryHelper( +@PluginApi +public annotation class GenerateQueryHelper( val serviceName: String, val serviceWebsite: String, val generateSearchAndPlayFunction: Boolean, @@ -23,7 +25,7 @@ internal annotation class GenerateQueryHelper( @Target(AnnotationTarget.FILE) @Retention(AnnotationRetention.SOURCE) @ProcessorAnnotation("dev.schlaubi.lavakord.internal.processing") - annotation class Parameter( + public annotation class Parameter( val name: String, val queryName: String = "", val kDoc: String = "", @@ -32,13 +34,13 @@ internal annotation class GenerateQueryHelper( ) { @ProcessorAnnotation("dev.schlaubi.lavakord.internal.processing") - annotation class EnumType( + public annotation class EnumType( val name: String, val value: String, val kDoc: String ) - enum class Type { + public enum class Type { STRING, INT, DOUBLE, diff --git a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/internal/HttpEngine.kt b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/internal/HttpEngine.kt index 4ef11189..f01507b1 100644 --- a/core/src/commonMain/kotlin/dev/schlaubi/lavakord/internal/HttpEngine.kt +++ b/core/src/commonMain/kotlin/dev/schlaubi/lavakord/internal/HttpEngine.kt @@ -5,4 +5,6 @@ import io.ktor.client.engine.* /** * This is the internally used Http Engine */ -public expect object HttpEngine : HttpClientEngineFactory +public expect object HttpEngine : HttpClientEngineFactory { + override fun create(block: HttpClientEngineConfig.() -> Unit): HttpClientEngine +} diff --git a/gradle.properties b/gradle.properties index 5bc0fb09..c4652689 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,3 +4,4 @@ org.gradle.jvmargs=-XX:MaxMetaspaceSize=1024m kotlin.mpp.stability.nowarn=true # Sonatype sucks! SONATYPE_CONNECT_TIMEOUT_SECONDS=300 +nextPlannedVersion=6.4.0 diff --git a/jda/build.gradle.kts b/jda/build.gradle.kts index dec19dec..ae8ebd25 100644 --- a/jda/build.gradle.kts +++ b/jda/build.gradle.kts @@ -1,3 +1,6 @@ +import com.vanniktech.maven.publish.JavadocJar +import com.vanniktech.maven.publish.KotlinJvm + plugins { `lavalink-jvm-module` `lavalink-publishing` @@ -11,7 +14,11 @@ dependencies { api(projects.core) api(libs.kotlinlogging) api(libs.kotlinx.coroutines.jdk8) - api("net.dv8tion:JDA:5.0.0-beta.18") { + api("net.dv8tion:JDA:5.0.0-beta.24") { exclude(module = "opus-java") } } + +mavenPublishing { + configure(KotlinJvm(JavadocJar.Dokka("dokkaHtml"))) +} diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index 0af905a2..2628d745 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -54,14 +54,6 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - brace-expansion@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" @@ -135,11 +127,6 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= - debug@4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -229,17 +216,16 @@ glob-parent@~5.1.2: dependencies: is-glob "^4.0.1" -glob@7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" - integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== +glob@8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" - minimatch "^3.0.4" + minimatch "^5.0.1" once "^1.3.0" - path-is-absolute "^1.0.0" has-flag@^4.0.0: version "4.0.0" @@ -332,17 +318,17 @@ minimatch@5.0.1: dependencies: brace-expansion "^2.0.1" -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== +minimatch@^5.0.1: + version "5.1.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" + integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== dependencies: - brace-expansion "^1.1.7" + brace-expansion "^2.0.1" -mocha@10.2.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8" - integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg== +mocha@10.3.0: + version "10.3.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.3.0.tgz#0e185c49e6dccf582035c05fa91084a4ff6e3fe9" + integrity sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg== dependencies: ansi-colors "4.1.1" browser-stdout "1.3.1" @@ -351,13 +337,12 @@ mocha@10.2.0: diff "5.0.0" escape-string-regexp "4.0.0" find-up "5.0.0" - glob "7.2.0" + glob "8.1.0" he "1.2.0" js-yaml "4.1.0" log-symbols "4.1.0" minimatch "5.0.1" ms "2.1.3" - nanoid "3.3.3" serialize-javascript "6.0.0" strip-json-comments "3.1.1" supports-color "8.1.1" @@ -376,11 +361,6 @@ ms@2.1.3: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -nanoid@3.3.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" - integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== - node-fetch@2.6.7: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" @@ -419,11 +399,6 @@ path-exists@^4.0.0: resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - picomatch@^2.0.4, picomatch@^2.2.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" @@ -520,10 +495,10 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= -typescript@5.0.4: - version "5.0.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" - integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== +typescript@5.4.3: + version "5.4.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.3.tgz#5c6fedd4c87bee01cd7a528a30145521f8e0feff" + integrity sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg== webidl-conversions@^3.0.0: version "3.0.1" diff --git a/plugins/kspProcessor/build.gradle.kts b/plugins/kspProcessor/build.gradle.kts index b6fb856d..ed6588a9 100644 --- a/plugins/kspProcessor/build.gradle.kts +++ b/plugins/kspProcessor/build.gradle.kts @@ -2,14 +2,18 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { kotlin("jvm") + + alias(libs.plugins.ksp) } dependencies { implementation(projects.core) implementation(libs.codegen) + implementation(libs.codegen.ksp) implementation(libs.kotlinpoet) implementation(libs.ksp.api) implementation(kotlin("reflect")) + ksp(libs.codegen.ksp.processor) } kotlin { diff --git a/plugins/kspProcessor/src/main/kotlin/Generator.kt b/plugins/kspProcessor/src/main/kotlin/Generator.kt index 48585730..cfe9d465 100644 --- a/plugins/kspProcessor/src/main/kotlin/Generator.kt +++ b/plugins/kspProcessor/src/main/kotlin/Generator.kt @@ -8,10 +8,11 @@ import com.squareup.kotlinpoet.* import com.squareup.kotlinpoet.ksp.writeTo import dev.kord.codegen.kotlinpoet.FileSpec import dev.kord.codegen.kotlinpoet.ParameterSpec +import dev.schlaubi.lavakord.PluginApi import dev.schlaubi.lavakord.audio.Node import dev.schlaubi.lavakord.audio.player.PlayOptions -import dev.schlaubi.lavakord.internal.GenerateQueryHelper import dev.schlaubi.lavakord.internal.QueryBuilder +import dev.schlaubi.lavakord.internal.processing.GenerateQueryHelper import dev.schlaubi.lavakord.ksp.generator.generateBuilder import dev.schlaubi.lavakord.ksp.generator.generateBuilderFunction import dev.schlaubi.lavakord.ksp.generator.search @@ -70,6 +71,7 @@ private fun GenerateQueryHelper.generateHelpers(addTo: FileSpec.Builder) { } } +@OptIn(PluginApi::class) internal fun GenerateQueryHelper.generateFunction( name: String, builderParameterName: String, builder: FunSpec.Builder.(QueryFunctionContext) -> Unit ): FunSpec = FunSpec.builder(name).apply { diff --git a/plugins/kspProcessor/src/main/kotlin/KotlinPoetUtils.kt b/plugins/kspProcessor/src/main/kotlin/KotlinPoetUtils.kt index 9ca3d401..b2a9ac30 100644 --- a/plugins/kspProcessor/src/main/kotlin/KotlinPoetUtils.kt +++ b/plugins/kspProcessor/src/main/kotlin/KotlinPoetUtils.kt @@ -3,6 +3,7 @@ package dev.schlaubi.lavakord.ksp import com.squareup.kotlinpoet.* +import dev.schlaubi.lavakord.PluginApi import dev.schlaubi.lavakord.internal.GenerateQueryHelper import java.util.* import kotlin.reflect.KFunction @@ -13,6 +14,7 @@ internal fun String.capitalize() = replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() } +@PluginApi internal fun GenerateQueryHelper.Parameter.Type.toType() = when (this) { GenerateQueryHelper.Parameter.Type.STRING -> STRING GenerateQueryHelper.Parameter.Type.INT -> INT diff --git a/plugins/kspProcessor/src/main/kotlin/QueryUtilityProcessor.kt b/plugins/kspProcessor/src/main/kotlin/QueryUtilityProcessor.kt index 9fad4361..c0e205a0 100644 --- a/plugins/kspProcessor/src/main/kotlin/QueryUtilityProcessor.kt +++ b/plugins/kspProcessor/src/main/kotlin/QueryUtilityProcessor.kt @@ -3,15 +3,17 @@ package dev.schlaubi.lavakord.ksp import com.google.devtools.ksp.findActualType -import com.google.devtools.ksp.isDefault import com.google.devtools.ksp.processing.Resolver import com.google.devtools.ksp.processing.SymbolProcessor import com.google.devtools.ksp.processing.SymbolProcessorEnvironment import com.google.devtools.ksp.processing.SymbolProcessorProvider -import com.google.devtools.ksp.symbol.* +import com.google.devtools.ksp.symbol.KSAnnotated +import com.google.devtools.ksp.symbol.KSAnnotation +import com.google.devtools.ksp.symbol.KSFile +import com.google.devtools.ksp.symbol.KSTypeAlias +import dev.schlaubi.lavakord.PluginApi import dev.schlaubi.lavakord.internal.GenerateQueryHelper -import dev.schlaubi.lavakord.ksp.AnnotationArguments.Companion.arguments -import kotlin.reflect.KProperty1 +import dev.schlaubi.lavakord.internal.processing.getGenerateQueryHelpers private inline fun KSAnnotation.isOfType() = isOfType(A::class.qualifiedName!!) @@ -26,109 +28,24 @@ class QueryUtilityProcessorProvider : SymbolProcessorProvider { } private class QueryUtilityProcessor(private val environment: SymbolProcessorEnvironment) : SymbolProcessor { + @OptIn(PluginApi::class) override fun process(resolver: Resolver): List { - resolver.getSymbolsWithAnnotation(GenerateQueryHelper::class.qualifiedName!!).filterIsInstance() - .flatMap { it.annotations.filter { annotation -> annotation.isOfType() } }.map { - it.toGenerateQueryHelper() to it.parent - }.groupBy { (annotation) -> annotation.serviceName }.forEach { (serviceName, items) -> - val (firstItem, file) = items.first() - val children = items.map { (annotation) -> - annotation - } + environment.logger.warn("Got new files, starting process!!") + resolver.getSymbolsWithAnnotation(GenerateQueryHelper::class.qualifiedName!!) + .onEach { environment.logger.warn("Processing element", it) } + .filterIsInstance() + .map { it to it.getGenerateQueryHelpers() } + .forEach { (serviceName, items) -> + environment.logger.warn("Processing item", serviceName) generateHelpers( - serviceName.replace("\\s+".toRegex(), ""), - firstItem.packageName, - children, + serviceName.fileName.replace("\\s+".toRegex(), ""), + serviceName.packageName.asString(), + items.toList(), environment, - file as KSFile + serviceName ) } return emptyList() } } - -private fun KSAnnotation.toGenerateQueryHelper(): GenerateQueryHelper { - val arguments = arguments() - - val parameters = arguments[GenerateQueryHelper::parameters]?.map { it.toParameter() } - ?: listOf(GenerateQueryHelper.Parameter("query")) - val builderOptions = (arguments[GenerateQueryHelper::builderOptions] ?: emptyList()).map { it.toParameter() } - - return GenerateQueryHelper( - serviceName = arguments[GenerateQueryHelper::serviceName]!!, - serviceWebsite = arguments[GenerateQueryHelper::serviceWebsite]!!, - generateSearchAndPlayFunction = arguments[GenerateQueryHelper::generateSearchAndPlayFunction]!!, - packageName = arguments[GenerateQueryHelper::packageName]!!, - prefix = arguments[GenerateQueryHelper::prefix]!!, - parameters = parameters.toTypedArray(), - builderOptions = builderOptions.toTypedArray(), - builderFunction = arguments[GenerateQueryHelper::builderFunction] ?: "", - operationName = arguments[GenerateQueryHelper::operationName] ?: "search" - ) -} - -@Suppress("ANNOTATION_ARGUMENT_MUST_BE_CONST", "ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST") -private fun KSAnnotation.toParameter(): GenerateQueryHelper.Parameter { - val arguments = arguments() - - return GenerateQueryHelper.Parameter( - name = arguments[GenerateQueryHelper.Parameter::name]!!, - queryName = arguments[GenerateQueryHelper.Parameter::queryName] ?: "", - kDoc = arguments[GenerateQueryHelper.Parameter::kDoc] ?: "", - type = arguments[GenerateQueryHelper.Parameter::type] ?: GenerateQueryHelper.Parameter.Type.STRING, - enumTypes = (arguments[GenerateQueryHelper.Parameter::enumTypes] ?: emptyList()).map { - it.toEnumType() - }.toTypedArray() - ) -} - -@Suppress("ANNOTATION_ARGUMENT_MUST_BE_CONST", "ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST") -private fun KSAnnotation.toEnumType(): GenerateQueryHelper.Parameter.EnumType { - val arguments = arguments() - - return GenerateQueryHelper.Parameter.EnumType( - name = arguments[GenerateQueryHelper.Parameter.EnumType::name]!!, - value = arguments[GenerateQueryHelper.Parameter.EnumType::value]!!, - kDoc = arguments[GenerateQueryHelper.Parameter.EnumType::kDoc]!! - ) -} - -internal class AnnotationArguments private constructor( - private val arguments: Map, -) { - private fun getArgument(parameter: KProperty1) = arguments.getValue(parameter.name) - private val KProperty1.value get() = getArgument(this).value - - fun isDefault(parameter: KProperty1) = getArgument(parameter).isDefault() - - // can't return non-nullable values because of https://github.com/google/ksp/issues/885 - operator fun get(parameter: KProperty1) = parameter.value as Int? - operator fun get(parameter: KProperty1) = parameter.value as Boolean? - operator fun get(parameter: KProperty1) = parameter.value as String? - operator fun get(parameter: KProperty1) = parameter.value as KSAnnotation? - inline operator fun > get(parameter: KProperty1) = - (parameter.value as KSType?)?.toEnumEntry() - - @JvmName("getStrings") - operator fun get(parameter: KProperty1>) = - @Suppress("UNCHECKED_CAST") (parameter.value as List?) - - @JvmName("getAnnotations") - operator fun get(parameter: KProperty1>) = - @Suppress("UNCHECKED_CAST") (parameter.value as List?) - - companion object { - fun KSAnnotation.arguments() = - AnnotationArguments(arguments.associateBy { it.name!!.asString() }) - } -} - -/** Maps [KSType] to an entry of the enum class [E]. */ -private inline fun > KSType.toEnumEntry(): E { - val decl = declaration - require(decl is KSClassDeclaration && decl.classKind == ClassKind.ENUM_ENTRY) - val name = decl.qualifiedName!! - require(name.getQualifier() == E::class.qualifiedName) - return enumValueOf(name.getShortName()) -} diff --git a/plugins/kspProcessor/src/main/kotlin/generator/Builder.kt b/plugins/kspProcessor/src/main/kotlin/generator/Builder.kt index 969f4f38..595fed85 100644 --- a/plugins/kspProcessor/src/main/kotlin/generator/Builder.kt +++ b/plugins/kspProcessor/src/main/kotlin/generator/Builder.kt @@ -5,58 +5,61 @@ package dev.schlaubi.lavakord.ksp.generator import com.squareup.kotlinpoet.* import dev.kord.codegen.kotlinpoet.* -import dev.schlaubi.lavakord.internal.GenerateQueryHelper +import dev.schlaubi.lavakord.PluginApi +import dev.schlaubi.lavakord.internal.processing.GenerateQueryHelper +import dev.schlaubi.lavakord.internal.GenerateQueryHelper as Annotation import dev.schlaubi.lavakord.ksp.* -@OptIn(DelicateKotlinPoetApi::class) +@OptIn(DelicateKotlinPoetApi::class, PluginApi::class) @Suppress("EQUALS_MISSING") -internal fun GenerateQueryHelper.generateBuilder(name: ClassName) = TypeSpec.`class`(name) { - addAnnotation(Suppress("MemberVisibilityCanBePrivate")) - addSuperinterface(QUERY_BUILDER) - builderOptions.forEach { - val type = if (it.type == GenerateQueryHelper.Parameter.Type.ENUM) { - val enumName = name.nestedClass(it.name.capitalize()) - val enumSpec = generateEnum(enumName, it) +internal fun GenerateQueryHelper.generateBuilder(name: ClassName) = + TypeSpec.`class`(name) { + addAnnotation(Suppress("MemberVisibilityCanBePrivate")) + addSuperinterface(QUERY_BUILDER) + builderOptions.forEach { + val type = if (it.type == Annotation.Parameter.Type.ENUM) { + val enumName = name.nestedClass(it.name.capitalize()) + val enumSpec = generateEnum(enumName, it) - addType(enumSpec) - enumName - } else { - it.type.toType() - } - addProperty(it.name, type.asNullable()) { - addKdoc(it.kDoc) - mutable(true) - initializer("null") + addType(enumSpec) + enumName + } else { + it.type.toType() + } + addProperty(it.name, type.asNullable()) { + addKdoc(it.kDoc) + mutable(true) + initializer("null") + } } - } - addFunction("toQuery") { - this@generateBuilder.parameters.forEach { parameter -> - addParameter(parameter.name, parameter.type.toType()) - } - addModifiers(KModifier.INTERNAL) - addAnnotation(PublishedApi()) - returns() + addFunction("toQuery") { + this@generateBuilder.parameters.forEach { parameter -> + addParameter(parameter.name, parameter.type.toType()) + } + addModifiers(KModifier.INTERNAL) + addAnnotation(PublishedApi()) + returns() - val allParameters = this@generateBuilder.parameters + this@generateBuilder.builderOptions - val parameters = allParameters - .map { - CodeBlock.of("%S·to·%L", it.queryName, it.name) - }.joinToCode(", ") - val packageName = builderFunction.substringBeforeLast('.') - val functionName = builderFunction.substringAfterLast('.') - val function = MemberName(packageName, functionName) - addAnnotation(Suppress("INVISIBLE_MEMBER")) - addStatement("return·%M(%L)", function, parameters) - } - addKdoc("Builder for $serviceName $operationName queries.") - addCompanionObject { - addProperty("Default", name) { - initializer("%T()", name) - addKdoc("An instance of the builder with default values") + val allParameters = this@generateBuilder.parameters + this@generateBuilder.builderOptions + val parameters = allParameters + .map { + CodeBlock.of("%S·to·%L", it.queryName, it.name) + }.joinToCode(", ") + val packageName = builderFunction.substringBeforeLast('.') + val functionName = builderFunction.substringAfterLast('.') + val function = MemberName(packageName, functionName) + addAnnotation(Suppress("INVISIBLE_MEMBER")) + addStatement("return·%M(%L)", function, parameters) + } + addKdoc("Builder for $serviceName $operationName queries.") + addCompanionObject { + addProperty("Default", name) { + initializer("%T()", name) + addKdoc("An instance of the builder with default values") + } } } -} /** * Generated an enum like this: diff --git a/plugins/kspProcessor/src/main/kotlin/generator/Functions.kt b/plugins/kspProcessor/src/main/kotlin/generator/Functions.kt index e5020279..a997ab24 100644 --- a/plugins/kspProcessor/src/main/kotlin/generator/Functions.kt +++ b/plugins/kspProcessor/src/main/kotlin/generator/Functions.kt @@ -32,7 +32,7 @@ import dev.schlaubi.lavakord.ksp.* * } * ``` */ -internal fun GenerateQueryHelper.searchAndPlay(builderName: ClassName): FunSpec { +internal fun dev.schlaubi.lavakord.internal.processing.GenerateQueryHelper.searchAndPlay(builderName: ClassName): FunSpec { val playOptionsBuilder = ParameterSpec("playOptionsBuilder", PLAY_OPTIONS_BUILDER) { defaultValue("""{}""") } @@ -64,7 +64,7 @@ internal fun GenerateQueryHelper.searchAndPlay(builderName: ClassName): FunSpec * loadItem("{prefix}:$query") *``` */ -internal fun GenerateQueryHelper.search(builderName: ClassName): FunSpec { +internal fun dev.schlaubi.lavakord.internal.processing.GenerateQueryHelper.search(builderName: ClassName): FunSpec { val optionsParameterName = "options" val builderLambda = LambdaTypeName.get(builderName, returnType = UNIT) val builderParameter = ParameterSpec.builder("builder", builderLambda) diff --git a/plugins/lavasearch/build.gradle.kts b/plugins/lavasearch/build.gradle.kts index 26909ef3..9718e594 100644 --- a/plugins/lavasearch/build.gradle.kts +++ b/plugins/lavasearch/build.gradle.kts @@ -1,5 +1,6 @@ import com.vanniktech.maven.publish.JavadocJar import com.vanniktech.maven.publish.KotlinMultiplatform +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { @@ -12,11 +13,14 @@ plugins { kotlin { jvm { compilations.all { - compilerOptions.configure { - jvmTarget = JvmTarget.JVM_11 + compileTaskProvider.configure { + compilerOptions { + jvmTarget = JvmTarget.JVM_11 + } } } } + sourceSets { all { languageSettings.optIn("kotlin.contracts.ExperimentalContracts") @@ -41,7 +45,14 @@ dependencies { } tasks { - listOf("sourcesJar", "jsSourcesJar", "jvmSourcesJar", "compileKotlinJs", "compileKotlinJvm", "dokkaHtml").forEach { + listOf( + "sourcesJar", + "jsSourcesJar", + "jvmSourcesJar", + "compileKotlinJs", + "compileKotlinJvm", + "dokkaHtml" + ).forEach { named(it) { dependsOn("kspCommonMainKotlinMetadata") } diff --git a/plugins/lavasearch/src/commonMain/kotlin/Plugin.kt b/plugins/lavasearch/src/commonMain/kotlin/Plugin.kt index e3cda732..4d137832 100644 --- a/plugins/lavasearch/src/commonMain/kotlin/Plugin.kt +++ b/plugins/lavasearch/src/commonMain/kotlin/Plugin.kt @@ -13,5 +13,5 @@ import dev.schlaubi.lavakord.Plugin */ public object LavaSearch : Plugin { override val name: String = "lavasearch-plugin" - override val version: String = "4.0.0-beta.3" + override val version: String = "1.0.0" } diff --git a/plugins/lavasrc/build.gradle.kts b/plugins/lavasrc/build.gradle.kts index 6bd13ccb..b71974d4 100644 --- a/plugins/lavasrc/build.gradle.kts +++ b/plugins/lavasrc/build.gradle.kts @@ -1,5 +1,6 @@ import com.vanniktech.maven.publish.JavadocJar import com.vanniktech.maven.publish.KotlinMultiplatform +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { @@ -11,8 +12,10 @@ plugins { kotlin { jvm { compilations.all { - compilerOptions.configure { - jvmTarget = JvmTarget.JVM_11 + compileTaskProvider.configure { + compilerOptions { + jvmTarget = JvmTarget.JVM_11 + } } } } @@ -34,16 +37,16 @@ kotlin { } dependencies { - kspCommonMainMetadata(projects.plugins.kspProcessor) +// kspCommonMainMetadata(projects.plugins.kspProcessor) } -tasks { - listOf("sourcesJar", "jsSourcesJar", "jvmSourcesJar", "compileKotlinJs", "compileKotlinJvm", "dokkaHtml").forEach { - named(it) { - dependsOn("kspCommonMainKotlinMetadata") - } - } -} +//tasks { +// listOf("sourcesJar", "jsSourcesJar", "jvmSourcesJar", "compileKotlinJs", "compileKotlinJvm", "dokkaHtml").forEach { +// named(it) { +// dependsOn("kspCommonMainKotlinMetadata") +// } +// } +//} mavenPublishing { configure(KotlinMultiplatform(JavadocJar.Dokka("dokkaHtml"))) diff --git a/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/AppleMusicHelperFunctions.kt b/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/AppleMusicHelperFunctions.kt deleted file mode 100644 index 23822b62..00000000 --- a/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/AppleMusicHelperFunctions.kt +++ /dev/null @@ -1,28 +0,0 @@ -// DO NOT EDIT!! - This code has been generated by QueryUtilityProcessor -// Edit this file instead lavasrc/src/commonMain/kotlin/QueryUtils.kt -@file:Suppress(names = arrayOf("IncorrectFormatting", "INVISIBLE_REFERENCE")) - -package dev.schlaubi.lavakord.plugins.lavasrc - -import dev.arbjerg.lavalink.protocol.v4.LoadResult -import dev.schlaubi.lavakord.audio.Node -import dev.schlaubi.lavakord.audio.player.PlayOptions -import dev.schlaubi.lavakord.audio.player.Player -import dev.schlaubi.lavakord.rest.loadItem -import kotlin.contracts.InvocationKind.EXACTLY_ONCE -import kotlin.contracts.contract - -/** - * Performs a track search and plays the result using [Apple Music](https://music.apple.com). - */ -public suspend fun Player.searchAndPlayUsingAppleMusic(query: String, - playOptionsBuilder: PlayOptions.() -> Unit = {}) { - contract { callsInPlace(playOptionsBuilder, EXACTLY_ONCE) } - searchAndPlayTrack("amsearch:$query", playOptionsBuilder) -} - -/** - * Performs a track search using [Apple Music](https://music.apple.com). - */ -public suspend fun Node.searchUsingAppleMusic(query: String): LoadResult = - loadItem("amsearch:$query") diff --git a/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/DeezerHelperFunctions.kt b/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/DeezerHelperFunctions.kt deleted file mode 100644 index 18788e4e..00000000 --- a/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/DeezerHelperFunctions.kt +++ /dev/null @@ -1,47 +0,0 @@ -// DO NOT EDIT!! - This code has been generated by QueryUtilityProcessor -// Edit this file instead lavasrc/src/commonMain/kotlin/QueryUtils.kt -@file:Suppress(names = arrayOf("IncorrectFormatting", "INVISIBLE_REFERENCE")) - -package dev.schlaubi.lavakord.plugins.lavasrc - -import dev.arbjerg.lavalink.protocol.v4.LoadResult -import dev.schlaubi.lavakord.audio.Node -import dev.schlaubi.lavakord.audio.player.PlayOptions -import dev.schlaubi.lavakord.audio.player.Player -import dev.schlaubi.lavakord.rest.loadItem -import kotlin.contracts.InvocationKind.EXACTLY_ONCE -import kotlin.contracts.contract - -/** - * Performs a track search and plays the result using [Deezer](https://deezer.com). - */ -public suspend fun Player.searchAndPlayUsingDeezer(query: String, - playOptionsBuilder: PlayOptions.() -> Unit = {}) { - contract { callsInPlace(playOptionsBuilder, EXACTLY_ONCE) } - searchAndPlayTrack("dzsearch:$query", playOptionsBuilder) -} - -/** - * Performs a track search using [Deezer](https://deezer.com). - */ -public suspend fun Node.searchUsingDeezer(query: String): LoadResult = loadItem("dzsearch:$query") - -/** - * Performs a track search and plays the result using [Deezer](https://deezer.com). - * - * @param isrc The [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code) of - * the song you want to play - */ -public suspend fun Player.loadAndPlayUsingDeezer(isrc: String, - playOptionsBuilder: PlayOptions.() -> Unit = {}) { - contract { callsInPlace(playOptionsBuilder, EXACTLY_ONCE) } - searchAndPlayTrack("dzisrc:$isrc", playOptionsBuilder) -} - -/** - * Performs a track search using [Deezer](https://deezer.com). - * - * @param isrc The [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code) of - * the song you want to play - */ -public suspend fun Node.loadUsingDeezer(isrc: String): LoadResult = loadItem("dzisrc:$isrc") diff --git a/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/SpotifyHelperFunctions.kt b/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/SpotifyHelperFunctions.kt deleted file mode 100644 index 0f3b3627..00000000 --- a/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/SpotifyHelperFunctions.kt +++ /dev/null @@ -1,516 +0,0 @@ -// DO NOT EDIT!! - This code has been generated by QueryUtilityProcessor -// Edit this file instead lavasrc/src/commonMain/kotlin/QueryUtils.kt -@file:Suppress(names = arrayOf("IncorrectFormatting", "INVISIBLE_REFERENCE")) - -package dev.schlaubi.lavakord.plugins.lavasrc - -import dev.arbjerg.lavalink.protocol.v4.LoadResult -import dev.schlaubi.lavakord.`internal`.QueryBuilder -import dev.schlaubi.lavakord.`internal`.query -import dev.schlaubi.lavakord.`internal`.taggedQuery -import dev.schlaubi.lavakord.audio.Node -import dev.schlaubi.lavakord.audio.player.PlayOptions -import dev.schlaubi.lavakord.audio.player.Player -import dev.schlaubi.lavakord.rest.loadItem -import kotlin.contracts.InvocationKind.EXACTLY_ONCE -import kotlin.contracts.contract - -/** - * Performs a track search and plays the result using [Spotify](https://spotify.com). - */ -public suspend fun Player.searchAndPlayUsingSpotify( - query: String, - options: SpotifySearchQueryBuilder = SpotifySearchQueryBuilder.Default, - playOptionsBuilder: PlayOptions.() -> Unit = {}, -) { - contract { callsInPlace(playOptionsBuilder, EXACTLY_ONCE) } - searchAndPlayTrack("spsearch:" + options.toQuery(query), playOptionsBuilder) -} - -/** - * Performs a track search using [Spotify](https://spotify.com). - */ -public suspend inline fun Node.searchUsingSpotify(query: String, - builder: SpotifySearchQueryBuilder.() -> Unit = {}): LoadResult { - contract { callsInPlace(builder, EXACTLY_ONCE) } - val options = SpotifySearchQueryBuilder().apply(builder) - return loadItem("spsearch:" + options.toQuery(query)) -} - -/** - * Builder for Spotify search queries. - */ -@Suppress(names = arrayOf("MemberVisibilityCanBePrivate")) -public class SpotifySearchQueryBuilder : QueryBuilder { - /** - * Searches for results from a specific arist (Only works for album, artists and tracks) - */ - public var artist: String? = null - - /** - * Searches for results from within a specific range (eg.1955-1960) (Only works for album, - * artists and tracks) - */ - public var year: String? = null - - /** - * Searches for results containing a specific track (like Albums, Artists) - */ - public var track: String? = null - - /** - * Searches for albums with a specific upc - */ - public var upc: String? = null - - /** - * Searches for a specific track by it's isrc - */ - public var isrc: String? = null - - /** - * Searches for a specific track by it's isrc - */ - public var tag: Tag? = null - - @PublishedApi - @Suppress(names = arrayOf("INVISIBLE_MEMBER")) - internal fun toQuery(query: String): String = taggedQuery("" to query, "artist" to artist, - "year" to year, "track" to track, "upc" to upc, "isrc" to isrc, "tag" to tag) - - /** - * Type of [Tag]. - */ - public enum class Tag( - /** - * The value used in queries - */ - public val `value`: String, - ) { - /** - * The `tag:new` filter will return albums released in the past two weeks - */ - NEW("new"), - /** - * The `tag:hipster` can be used to return only albums with the lowest 10% popularity. - */ - HIPSTER("hipster"), - ; - - override fun toString(): String = value - } - - public companion object { - /** - * An instance of the builder with default values - */ - public val Default: SpotifySearchQueryBuilder = SpotifySearchQueryBuilder() - } -} - -/** - * Creates a new [SpotifySearchQueryBuilder] and applies [builder] to it - */ -public inline fun spotifySearchQuery(builder: SpotifySearchQueryBuilder.() -> Unit): - SpotifySearchQueryBuilder { - contract { callsInPlace(builder, EXACTLY_ONCE) } - return SpotifySearchQueryBuilder().apply(builder) -} - -/** - * Performs a track search using [Spotify](https://spotify.com). - * - * @param seedArtists A comma separated list of - * [Spotify IDs](https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids) for - * seed artists - * @param seedGenres A comma separated list of any genres in the set of - * [available genre seeds](https://developer.spotify.com/documentation/web-api/reference/get-recommendations#available-genre-seeds) - * @param seedTracks A comma separated list of - * [Spotify IDs](https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids) for - * seed tracks - */ -public suspend inline fun Node.recommendUsingSpotify( - seedArtists: String, - seedGenres: String, - seedTracks: String, - builder: SpotifyRecommendQueryBuilder.() -> Unit = {}, -): LoadResult { - contract { callsInPlace(builder, EXACTLY_ONCE) } - val options = SpotifyRecommendQueryBuilder().apply(builder) - return loadItem("sprec:" + options.toQuery(seedArtists, seedGenres, seedTracks)) -} - -/** - * Builder for Spotify recommend queries. - */ -@Suppress(names = arrayOf("MemberVisibilityCanBePrivate")) -public class SpotifyRecommendQueryBuilder : QueryBuilder { - /** - * The target size of the list of recommended tracks. For seeds with unusually small pools or - * when highly restrictive filtering is applied, it may be impossible to generate the requested - * number of recommended tracks. Debugging information for such cases is available in the response. - * Default: 20. Minimum: 1. Maximum: 100. - */ - public var limit: Int? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minAcousticness: Double? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxAcousticness: Double? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetAcousticness: Double? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minDanceability: Double? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxDanceability: Double? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetDanceability: Double? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minDurationMs: Int? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxDurationMs: Int? = null - - /** - * Target duration of the track (ms) - */ - public var targetDurationMs: Int? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minEnergy: Double? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxEnergy: Double? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetEnergy: Double? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minInstrumentalness: Double? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxInstrumentalness: Double? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetInstrumentalness: Double? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minKey: Int? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxKey: Int? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetKey: Int? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minLiveness: Double? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxLiveness: Double? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetLiveness: Double? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minLoudness: Double? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxLoudness: Double? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetLoudness: Double? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minMode: Int? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxMode: Int? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetMode: Int? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minPopularity: Int? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxPopularity: Int? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetPopularity: Int? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minSpeechiness: Double? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxSpeechiness: Double? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetSpeechiness: Double? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minTempo: Double? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxTempo: Double? = null - - /** - * Target tempo (BPM) - */ - public var targetTempo: Double? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minTimeSignature: Int? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxTimeSignature: Int? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetTimeSignature: Int? = null - - /** - * For each tunable track attribute, a hard floor on the selected track attribute’s value can be - * provided. See tunable track attributes below for the list of available options. For example, - * `min_tempo=140` would restrict results to only those tracks with a tempo of greater than 140 - * beats per minute. - */ - public var minValence: Double? = null - - /** - * For each tunable track attribute, a hard ceiling on the selected track attribute’s value can - * be provided. See tunable track attributes below for the list of available options. For example, - * `max_instrumentalness=0.35` would filter out most tracks that are likely to be instrumental. - */ - public var maxValence: Double? = null - - /** - * For each of the tunable track attributes (below) a target value may be provided. Tracks with - * the attribute values nearest to the target values will be preferred. For example, you might - * request `target_energy=0.6` and `target_danceability=0.8`. All target values will be weighed - * equally in ranking results. - */ - public var targetValence: Double? = null - - @PublishedApi - @Suppress(names = arrayOf("INVISIBLE_MEMBER")) - internal fun toQuery( - seedArtists: String, - seedGenres: String, - seedTracks: String, - ): String = query("seed_artists" to seedArtists, "seed_genres" to seedGenres, - "seed_tracks" to seedTracks, "limit" to limit, "min_acousticness" to minAcousticness, - "max_acousticness" to maxAcousticness, "target_acousticness" to targetAcousticness, - "min_danceability" to minDanceability, "max_danceability" to maxDanceability, - "target_danceability" to targetDanceability, "min_duration_ms" to minDurationMs, - "max_duration_ms" to maxDurationMs, "target_duration_ms" to targetDurationMs, - "min_energy" to minEnergy, "max_energy" to maxEnergy, "target_energy" to targetEnergy, - "min_instrumentalness" to minInstrumentalness, - "max_instrumentalness" to maxInstrumentalness, - "target_instrumentalness" to targetInstrumentalness, "min_key" to minKey, - "max_key" to maxKey, "target_key" to targetKey, "min_liveness" to minLiveness, - "max_liveness" to maxLiveness, "target_liveness" to targetLiveness, - "min_loudness" to minLoudness, "max_loudness" to maxLoudness, - "target_loudness" to targetLoudness, "min_mode" to minMode, "max_mode" to maxMode, - "target_mode" to targetMode, "min_popularity" to minPopularity, - "max_popularity" to maxPopularity, "target_popularity" to targetPopularity, - "min_speechiness" to minSpeechiness, "max_speechiness" to maxSpeechiness, - "target_speechiness" to targetSpeechiness, "min_tempo" to minTempo, - "max_tempo" to maxTempo, "target_tempo" to targetTempo, - "min_time_signature" to minTimeSignature, "max_time_signature" to maxTimeSignature, - "target_time_signature" to targetTimeSignature, "min_valence" to minValence, - "max_valence" to maxValence, "target_valence" to targetValence) - - public companion object { - /** - * An instance of the builder with default values - */ - public val Default: SpotifyRecommendQueryBuilder = SpotifyRecommendQueryBuilder() - } -} - -/** - * Creates a new [SpotifyRecommendQueryBuilder] and applies [builder] to it - */ -public inline fun spotifyRecommendQuery(builder: SpotifyRecommendQueryBuilder.() -> Unit): - SpotifyRecommendQueryBuilder { - contract { callsInPlace(builder, EXACTLY_ONCE) } - return SpotifyRecommendQueryBuilder().apply(builder) -} diff --git a/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/YandexMusicHelperFunctions.kt b/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/YandexMusicHelperFunctions.kt deleted file mode 100644 index 00fea359..00000000 --- a/plugins/lavasrc/build/generated/ksp/metadata/commonMain/kotlin/dev/schlaubi/lavakord/plugins/lavasrc/YandexMusicHelperFunctions.kt +++ /dev/null @@ -1,28 +0,0 @@ -// DO NOT EDIT!! - This code has been generated by QueryUtilityProcessor -// Edit this file instead lavasrc/src/commonMain/kotlin/QueryUtils.kt -@file:Suppress(names = arrayOf("IncorrectFormatting", "INVISIBLE_REFERENCE")) - -package dev.schlaubi.lavakord.plugins.lavasrc - -import dev.arbjerg.lavalink.protocol.v4.LoadResult -import dev.schlaubi.lavakord.audio.Node -import dev.schlaubi.lavakord.audio.player.PlayOptions -import dev.schlaubi.lavakord.audio.player.Player -import dev.schlaubi.lavakord.rest.loadItem -import kotlin.contracts.InvocationKind.EXACTLY_ONCE -import kotlin.contracts.contract - -/** - * Performs a track search and plays the result using [Yandex Music](https://music.yandex.ru). - */ -public suspend fun Player.searchAndPlayUsingYandexMusic(query: String, - playOptionsBuilder: PlayOptions.() -> Unit = {}) { - contract { callsInPlace(playOptionsBuilder, EXACTLY_ONCE) } - searchAndPlayTrack("ymsearch:$query", playOptionsBuilder) -} - -/** - * Performs a track search using [Yandex Music](https://music.yandex.ru). - */ -public suspend fun Node.searchUsingYandexMusic(query: String): LoadResult = - loadItem("ymsearch:$query") diff --git a/plugins/lavasrc/src/commonMain/kotlin/Plugin.kt b/plugins/lavasrc/src/commonMain/kotlin/Plugin.kt index 36a4d615..5499dbe4 100644 --- a/plugins/lavasrc/src/commonMain/kotlin/Plugin.kt +++ b/plugins/lavasrc/src/commonMain/kotlin/Plugin.kt @@ -18,5 +18,5 @@ internal val json = Json { */ public object LavaSrc : Plugin { override val name: String = "lavasrc-plugin" - override val version: String = "4.0.0-beta.3" + override val version: String = "4.1.1" } diff --git a/plugins/lavasrc/src/commonMain/kotlin/QueryUtils.kt b/plugins/lavasrc/src/commonMain/kotlin/QueryUtils.kt index aa8dfac4..645b6f37 100644 --- a/plugins/lavasrc/src/commonMain/kotlin/QueryUtils.kt +++ b/plugins/lavasrc/src/commonMain/kotlin/QueryUtils.kt @@ -6,6 +6,7 @@ packageName = PACKAGE_NAME, prefix = "spsearch", builderFunction = "dev.schlaubi.lavakord.internal.taggedQuery", + parameters = [GenerateQueryHelper.Parameter("query", "", "", GenerateQueryHelper.Parameter.Type.STRING, [])], builderOptions = [ GenerateQueryHelper.Parameter( "artist", @@ -62,6 +63,7 @@ serviceWebsite = "https://music.yandex.ru", generateSearchAndPlayFunction = true, packageName = PACKAGE_NAME, + parameters = [GenerateQueryHelper.Parameter("query", "", "", GenerateQueryHelper.Parameter.Type.STRING, [])], prefix = "ymsearch" ) @@ -70,6 +72,7 @@ serviceWebsite = "https://music.apple.com", generateSearchAndPlayFunction = true, packageName = PACKAGE_NAME, + parameters = [GenerateQueryHelper.Parameter("query", "", "", GenerateQueryHelper.Parameter.Type.STRING, [])], prefix = "amsearch" ) @@ -78,6 +81,7 @@ serviceWebsite = "https://deezer.com", generateSearchAndPlayFunction = true, packageName = PACKAGE_NAME, + parameters = [GenerateQueryHelper.Parameter("query", "", "", GenerateQueryHelper.Parameter.Type.STRING, [])], prefix = "dzsearch" ) @@ -99,15 +103,15 @@ private const val PACKAGE_NAME = "dev.schlaubi.lavakord.plugins.lavasrc" private const val isrcDoc = "The [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code) of the song you want to play" -/** - * Searches for items in the year range from [start] end [end]. - */ -public fun SpotifySearchQueryBuilder.fromYear(start: Int, end: Int? = null) { - year = buildString { - append(start) - if (end != null) { - append('-') - append(end) - } - } -} +///** +// * Searches for items in the year range from [start] end [end]. +// */ +//public fun SpotifySearchQueryBuilder.fromYear(start: Int, end: Int? = null) { +// year = buildString { +// append(start) +// if (end != null) { +// append('-') +// append(end) +// } +// } +//} diff --git a/plugins/lyrics/build.gradle.kts b/plugins/lyrics/build.gradle.kts index eb31a1c5..8d05c5a0 100644 --- a/plugins/lyrics/build.gradle.kts +++ b/plugins/lyrics/build.gradle.kts @@ -1,5 +1,6 @@ import com.vanniktech.maven.publish.JavadocJar import com.vanniktech.maven.publish.KotlinMultiplatform +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { @@ -11,8 +12,10 @@ plugins { kotlin { jvm { compilations.all { - compilerOptions.configure { - jvmTarget = JvmTarget.JVM_17 + compileTaskProvider.configure { + compilerOptions { + jvmTarget = JvmTarget.JVM_11 + } } } } diff --git a/plugins/lyrics/src/commonMain/kotlin/Plugin.kt b/plugins/lyrics/src/commonMain/kotlin/Plugin.kt index 5d00bd65..5f2fdbd5 100644 --- a/plugins/lyrics/src/commonMain/kotlin/Plugin.kt +++ b/plugins/lyrics/src/commonMain/kotlin/Plugin.kt @@ -14,5 +14,5 @@ import kotlinx.serialization.json.Json */ public object Lyrics : Plugin { override val name: String = "lyrics" - override val version: String = "2.0.0" + override val version: String = "2.4.8" } diff --git a/plugins/sponsorblock/src/commonMain/kotlin/Plugin.kt b/plugins/sponsorblock/src/commonMain/kotlin/Plugin.kt index 34de0065..0a827ff1 100644 --- a/plugins/sponsorblock/src/commonMain/kotlin/Plugin.kt +++ b/plugins/sponsorblock/src/commonMain/kotlin/Plugin.kt @@ -20,7 +20,7 @@ public object Sponsorblock : Plugin { override val name: String get() = "sponsorblock-plugin" override val version: String - get() = "3.0.0-beta.1" + get() = "3.0.0" override val eventTypes: List = listOf("SegmentsLoaded", "SegmentSkipped", "ChaptersLoaded", "ChapterStarted") diff --git a/settings.gradle.kts b/settings.gradle.kts index c3dcfb6a..93449d0c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,4 @@ -@file:Suppress("UnstableApiUsage", "KDocMissingDocumentation") +@file:Suppress("KDocMissingDocumentation") rootProject.name = "lavakord" include( @@ -22,6 +22,7 @@ pluginManagement { resolutionStrategy { repositories { gradlePluginPortal() + maven("https://europe-west3-maven.pkg.dev/mik-music/kord") } eachPlugin { @@ -39,7 +40,7 @@ dependencyResolutionManagement { kotlinx() ktor() ksp() - library("kord-core", "dev.kord", "kord-core").version("0.13.1") + library("kord-core", "dev.kord", "kord-core").version("0.14.0") library( "kord-ksp-annotations", "dev.kord", @@ -50,14 +51,14 @@ dependencyResolutionManagement { "dev.kord", "kord-ksp-processors" ).version("feature-publish-processor-SNAPSHOT") - library("junit-jupiter-engine", "org.junit.jupiter", "junit-jupiter-engine").version("5.10.1") - library("kotlinlogging", "io.github.oshai", "kotlin-logging").version("6.0.9") + library("junit-jupiter-engine", "org.junit.jupiter", "junit-jupiter-engine").version("5.10.2") + library("kotlinlogging", "io.github.oshai", "kotlin-logging").version("7.0.0") library("sl4fj-simple", "org.slf4j", "slf4j-simple").version("2.0.13") - library("kotlinx-nodejs", "org.jetbrains.kotlin-wrappers", "kotlin-node").version("20.11.30-pre.742") + library("kotlinx-nodejs", "org.jetbrains.kotlin-wrappers", "kotlin-node").version("20.11.30-pre.758") - library("lavalink-protocol", "dev.arbjerg.lavalink", "protocol").version("4.0.5") - library("lyrics-protocol", "dev.schlaubi.lyrics", "protocol").version("2.4.5") + library("lavalink-protocol", "dev.arbjerg.lavalink", "protocol").version("4.0.6") + library("lyrics-protocol", "dev.schlaubi.lyrics", "protocol").version("2.4.7") library( "lavasearch-protocol", "com.github.topi314.lavasearch", @@ -67,33 +68,32 @@ dependencyResolutionManagement { "lavasrc-protocol", "com.github.topi314.lavasrc", "protocol" - ).version("4.1.0") + ).version("4.1.1") - library("kotlinpoet", "com.squareup", "kotlinpoet-ksp").version("1.16.0") + library("kotlinpoet", "com.squareup", "kotlinpoet-ksp").version("1.17.0") library("codegen", "dev.kord.codegen", "kotlinpoet").versionRef(codegen) - library("codegen-ksp", "dev.kord.codegen", "ksp").versionRef(codegen) + library("codegen-ksp", "dev.kord.codegen", "ksp").version("main-20240621.172501-14") library("codegen-ksp-annotations", "dev.kord.codegen", "ksp-annotations").versionRef(codegen) - library("codegen-ksp-processor", "dev.kord.codegen", "ksp-processor").versionRef(codegen) + library("codegen-ksp-processor", "dev.kord.codegen", "ksp-processor").version("main-20240621.160631-15") plugin("kotlinx-atomicfu", "kotlinx-atomicfu").version("0.24.0") - plugin("git-publish", "org.ajoberstar.git-publish").version("4.2.2") } } } fun VersionCatalogBuilder.kotlinx() { - val coroutines = version("coroutines", "1.8.1") + val coroutines = version("coroutines", "1.9.0-RC") library("kotlinx-coroutines-core", "org.jetbrains.kotlinx", "kotlinx-coroutines-core").versionRef(coroutines) library("kotlinx-coroutines-jdk8", "org.jetbrains.kotlinx", "kotlinx-coroutines-jdk8").versionRef(coroutines) library("kotlinx-coroutines-jdk9", "org.jetbrains.kotlinx", "kotlinx-coroutines-jdk9").versionRef(coroutines) library("kotlinx-coroutines-test", "org.jetbrains.kotlinx", "kotlinx-coroutines-test").versionRef(coroutines) - library("kotlinx-serialization-json", "org.jetbrains.kotlinx", "kotlinx-serialization-json").version("1.6.3") + library("kotlinx-serialization-json", "org.jetbrains.kotlinx", "kotlinx-serialization-json").version("1.7.0") library("kotlinx-datetime", "org.jetbrains.kotlinx", "kotlinx-datetime").version("0.5.0") } fun VersionCatalogBuilder.ktor() { - val ktor = version("ktor", "2.3.11") + val ktor = version("ktor", "2.3.12") library("ktor-io", "io.ktor", "ktor-io").versionRef(ktor) library("ktor-utils", "io.ktor", "ktor-utils").versionRef(ktor) library("ktor-client-websockets", "io.ktor", "ktor-client-websockets").versionRef(ktor) @@ -108,7 +108,8 @@ fun VersionCatalogBuilder.ktor() { } fun VersionCatalogBuilder.ksp() { - val ksp = version("ksp", "1.9.24-1.0.20") + val ksp = version("ksp", "2.0.0-1.0.22") library("ksp-api", "com.google.devtools.ksp", "symbol-processing-api").versionRef(ksp) plugin("ksp", "com.google.devtools.ksp").versionRef(ksp) + plugin("gradle-tools", "dev.kord.gradle-tools").version("1.5.3") }