Add support to generate Kotlin file
- Dominant language
- Java
- Stars
- 11.5k
- Forks
- 402
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 20
Description
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!
Contributor guide
Research direction
Start by tracing the eval command's supported output formats and the ValueRenderer interface; the issue names a KotlinRenderer but no files or tests. Check how format-specific options are parsed, then verify that the Kotlin output accepts the requested package name and can be compiled from the generated file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100