Add support to generate Kotlin file #282

Open
opened 2025-12-30 01:23:10 +01:00 by adam · 1 comment
Owner

Originally created by @bmarty on GitHub (Feb 20, 2025).

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!

Originally created by @bmarty on GitHub (Feb 20, 2025). 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: ```sh pkl eval -f kotlin --package-name a.package.name [a pkl file] ``` generates a Kotlin file with the package `a.package.name`. Thanks!
Author
Owner

@HT154 commented on GitHub (Feb 20, 2025):

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

@HT154 commented on GitHub (Feb 20, 2025): Similar to https://github.com/apple/pkl/discussions/972, such a renderer could be implemented in-language and published as a package.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#282