Replies: 2 comments 2 replies
-
If your application is already written in Java, it should be very simple to import Pkl as a library into your application. In particular, you might be interested in either the pkl-core, or the pkl-config-java library. When you use Pkl as a library, you can use its extension points by using custom module readers and resource readers. This lets you
I think the most appropriate path here is to publish your Pkl definitions as a package, and this way your users can |
Beta Was this translation helpful? Give feedback.
-
@bioball / @holzensp Pkl is already extremely capable, but we want to provide a typed DSL they can follow; ideally, we want it to be embedded into a binary we re-distribute, so that the user invokes So far, here's what I'm understanding from the Pkl code and from suggestions above (thank you!):
Okay, I think the above summarizes the available approaches. It actually sounds to me like embedded JVM use is pretty close to optimal, so long as there is a way to hook into the
We want to build a build tool which uses Pkl as a DSL. Think Gradle's DSL but without the cumbersome precompile step. The tool is called One thing we'd like to avoid, if possible, is the need for a user to include any boilerplate in a "Dontfile." The What do you guys think? Thank you for the advice here. |
Beta Was this translation helpful? Give feedback.
-
Hey there esteemed Pkl authors,
First of all, I'm a big fan of Apple and anything GraalVM, so this is very cool to see! Thank you for such an awesome project. I wanted to inquire about extending Pkl for custom use cases. Allow me to expand below; this is an idea for new functionality or at least an inquiry about how to do something the right way.
Use case
We are building some experimental dev-facing tools, that build code or lint code, etc. We are looking for a configuration format that allows some dynamic configuration ability, but still maintains speed and serialization to something like JSON. Pkl seems to fit the bill.
We want to provide a suite of "pre-defined" Pkl definitions, so that users can essentially adopt a "Pkl+"-like DSL, which we document and provide to consumers of this library or tool.
Approach
I see Pkl is written in Java, Kotlin, Groovy, etc., and we are very familiar with these languages. I don't know if Pkl's core code is designed for extension, or use as a library (with extension), beyond the documented runtime dependencies needed to load configurations, and so forth.
I also see it is built with Gradle; so are we. So maybe this is as simple as an
includeBuild(...)
statement, a Git submodule, and some dependencies.Is there a supported approach to this already? If not, would the Pkl team be open to discussing such an idea?
Thank you for your hard work on this project and for consideration of this request 😄.
Beta Was this translation helpful? Give feedback.
All reactions