pkl icon indicating copy to clipboard operation
pkl copied to clipboard

Add support to generate Kotlin file

Open bmarty opened this issue 10 months ago • 1 comments

Gradle scripts can now be written in Kotlin, and even if it's possible to generate properties file that gradle can read, it would be nice if pkl was able to generate Kotlin files.

Possible solution:

Create a KotlinRenderer class, which will implements ValueRenderer and add kotlin in the list of supporte format for the eval command.

We would probably need an option to provide the package name, so that the generated file can be moved to to it's target directory and be compile out out the box.

I would be happy if command like:

pkl eval -f kotlin --package-name a.package.name [a pkl file]

generates a Kotlin file with the package a.package.name.

Thanks!

bmarty avatar Feb 20 '25 10:02 bmarty

Similar to https://github.com/apple/pkl/discussions/972, such a renderer could be implemented in-language and published as a package.

HT154 avatar Feb 20 '25 16:02 HT154