Skip to content

Commit

Permalink
Update KordEx and Gradle, pin to Java 13 (#9)
Browse files Browse the repository at this point in the history
* Update KordEx and Gradle, pin to Java 13

* Address review comment

* Run the wrapper update task a second time?

* Workflows: Fix JDK version

* OK, no more toolchains.
  • Loading branch information
gdude2002 authored Aug 18, 2024
1 parent 01441a5 commit 02fa472
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 49 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4

with:
distribution: 'temurin'
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

Expand All @@ -30,11 +37,12 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
- name: Set up JDK 17
uses: actions/setup-java@v4

with:
distribution: 'temurin'
java-version: 21
java-version: 17

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand All @@ -52,6 +60,13 @@ jobs:
# steps:
# - uses: actions/checkout@v4
#
# - name: Set up JDK 17
# uses: actions/setup-java@v4
#
# with:
# distribution: 'temurin'
# java-version: 17
#
# - name: Run tests
# uses: gradle/actions/setup-gradle@v3
# env:
Expand Down Expand Up @@ -79,6 +94,13 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 17
uses: actions/setup-java@v4

with:
distribution: 'temurin'
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
java-version: 17

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down Expand Up @@ -45,6 +45,13 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 17
uses: actions/setup-java@v4

with:
distribution: 'temurin'
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

Expand Down
8 changes: 4 additions & 4 deletions api/doc-generator.api
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
public final class org/hyacinthbots/docgenerator/_docAdditionKt {
public static final fun additionalDocumentation (Lcom/kotlindiscord/kord/extensions/commands/application/ApplicationCommand;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun subCommandAdditionalDocumentation (Lcom/kotlindiscord/kord/extensions/commands/application/ApplicationCommand;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun additionalDocumentation (Ldev/kordex/core/commands/application/ApplicationCommand;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun subCommandAdditionalDocumentation (Ldev/kordex/core/commands/application/ApplicationCommand;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public final class org/hyacinthbots/docgenerator/_docGeneratorKt {
public static final fun docsGenerator (Lcom/kotlindiscord/kord/extensions/builders/ExtensibleBotBuilder;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun docsGenerator (Ldev/kordex/core/builders/ExtensibleBotBuilder;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public abstract interface annotation class org/hyacinthbots/docgenerator/annotations/ConfigurationBuilderDSL : java/lang/annotation/Annotation {
Expand Down Expand Up @@ -96,7 +96,7 @@ public final class org/hyacinthbots/docgenerator/exceptions/InvalidEnvironmentVa
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
}

public final class org/hyacinthbots/docgenerator/extensions/CommandList : com/kotlindiscord/kord/extensions/extensions/Extension {
public final class org/hyacinthbots/docgenerator/extensions/CommandList : dev/kordex/core/extensions/Extension {
public fun <init> (Ljava/lang/String;Ljava/util/List;)V
public fun getName ()Ljava/lang/String;
public fun setup (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
Expand Down
14 changes: 11 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

object Meta {
const val PROJECT_VERSION = "0.2.0"
const val PROJECT_VERSION = "0.2.1"
const val DESCRIPTION = "Generate documentation for KordEx bots!"
const val GITHUB_REPO = "HyacinthBots/doc-generator"
const val RELEASE = "https://s01.oss.sonatype.org/content/repositories/releases/"
Expand Down Expand Up @@ -42,7 +42,8 @@ plugins {

group = "org.hyacinthbots"
version = Meta.PROJECT_VERSION
val javaVersion = 21

val javaVersion = 13 // KordEx minimum pinned Java version

repositories {
mavenCentral()
Expand All @@ -56,6 +57,11 @@ repositories {
name = "Sonatype Snapshots"
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
}

maven {
name = "Kord Extensions (Snapshots)"
url = uri("https://snapshots-repo.kordex.dev")
}
}

dependencies {
Expand All @@ -80,7 +86,6 @@ gitHooks {

kotlin {
explicitApi()
jvmToolchain(javaVersion)
}

java {
Expand All @@ -106,6 +111,9 @@ tasks {
options.encoding = "UTF-8"
options.isDeprecation = true
options.release.set(javaVersion)

sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
}

wrapper {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
kotlin = "2.0.20-Beta1"
kordex = "1.9.0-20240701.141421-2"
kordex = "2.0.0-20240818.103627-5"
git-hooks = "0.0.2"
licenser = "0.6.1"
bin-compat = "0.15.0-Beta.3"
Expand All @@ -13,7 +13,7 @@ junit5 = "5.10.3"
[libraries]
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8" }
detekt = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }
kordex = { module = "com.kotlindiscord.kord.extensions:kord-extensions", version.ref = "kordex" }
kordex = { module = "dev.kordex:kord-extensions", version.ref = "kordex" }
logging = { module = "io.github.oshai:kotlin-logging", version.ref = "logging" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit5" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ 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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/org/hyacinthbots/docgenerator/_Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

package org.hyacinthbots.docgenerator

import com.kotlindiscord.kord.extensions.commands.Argument
import com.kotlindiscord.kord.extensions.commands.application.slash.SlashCommand
import com.kotlindiscord.kord.extensions.i18n.SupportedLocales
import com.kotlindiscord.kord.extensions.i18n.TranslationsProvider
import com.kotlindiscord.kord.extensions.utils.translate
import dev.kord.common.entity.Permission
import dev.kord.common.entity.Permissions
import dev.kordex.core.commands.Argument
import dev.kordex.core.commands.application.slash.SlashCommand
import dev.kordex.core.i18n.SupportedLocales
import dev.kordex.core.i18n.TranslationsProvider
import dev.kordex.core.utils.translate
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.hyacinthbots.docgenerator.generator.ConverterFormatter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

package org.hyacinthbots.docgenerator

import com.kotlindiscord.kord.extensions.commands.application.ApplicationCommand
import dev.kordex.core.commands.application.ApplicationCommand
import org.hyacinthbots.docgenerator.annotations.DocAdditionBuilderDSL
import org.hyacinthbots.docgenerator.builder.DocAdditionBuilder

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

package org.hyacinthbots.docgenerator

import com.kotlindiscord.kord.extensions.builders.ExtensibleBotBuilder
import dev.kordex.core.builders.ExtensibleBotBuilder
import io.github.oshai.kotlinlogging.KotlinLogging
import org.hyacinthbots.docgenerator.annotations.ConfigurationBuilderDSL
import org.hyacinthbots.docgenerator.builder.ConfigurationBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

package org.hyacinthbots.docgenerator.extensions

import com.kotlindiscord.kord.extensions.commands.application.ApplicationCommand
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
import com.kotlindiscord.kord.extensions.i18n.TranslationsProvider
import com.kotlindiscord.kord.extensions.pagination.PublicResponsePaginator
import com.kotlindiscord.kord.extensions.pagination.pages.Page
import com.kotlindiscord.kord.extensions.pagination.pages.Pages
import dev.kord.common.entity.Permission
import dev.kord.rest.builder.message.EmbedBuilder
import dev.kordex.core.commands.application.ApplicationCommand
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.publicSlashCommand
import dev.kordex.core.i18n.TranslationsProvider
import dev.kordex.core.pagination.PublicResponsePaginator
import dev.kordex.core.pagination.pages.Page
import dev.kordex.core.pagination.pages.Pages
import org.hyacinthbots.docgenerator.addArguments
import org.hyacinthbots.docgenerator.additionalDocumentation
import org.hyacinthbots.docgenerator.builder.DocAdditionBuilder
Expand Down Expand Up @@ -57,7 +57,7 @@ public class CommandList(private val botName: String?, private val enabledComman
val provider = slashCommand.translationsProvider
val bundle = slashCommand.extension.bundle
arguments = addArguments(slashCommand, provider, bundle, null)
if (arguments?.isEmpty() == true) arguments = null
if (arguments.isEmpty() == true) arguments = null
var extraDocs = slashCommand.additionalDocumentation[slashCommand.name]
pagesObj.addPage(
Page {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@

package org.hyacinthbots.docgenerator.generator

import com.kotlindiscord.kord.extensions.i18n.ResourceBundleTranslations
import com.kotlindiscord.kord.extensions.i18n.SupportedLocales
import com.kotlindiscord.kord.extensions.i18n.TranslationsProvider
import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent
import dev.kordex.core.i18n.ResourceBundleTranslations
import dev.kordex.core.i18n.SupportedLocales
import dev.kordex.core.i18n.TranslationsProvider
import dev.kordex.core.koin.KordExKoinComponent
import org.hyacinthbots.docgenerator.DEFAULT_BUNDLE_NAME
import org.hyacinthbots.docgenerator.exceptions.InvalidConverterException
import org.hyacinthbots.docgenerator.translate
import java.util.Locale

/** The file path to converters. */
private const val STANDARD_PREFIX: String = "com.kotlindiscord.kord.extensions.commands.converters"
private const val STANDARD_PREFIX: String = "dev.kordex.core.commands.converters"

/** The file path to converters specifically for slash commands. */
private const val APPLICATION_PREFIX: String = "com.kotlindiscord.kord.extensions.commands.application.slash.converters"
private const val APPLICATION_PREFIX: String = "dev.kordex.core.commands.application.slash.converters"

/**
* A class to facilitate the formatting of a converter from an unreadable file path to a readable, translatable string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

package org.hyacinthbots.docgenerator.generator

import com.kotlindiscord.kord.extensions.commands.application.message.MessageCommand
import com.kotlindiscord.kord.extensions.commands.application.slash.SlashCommand
import com.kotlindiscord.kord.extensions.commands.application.user.UserCommand
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.i18n.ResourceBundleTranslations
import com.kotlindiscord.kord.extensions.i18n.SupportedLocales
import dev.kordex.core.commands.application.message.MessageCommand
import dev.kordex.core.commands.application.slash.SlashCommand
import dev.kordex.core.commands.application.user.UserCommand
import dev.kordex.core.extensions.Extension
import dev.kordex.core.i18n.ResourceBundleTranslations
import dev.kordex.core.i18n.SupportedLocales
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
Expand Down
10 changes: 5 additions & 5 deletions src/test/kotlin/ConverterTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* please see the LICENSE file or https://mit-license.org/
*/

import com.kotlindiscord.kord.extensions.ExtensibleBot
import dev.kordex.core.ExtensibleBot
import kotlinx.coroutines.runBlocking
import org.hyacinthbots.docgenerator.exceptions.InvalidConverterException
import org.hyacinthbots.docgenerator.generator.ConverterFormatter
Expand Down Expand Up @@ -37,24 +37,24 @@ class ConverterTest {
var converter3: String? = null
assertThrows<InvalidConverterException> {
ConverterFormatter(
"com.kotlindiscord.kord.extensions.commands.converters.impl.NotRealConverter",
"dev.kordex.core.commands.converters.impl.NotRealConverter",
"fake"
).formatConverter()
}

assertDoesNotThrow {
converter1 = ConverterFormatter(
"com.kotlindiscord.kord.extensions.commands.converters.impl.ChannelConverter",
"dev.kordex.core.commands.converters.impl.ChannelConverter",
"channel"
).formatConverter()

converter2 = ConverterFormatter(
"com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.StringChoiceConverter",
"dev.kordex.core.commands.application.slash.converters.impl.StringChoiceConverter",
""
).formatConverter()

converter3 = ConverterFormatter(
"com.kotlindiscord.kord.extensions.commands.converters.SingleToDefaultingConverter",
"dev.kordex.core.commands.converters.SingleToDefaultingConverter",
"channel"
).formatConverter()
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/UtilsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
* please see the LICENSE file or https://mit-license.org/
*/

import com.kotlindiscord.kord.extensions.i18n.ResourceBundleTranslations
import com.kotlindiscord.kord.extensions.i18n.SupportedLocales
import dev.kord.common.entity.Permission
import dev.kord.common.entity.Permissions
import dev.kordex.core.i18n.ResourceBundleTranslations
import dev.kordex.core.i18n.SupportedLocales
import kotlinx.coroutines.runBlocking
import org.hyacinthbots.docgenerator.enums.CommandTypes
import org.hyacinthbots.docgenerator.findOrCreateDocumentsFile
Expand Down

0 comments on commit 02fa472

Please sign in to comment.