Skip to content

Commit

Permalink
Reformat project in line with editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
gdude2002 committed Feb 28, 2024
1 parent fcdde4e commit 9305c2a
Show file tree
Hide file tree
Showing 438 changed files with 21,550 additions and 21,615 deletions.
2 changes: 1 addition & 1 deletion .github/disable-parallel.main.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import java.io.File
import java.util.Properties
import java.util.*

val properties = Properties()
val file = File("gradle.properties")
Expand Down
4 changes: 2 additions & 2 deletions .github/get-version.main.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import java.io.File
import java.util.Properties
import java.util.*

val properties = Properties()

properties.load(
File("gradle.properties").inputStream()
File("gradle.properties").inputStream()
)

print(properties["projectVersion"])
70 changes: 35 additions & 35 deletions .github/release.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ var githubTag: String = System.getenv("GITHUB_REF")
val repo: String = System.getenv("GITHUB_REPOSITORY")

if (githubTag.contains("/")) {
githubTag = githubTag.split("/").last()
githubTag = githubTag.split("/").last()
}

println("Current tag: $githubTag")

val apiUrl = "https://api.github.com/repos/$repo/releases/tags/$githubTag"

if (githubTag.contains("v")) {
githubTag = githubTag.split("v", limit = 2).last()
githubTag = githubTag.split("v", limit = 2).last()
}

val response = httpGet { url(apiUrl) }
val responseCode = response.code()

if (responseCode >= 400) {
println("API error: HTTP $responseCode")
println(response.body()?.string())
println("API error: HTTP $responseCode")
println(response.body()?.string())

exitProcess(1)
exitProcess(1)
}

val data = gson.create().fromJson<Map<String, *>>(response.body()!!.string(), Map::class.java)
Expand All @@ -50,56 +50,56 @@ val releaseTime = data["published_at"] as String
val releaseUrl = data["html_url"] as String

if (releaseBody.startsWith("#")) {
val lines = releaseBody.split("\n").toMutableList()
val lines = releaseBody.split("\n").toMutableList()

lines[0] = lines[0].replaceFirst("#", "**") + "**"
releaseBody = lines.joinToString("\n")
lines[0] = lines[0].replaceFirst("#", "**") + "**"
releaseBody = lines.joinToString("\n")
}

if (releaseBody.contains("---")) {
releaseBody = releaseBody.split("---", limit = 2).first()
releaseBody = releaseBody.split("---", limit = 2).first()
}

val webhook = mapOf(
"embeds" to listOf(
mapOf(
"color" to 7506394,
"description" to releaseBody,
"timestamp" to releaseTime.replace("Z", ".000Z"),
"title" to releaseName,
"url" to releaseUrl,

"author" to mapOf(
"icon_url" to authorAvatar,
"name" to authorName,
"url" to authorUrl,
)
)
)
"embeds" to listOf(
mapOf(
"color" to 7506394,
"description" to releaseBody,
"timestamp" to releaseTime.replace("Z", ".000Z"),
"title" to releaseName,
"url" to releaseUrl,

"author" to mapOf(
"icon_url" to authorAvatar,
"name" to authorName,
"url" to authorUrl,
)
)
)
)

val jsonBody = gson.create().toJson(webhook)

val webhookResponse = httpPost {
url(webhookUrl)
url(webhookUrl)

header {
"User-Agent" to "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) " +
"Chrome/35.0.1916.47 Safari/537.36"
}
header {
"User-Agent" to "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) " +
"Chrome/35.0.1916.47 Safari/537.36"
}

body {
json(jsonBody)
}
body {
json(jsonBody)
}
}

val webhookCode = webhookResponse.code()

if (webhookCode >= 400) {
println("Webhook error: HTTP $webhookCode")
println(webhookResponse.body()?.string())
println("Webhook error: HTTP $webhookCode")
println(webhookResponse.body()?.string())

exitProcess(1)
exitProcess(1)
}

exitProcess(0)
50 changes: 25 additions & 25 deletions .github/tag.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,66 @@ val repo = System.getenv("GITHUB_REPOSITORY")
var githubTag: String = System.getenv("GITHUB_REF") ?: error("No tag found in GITHUB_REF env var")

if (githubTag.contains("/")) {
githubTag = githubTag.split("/").last()
githubTag = githubTag.split("/").last()
}

println("Current tag: $githubTag")

if (githubTag.contains("v")) {
githubTag = githubTag.split("v", limit = 2).last()
githubTag = githubTag.split("v", limit = 2).last()
}

val tags = shellRun("git", listOf("tag")).trim().split("\n")

