Skip to content

Commit

Permalink
1.5.6: Updated translation class generator, better warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gdude2002 committed Nov 4, 2024
1 parent 0b7335d commit d16f92a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 8 deletions.
10 changes: 10 additions & 0 deletions changes/1.5.6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Gradle Plugins 1.5.6

This version includes a change to the KordEx plugin, specifically the translation class generator.

## KordEx Plugin

- Update the translation class generator. **This is a breaking change!**
- The translation class generator now removes common delimiters in names and generates a camel-case name based on the result.
- You can disable this behaviour using the `camelCaseNames` option in the `i18n` builder until you decide to migrate your code. However, **this option will be removed in a future version,** so update your code as soon as possible!
- Reformat warnings, so they show up in the side panel in IDEA and other JetBrains IDEs.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ kotlin.incremental=true
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1024m
org.gradle.parallel=true

projectVersion=1.5.5
projectVersion=1.5.6
2 changes: 1 addition & 1 deletion kordex/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dependencies {
implementation("com.jcabi:jcabi-manifests:2.1.0")
implementation("com.squareup:kotlinpoet:1.18.1")
implementation("com.github.zafarkhaja:java-semver:0.10.2")
implementation("dev.kordex.i18n:i18n-generator:1.0.3")
implementation("dev.kordex.i18n:i18n-generator:1.0.5")
implementation("io.github.pdvrieze.xmlutil:core-jvm:0.86.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.6.3")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fun List<String>.normalizeModules(kordExVersion: Version, log: Boolean = true):
if (it in v1to2) {
if (log) {
logger.warn(
"WARNING | Module '$it' was specified, but the v2 version is called '${v1to2[it]}'. " +
"WARNING: Module '$it' was specified, but the v2 version is called '${v1to2[it]}'. " +
"This will become an error in later versions of the KordEx plugin."
)
}
Expand All @@ -53,7 +53,7 @@ fun List<String>.normalizeModules(kordExVersion: Version, log: Boolean = true):
if (it in v2tov1) {
if (log) {
logger.warn(
"WARNING | Module '$it' was specified, but the v1 version is called '${v2tov1[it]}'. " +
"WARNING: Module '$it' was specified, but the v1 version is called '${v2tov1[it]}'. " +
"This will become an error in later versions of the KordEx plugin."
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fun Project.checkTask(
val kotlinPlugin = pluginManager.findPlugin("org.jetbrains.kotlin.jvm")

if (kotlinPlugin == null) {
logger.warn("WARNING | Unable to find the Kotlin JVM plugin. Is it applied?")
logger.warn("WARNING: Unable to find the Kotlin JVM plugin. Is it applied?")
return@doLast
}

Expand All @@ -66,7 +66,7 @@ fun Project.checkTask(

if (kotlinJarName == null) {
logger.warn(
"WARNING | Kotlin JVM plugin applied, but the JAR couldn't be found. " +
"WARNING: Kotlin JVM plugin applied, but the JAR couldn't be found. " +
"Found ${classpathJars.size} JARs:"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ object I18nHelper {
)
)

@Suppress("DEPRECATION")
val translationsClass = TranslationsClass(
bundle = bundle.joinToString("."),
allProps = props,
className = extension.className.get(),
classPackage = extension.classPackage.get(),
publicVisibility = extension.publicVisibility.get()
publicVisibility = extension.publicVisibility.get(),
splitToCamelCase = extension.camelCaseNames.get(),
)

translationsClass.writeTo(outputDirectory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ class KordExI18nSettings(props: PropertyFactory) {
val outputDirectory: Property<File> = props.single()

val publicVisibility: Property<Boolean> = props.boolean(true)

@Deprecated(
"This option is provided for compatibility with old, un-migrated code, and will be removed in a later version."
)
val camelCaseNames: Property<Boolean> = props.boolean(true)
}
1 change: 1 addition & 0 deletions testModule/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ kordEx {
classPackage = "template.i18n"
translationBundle = "template.strings"
publicVisibility = false
camelCaseNames = false
}
}

Expand Down
2 changes: 1 addition & 1 deletion testModule/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginManagement {
plugins {
val pluginVersion = "1.5.5"
val pluginVersion = "1.5.6"

kotlin("jvm") version "2.0.21"

Expand Down

0 comments on commit d16f92a

Please sign in to comment.