Skip to content

Commit

Permalink
Merge branch 'develop' into root
Browse files Browse the repository at this point in the history
# Conflicts:
#	kord-extensions/src/main/resources/translations/kordex/strings.properties
  • Loading branch information
gdude2002 committed Oct 12, 2021
2 parents ff5eab0 + 8cf7b57 commit c4a5a8c
Show file tree
Hide file tree
Showing 286 changed files with 13,863 additions and 6,638 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ jobs:
echo "org.gradle.jvmargs=-XX:MaxMetaspaceSize=5G" >> ~/.gradle/gradle.properties
- name: Gradle (Build)
run: sh gradlew build
uses: gradle/gradle-build-action@v2
with:
arguments: build

- name: Upload artifact (Extra Module JARs)
uses: actions/upload-artifact@v2

with:
name: JARs (Extra Modules)
path: extra/*/build/libs/*.jar
path: extra-modules/*/build/libs/*.jar

- name: Upload artifact (Main JARs)
uses: actions/upload-artifact@v2
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,30 @@ jobs:
with:
java-version: 1.14

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v3

with:
gpg-private-key: ${{ secrets.GPG_KEY }}
passphrase: ${{ secrets.GPG_PASSWORD }}

- name: Set up Gradle properties
run: |
mkdir -p ~/.gradle
echo "githubToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.gradle/gradle.properties
echo -e "\norg.gradle.jvmargs=-XX:MaxMetaspaceSize=5G" >> ~/.gradle/gradle.properties
echo -e "\nsigning.gnupg.keyName=BFAAD5D6093EF5E62BC9A16A10DB8C6B4AE61C2F" >> ~/.gradle/gradle.properties
echo -e "\nsigning.gnupg.passphrase=${{ secrets.GPG_PASSWORD }}" >> ~/.gradle/gradle.properties
- name: Gradle (Build)
run: sh gradlew build
uses: gradle/gradle-build-action@v2
with:
arguments: build

- name: Gradle (Publish)
run: sh gradlew -Pkotdis.user=${{ secrets.MAVEN_USER }} -Pkotdis.password=${{ secrets.MAVEN_PASSWORD }} publish
uses: gradle/gradle-build-action@v2
with:
arguments: publish -Pkotdis.user=${{ secrets.MAVEN_USER }} -Pkotdis.password=${{ secrets.MAVEN_PASSWORD }}

- name: Upload artifact (Extra Module JARs)
uses: actions/upload-artifact@v2
Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ jobs:
uses: actions/setup-java@v1

with:
java-version: 1.11
java-version: 1.14

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v3

with:
gpg-private-key: ${{ secrets.GPG_KEY }}
passphrase: ${{ secrets.GPG_PASSWORD }}

- name: Set up Kotlin
uses: fwilhe2/setup-kotlin@main
Expand All @@ -25,6 +32,8 @@ jobs:
run: |
mkdir -p ~/.gradle
echo "org.gradle.jvmargs=-XX:MaxMetaspaceSize=5G" >> ~/.gradle/gradle.properties
echo -e "\nsigning.gnupg.keyName=BFAAD5D6093EF5E62BC9A16A10DB8C6B4AE61C2F" >> ~/.gradle/gradle.properties
echo -e "\nsigning.gnupg.passphrase=${{ secrets.GPG_PASSWORD }}" >> ~/.gradle/gradle.properties
- name: Set up git credentials
uses: oleksiyrudenko/gha-git-credentials@v2-latest
Expand All @@ -34,10 +43,14 @@ jobs:
token: '${{ secrets.GITHUB_TOKEN }}'

- name: Gradle (Build)
run: sh gradlew build
uses: gradle/gradle-build-action@v2
with:
arguments: build

- name: Gradle (Publish)
run: sh gradlew -Pkotdis.user=${{ secrets.MAVEN_USER }} -Pkotdis.password=${{ secrets.MAVEN_PASSWORD }} publish
uses: gradle/gradle-build-action@v2
with:
arguments: publish -Pkotdis.user=${{ secrets.MAVEN_USER }} -Pkotdis.password=${{ secrets.MAVEN_PASSWORD }}

- name: Create release description
run: kotlin .github/tag.main.kts
Expand Down
6 changes: 6 additions & 0 deletions .idea/GradleUpdaterPlugin.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 4 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Kord Extensions

[![Docs: Click here](https://img.shields.io/static/v1?label=Docs&message=Click%20here&color=7289DA&style=for-the-badge&logo=read-the-docs)](https://kordex.kotlindiscord.com/) [![Discord: Click here](https://img.shields.io/static/v1?label=Discord&message=Click%20here&color=7289DA&style=for-the-badge&logo=discord)](https://discord.gg/gjXqqCS) [![Build Status](https://img.shields.io/github/workflow/status/Kotlin-Discord/kord-extensions/CI/root?logo=github&style=for-the-badge)](https://github.com/Kotlin-Discord/kord-extensions/actions?query=workflow%3ACI+branch%3Aroot) <br />
[![Docs: Click here](https://img.shields.io/static/v1?label=Docs&message=Click%20here&color=7289DA&style=for-the-badge&logo=read-the-docs)](https://kordex.kotlindiscord.com/) [![Discord: Click here](https://img.shields.io/static/v1?label=Discord&message=Click%20here&color=7289DA&style=for-the-badge&logo=discord)](https://discord.gg/gjXqqCS) <br />
[![Build Status](https://img.shields.io/github/workflow/status/Kotlin-Discord/kord-extensions/CI/root?logo=github&style=for-the-badge)](https://github.com/Kotlin-Discord/kord-extensions/actions?query=workflow%3ACI+branch%3Aroot) [![Weblate project translated](https://img.shields.io/weblate/progress/kord-extensions?style=for-the-badge)]((https://hosted.weblate.org/engage/kord-extensions/)) <br />
[![Release](https://img.shields.io/nexus/r/com.kotlindiscord.kord.extensions/kord-extensions?nexusVersion=3&logo=gradle&color=blue&label=Release&server=https%3A%2F%2Fmaven.kotlindiscord.com&style=for-the-badge)](https://maven.kotlindiscord.com/#browse/browse:maven-releases:com%2Fkotlindiscord%2Fkord%2Fextensions%2Fkord-extensions) [![Snapshot](https://img.shields.io/nexus/s/com.kotlindiscord.kord.extensions/kord-extensions?logo=gradle&color=orange&label=Snapshot&server=https%3A%2F%2Fmaven.kotlindiscord.com&style=for-the-badge)](https://maven.kotlindiscord.com/#browse/browse:maven-snapshots:com%2Fkotlindiscord%2Fkord%2Fextensions%2Fkord-extensions)

[![Translation status](https://hosted.weblate.org/widgets/kord-extensions/-/main/287x66-grey.png)](https://hosted.weblate.org/engage/kord-extensions/)

Kord Extensions is an addon for the excellent [Kord library](https://github.com/kordlib/kord). It intends to provide a
framework for larger bot projects, with easy-to-use commands, rich argument parsing and event handling, wrapped up
into individual extension classes.
Expand All @@ -14,22 +17,3 @@ for our fairly object-oriented design, especially where it comes to its extensio
Discord.py). Despite this, we still strive to provide an idiomatic API that makes full use of Kotlin's niceties.

If you're ready to get started, please [take a look at the documentation](https://kordex.kotlindiscord.com/).

# Why not kordx.commands?

Kord has released their own command framework, [kordx.commands](https://github.com/kordlib/kordx.commands). It's
a competent library, but it takes some very different approaches to solving the same problems Kord Extensions does.
Most notably, it requires the use of [kapt](https://kotlinlang.org/docs/reference/kapt.html) and makes use of an
annotation-based autowire system for getting things registered.

In contrast, Kord Extensions provides a less magical approach that is more closely tied to object-oriented
programming, and may be more suitable for embedding into other applications. In addition, it provides many useful
utilities and niceties that make working with Kord a breeze. At the end of the day, though, the
choice is yours - both approaches have pros and cons, and it's worth checking both out to see what you like
better!

# Under Development

This file is in an early state, and we're working on bringing over our framework from our bot project. Once we're
happy with what we've done, and we've written up some documentation, we'll update this file and make a proper
release.
132 changes: 6 additions & 126 deletions annotation-processor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import java.io.ByteArrayOutputStream
import java.net.URL

plugins {
`maven-publish`

kotlin("jvm")

id("io.gitlab.arturbosch.detekt")
id("org.jetbrains.dokka")
`kordex-module`
`published-module`
`dokka-module`
}

dependencies {
Expand All @@ -22,124 +16,10 @@ dependencies {
detektPlugins(libs.detekt)
}

val sourceJar = task("sourceJar", Jar::class) {
dependsOn(tasks["classes"])
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}

val javadocJar = task("javadocJar", Jar::class) {
dependsOn("dokkaJavadoc")
archiveClassifier.set("javadoc")
from(tasks.javadoc)
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlin {
explicitApi()
}

detekt {
buildUponDefaultConfig = true
config = files("$rootDir/detekt.yml")

autoCorrect = true
}

publishing {
repositories {
maven {
name = "KotDis"

url = if (project.version.toString().contains("SNAPSHOT")) {
uri("https://maven.kotlindiscord.com/repository/maven-snapshots/")
} else {
uri("https://maven.kotlindiscord.com/repository/maven-releases/")
}

credentials {
username = project.findProperty("kotdis.user") as String? ?: System.getenv("KOTLIN_DISCORD_USER")
password = project.findProperty("kotdis.password") as String?
?: System.getenv("KOTLIN_DISCORD_PASSWORD")
}

version = project.version
}
}

publications {
create<MavenPublication>("maven") {
from(components.getByName("java"))

artifact(sourceJar)
artifact(javadocJar)
}
}
}

fun runCommand(command: String): String {
val output = ByteArrayOutputStream()

project.exec {
commandLine(command.split(" "))
standardOutput = output
}

return output.toString().trim()
}

fun getCurrentGitBranch(): String { // https://gist.github.com/lordcodes/15b2a4aecbeff7c3238a70bfd20f0931
var gitBranch = "Unknown branch"

try {
gitBranch = runCommand("git rev-parse --abbrev-ref HEAD")
} catch (t: Throwable) {
println(t)
}

return gitBranch
}

tasks.dokkaHtml.configure {
dokkaModule {
moduleName.set("Kord Extensions: Annotation Processor")

dokkaSourceSets {
configureEach {
includeNonPublic.set(false)
skipDeprecated.set(false)

displayName.set("Kord Extensions: Java Time")
includes.from("packages.md")
jdkVersion.set(8)

sourceLink {
localDirectory.set(file("${project.projectDir}/src/main/kotlin"))

remoteUrl.set(
URL(
"https://github.com/Kotlin-Discord/kord-extensions/" +
"tree/${getCurrentGitBranch()}/annotation-processor/src/main/kotlin"
)
)

remoteLineSuffix.set("#L")
}

externalDocumentationLink {
url.set(URL("http://kordlib.github.io/kord/common/common/"))
}

externalDocumentationLink {
url.set(URL("http://kordlib.github.io/kord/core/core/"))
}
}
}
}

tasks.build {
this.finalizedBy(sourceJar, javadocJar)
kordex {
jvmTarget.set("1.8")
}
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public class ConverterProcessor(
// Imports that all converters need
import com.kotlindiscord.kord.extensions.commands.converters.*
import com.kotlindiscord.kord.extensions.commands.parser.Arguments
import com.kotlindiscord.kord.extensions.commands.Arguments
import dev.kord.common.annotation.KordPreview
Expand Down
Loading

0 comments on commit c4a5a8c

Please sign in to comment.