diff --git a/changes/1.5.6.md b/changes/1.5.6.md new file mode 100644 index 0000000..8233f93 --- /dev/null +++ b/changes/1.5.6.md @@ -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. diff --git a/gradle.properties b/gradle.properties index 5576ffa..d0c0b85 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/kordex/build.gradle.kts b/kordex/build.gradle.kts index 781dbe5..c0834f4 100644 --- a/kordex/build.gradle.kts +++ b/kordex/build.gradle.kts @@ -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") diff --git a/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/base/_Modules.kt b/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/base/_Modules.kt index deb40c9..f772c5a 100644 --- a/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/base/_Modules.kt +++ b/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/base/_Modules.kt @@ -38,7 +38,7 @@ fun List.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." ) } @@ -53,7 +53,7 @@ fun List.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." ) } diff --git a/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/functions/_CheckTask.kt b/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/functions/_CheckTask.kt index c448502..bd7269a 100644 --- a/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/functions/_CheckTask.kt +++ b/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/functions/_CheckTask.kt @@ -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 } @@ -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:" ) diff --git a/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/helpers/I18nHelper.kt b/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/helpers/I18nHelper.kt index d07bb96..3c5c1b3 100644 --- a/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/helpers/I18nHelper.kt +++ b/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/helpers/I18nHelper.kt @@ -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) diff --git a/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/i18n/KordExI18nSettings.kt b/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/i18n/KordExI18nSettings.kt index bc49f62..7cd3d46 100644 --- a/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/i18n/KordExI18nSettings.kt +++ b/kordex/src/main/kotlin/dev/kordex/gradle/plugins/kordex/i18n/KordExI18nSettings.kt @@ -24,4 +24,9 @@ class KordExI18nSettings(props: PropertyFactory) { val outputDirectory: Property = props.single() val publicVisibility: Property = 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 = props.boolean(true) } diff --git a/testModule/build.gradle.kts b/testModule/build.gradle.kts index 8b0c957..96a9f3d 100644 --- a/testModule/build.gradle.kts +++ b/testModule/build.gradle.kts @@ -32,6 +32,7 @@ kordEx { classPackage = "template.i18n" translationBundle = "template.strings" publicVisibility = false + camelCaseNames = false } } diff --git a/testModule/settings.gradle.kts b/testModule/settings.gradle.kts index a658f0d..43760d2 100644 --- a/testModule/settings.gradle.kts +++ b/testModule/settings.gradle.kts @@ -1,6 +1,6 @@ pluginManagement { plugins { - val pluginVersion = "1.5.5" + val pluginVersion = "1.5.6" kotlin("jvm") version "2.0.21"