yshrsmz / BuildKonfig

BuildConfig for Kotlin Multiplatform Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Kotlin 1.9.20

findusl opened this issue · comments

I have tried to upgrade my Multiplatform project to Kotlin 1.9.20 and it breaks unless I remove the plugin com.codingfeline.buildkonfig.

The error message has nothing to do with the plugin and makes understanding the problem very hard. Basically in Kotlin 1.9.20 when using custom source sets, one needs to explicitly call applyDefaultHierarchyTemplate(), however with the plugin included, you get the error Unresolved reference: applyDefaultHierarchyTemplate. I do not understand how this happens, something seems to go wrong between the multiplatform plugin and the buildkonfig plugin.

My example for verification: https://github.com/findusl/initiative-tracker/blob/upgrade_kotlin_1_9_20/frontendshared/build.gradle.kts

@yshrsmz I'd love to try and contribute. I'm having a hard time finding a place to start, because Kotlin Multiplatform fails and there is no warning message from your plugin. The only prove I have of an issue with the BuildKonfig plugin, is the fact that kotlin multiplatform works without the plugin. Do you have a suggestion where I could start looking? (I have not done Gradle plugins before but I know in principle how they work)

I'm not sure for now.
But #106 is passing so it can be fixed just by updating Kotlin dependency of BuildKonfig.
I think I can look into it this weekend.

OK, I've quickly tested 1.9.20 compatibility with the ./sample project

master...kotlin1.9.20-test

Executed the following commands

$ ./gradlew publishAllPublicationsToTestMavenRepository -PRELEASE_SIGNING_ENABLED=false
$ ./gradlew -p sample build

and sample project seems to compile fine with Kotlin 1.9.20 🤔

Very interesting. It appears the error only happens in a nested gradle structure using a build.gradle.kts. I have minimized your sample-kts so that it builds and shows the error: master...findusl:BuildKonfig:show-failure

  • ./gradlew ":build:sample-kts" fails
  • ./gradlew -p sample-kts build succeeds (assuming you add version "1.9.20" to the multiplatform plugin in the build.gradle.kts file)

Building the plugin with the new Kotlin 1.9.20 version and using this version fixes the problem. Looking back, you probably already had this effect with your publishAllPublicationsToTestMavenRepository command. That one did not work for me until I had removed the signing plugin.

Long story short, once #106 is merged, this can be closed.

Thank you for looking into it!

I encountered the same issue when I tried to upgrade a project to Kotlin 1.9.20 and was very happy to see that there's already a solution available.
What is blocking this PR from being merged? Anything I could help with?

Hi, just released v0.15.0

https://github.com/yshrsmz/BuildKonfig/releases/tag/v0.15.0

Please try it out and let me know if you find any issue(as a new issue)