tschuchortdev / kotlin-compile-testing

A library for testing Kotlin and Java annotation processors, compiler plugins and code generation
Mozilla Public License 2.0
658 stars 63 forks source link

Support K2 compiler + make kotlin-stdlib a compileOnly dep #306

Closed ZacSweers closed 1 year ago

ZacSweers commented 2 years ago

This allows easily compiling against newer APIs (as needed) and makes the MainComponentRegistrar support K2.

I do think that this library should instead choose to adopt a versioning model like KSP or anvil, where versioning is tied to the Kotlin version it's built against. This way you could release something like 1.4.9-1.7.20-Beta to make it explicit what is supported, as backward compatibility doesn't provide much value since this uses unstable APIs anyway

ZacSweers commented 2 years ago

I think that works but you have to use - instead of + iirc.

For snapshots, you should always append -SNAPSHOT to the end IMO.

All that said, I really think if you're willing to go that route, you should revert a4dbab1 and just ship normal dependencies rather than the compileOnly work I did here. These new versions won't be backward compatible, but such is the nature of building against new and unstable APIs. This pattern has worked fine for anvil, KSP, and all the other plugins we've used