val commits = if (tags.size < 2) {
println("No previous tags, using all branch commits.")
println("No previous tags, using all branch commits.")

shellRun("git", listOf("log", "--format=oneline", "--no-color"))
shellRun("git", listOf("log", "--format=oneline", "--no-color"))
} else {
val previousTag = tags.takeLast(2).first()
val previousTag = tags.takeLast(2).first()

println("Previous tag: $previousTag")
println("Previous tag: $previousTag")

shellRun("git", listOf("log", "--format=oneline", "--no-color", "$previousTag..HEAD"))
shellRun("git", listOf("log", "--format=oneline", "--no-color", "$previousTag..HEAD"))
}.split("\n").map {
val split = it.split(" ", limit = 2)
val commit = split.first()
val message = split.last()
val split = it.split(" ", limit = 2)
val commit = split.first()
val message = split.last()

Pair(commit, message)
Pair(commit, message)
}

println("Commits: ${commits.size}")

val commitList = if (commits.size > 10) {
commits.take(10).joinToString("\n") {
val (commit, message) = it
commits.take(10).joinToString("\n") {
val (commit, message) = it

"* [${commit.take(6)}](https://github.com/$repo/commit/$commit): $message"
} + "\n\n...and ${commits.size - 10} more."
"* [${commit.take(6)}](https://github.com/$repo/commit/$commit): $message"
} + "\n\n...and ${commits.size - 10} more."
} else {
commits.joinToString("\n") {
val (commit, message) = it
commits.joinToString("\n") {
val (commit, message) = it

"* [${commit.take(6)}](https://github.com/$repo/commit/$commit): $message"
}
"* [${commit.take(6)}](https://github.com/$repo/commit/$commit): $message"
}
}

val descFile = File("changes/$githubTag.md")

val description = if (descFile.exists()) {
descFile.readText(Charsets.UTF_8).trim()
descFile.readText(Charsets.UTF_8).trim()
} else {
"Description file `changes/$githubTag.md` not found - this release will need to be updated later!"
"Description file `changes/$githubTag.md` not found - this release will need to be updated later!"
}

val file = File("release.md")

file.writeText(
"$description\n\n" +
"---\n\n" +
"# Commits (${commits.size}) \n\n" +
commitList
"$description\n\n" +
"---\n\n" +
"# Commits (${commits.size}) \n\n" +
commitList
)

print("File written: release.md")
Expand Down
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [

]
}
26 changes: 13 additions & 13 deletions annotation-processor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
plugins {
`kordex-module`
`published-module`
`kordex-module`
`published-module`
}

metadata {
name = "KordEx: Annotation Processor"
description = "KSP-based annotation processor designed for KordEx converters and plugins"
name = "KordEx: Annotation Processor"
description = "KSP-based annotation processor designed for KordEx converters and plugins"
}

dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.kotlin.stdlib)

implementation(libs.koin.core)
implementation(libs.ksp)
implementation(libs.koin.core)
implementation(libs.ksp)

implementation(project(":annotations"))
implementation(project(":annotations"))

detektPlugins(libs.detekt)
detektPlugins(libs.detekt.libraries)
detektPlugins(libs.detekt)
detektPlugins(libs.detekt.libraries)
}

dokkaModule {
moduleName.set("Kord Extensions: Annotation Processor")
moduleName.set("Kord Extensions: Annotation Processor")
}

java {
sourceCompatibility = JavaVersion.VERSION_13
targetCompatibility = JavaVersion.VERSION_13
sourceCompatibility = JavaVersion.VERSION_13
targetCompatibility = JavaVersion.VERSION_13
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ import org.koin.dsl.module
* Processor provider for the converter annotation processor.
*/
public class ConverterProcessorProvider : SymbolProcessorProvider {
override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor {
startKoin {
modules()
}
override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor {
startKoin {
modules()
}

loadKoinModules(module { single { environment.logger } bind KSPLogger::class })
loadKoinModules(module { single { environment.logger } bind KSPLogger::class })

return ConverterProcessor(
environment.codeGenerator, environment.logger
)
}
return ConverterProcessor(
environment.codeGenerator, environment.logger
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import com.kotlindiscord.kord.extensions.modules.annotations.plugins.PluginProce
* Processor provider for the converter annotation processor.
*/
public class PluginProcessorProvider : SymbolProcessorProvider {
override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor {
return PluginProcessor(
environment.codeGenerator, environment.logger
)
}
override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor {
return PluginProcessor(
environment.codeGenerator, environment.logger
)
}
}
Loading

0 comments on commit 9305c2a

Please sign in to comment.