yshrsmz / BuildKonfig

BuildConfig for Kotlin Multiplatform Project
Apache License 2.0
783 stars 32 forks source link

Issue/13/migrate to gradle kotlin dsl #14

Closed dbaelz closed 5 years ago

dbaelz commented 5 years ago

Hi,

thanks für this great project. As mentioned in #13 you asked for support of the Kotlin DSL. Therefore, I migrated the Groovy scripts to the Kotlin DSL. Feel free to give me feedback and ask questions when they arise in the review.

Changes

Maven Publish Plugin

I didn't migrate the gradle-mvn-push.gradle to the Kotlin DSL because it uses the outdated Maven Plugin to publish the artifact. This plugin uses Groovy closures instead of Gradle actions, which makes it harder to migrate. I started with it, but stopped for two reasons:

  1. The migration with the withGroovyBuilder helper methods and Strings results in poorly to ready an maintain code.
  2. Also, I encountered some issue with lazy evaluated properties and there usage inside of the GroovyBuilderScope.

Gradle supports mixed Groovy and Kotlin scripts, so the project still works. The best solution to get rid of the Groovy script is, to use the newer Maven Publishing Plugin. This is also recommended in the Maven Plugin documentation. I could tackle that in another PR, when this is ok for you.

Improved Versions Management

The project already uses the Versions Plugin and the usage could be extended to better check for updates. An alternative is the Refresh Versions Plugin, which automatically generates the version files.

yshrsmz commented 5 years ago

Thanks!