KopyKat Gradle plugin#40
Conversation
# Conflicts: # jitpack.yml
# Conflicts: # buildSrc/build.gradle.kts # gradle/libs.versions.toml # settings.gradle.kts
| if (kkSettings.applyKspPlugin.getOrElse(false)) { | ||
| target.pluginManager.apply("com.google.devtools.ksp") | ||
| } |
There was a problem hiding this comment.
this doesn't seem to apply KSP automatically - I'm not sure why. I'll investigate.
| target.configurations.matching { it.name == KspGradleSubplugin.KSP_MAIN_CONFIGURATION_NAME }.configureEach { | ||
| defaultDependencies { | ||
| add(target.dependencies.create("com.github.kopykat-kt.kopykat:ksp:1.0-rc1")) | ||
| } | ||
| } |
There was a problem hiding this comment.
defining a dependency like this doesn't seem to work. It might need to be a mandatory dependency. I'll investigate.
| target.extensions.configure<KspExtension> { | ||
| arg("mutableCopy", "${kkSettings.mutableCopy.getOrElse(false)}") | ||
| arg("copyMap", "${kkSettings.copyMap.getOrElse(false)}") | ||
| arg("hierarchyCopy", "${kkSettings.hierarchyCopy.getOrElse(false)}") | ||
| } |
There was a problem hiding this comment.
these don't seem to work. If I set copyMap.set(false) in Gradle, I can still use person.copyMap {}. I'm not sure if this is a Gradle or KSP thing. I'll investigate.
There was a problem hiding this comment.
Note that if kkSettings sets mutableCopy (or any other) to null, then the corresponding argument in KSP should not be set. And in any case, it should be set to true if nothing is provided.
There was a problem hiding this comment.
Good point - I've changed it to only set the KSP arg if the value is not-null.
|
I think we should be careful with this, and ensure that it doesn’t get harder than the current instructions. My experience with this is that a custom plug-in sometimes fail on Android or MPP, for which KSP has special instructions. |
|
Yeah, the plugin instructions would be easier if the KopyKat plugin can be published to Maven Central or the Gradle Plugin Portal. JitPack manually overrides the project's group, which in turn breaks the Gradle plugin marker. If published on Maven Central, the The plugin in this PR shouldn't cause problems with Kotlin Multiplatform, but users might have to manually enable KSP per source set. There's ways to test for this though, either manually with example projects, or with Gradle TestKit. I can include them in this PR, if you'd like? But I think that would make it too large. Can you find the special instructions for Android? I could only find them for Kotlin Multiplatform. |
|
I'm working on publishing to Maven Central (#41), which should make things easier |
- adds some docs for settings - minor code tidy up
… KSP plugin and KopyKat KSP dependency
# Conflicts: # settings.gradle.kts
|
|
||
| gradlePlugin { | ||
| val kopyKatGradlePlugin by plugins.creating { | ||
| id = "at.kopykat" |
Here's an initial attempt. It's still a little rough, but it's ready for a first look.
fixes #29
It requires some setup:
Notes: