-
(mandatory) Install a JDK (JDK 21+ required).
-
(recommended) Install IntelliJ IDEA
To import the project into IntelliJ, go to File→Open and select the project’s root directory. If the project is opened but not imported, look for a popup in the lower right corner and click its "Import Gradle Project" link. -
(recommended) Install gng
gng enables you to run Gradle commands withgw(instead of./gradlew) from any subdirectory. -
(recommended) Set up Git ignore-revs
git config blame.ignoreRevsFile .git-blame-ignore-revs -
(recommended) Install jenv and plugins
jenv uses specific JDK versions in certain subdirectories. Pkl comes with a.java-versionfile specifying JDK 21.
Enable jenv plugins for better handling bygradle:jenv enable-plugin gradle jenv enable-plugin export -
(optional) If you’ve named the original apple/pkl git repository something other than
origin, set env varPKL_ORIGINAL_REMOTE_NAMEto that name in your.bashrc,.zshrc,config.fishor however you manage your local environment.This will allow spotless to pick the correct starting branch when formatting source code files. Otherwise, you might see that every file has its copyright year updated.
-
(optional) To build the native executable (
./gradlew buildNative), install Prerequisites For Native Image on Linux.
-
(optional) Go to
System→For developersand enableDeveloper Mode. Otherwise, some tests may fail due to insufficient file system privileges. -
(optional) To build the native executable (
./gradlew buildNative), install Prerequisites For Native Image on Windows.
gw clean
gw test # run all tests except native executable tests
gw spotlessApply # fix code formatting
gw build # build everything except native executables
gw pkl-cli:testNative # run native executable tests
gw pkl-cli:buildNative # build native executable for current platform
pkl-cli/build/executable/jpkl # run Java executable
pkl-cli/build/executable/pkl-macos-aarch64 # run Mac executable
pkl-cli/build/executable/pkl-macos-amd64 # run Intel Mac executable
pkl-cli/build/executable/pkl-linux-amd64 # run Linux executable
pkl-cli/build/executable/pkl-alpine-linux-amd64 # run Alpine Linux executable
pkl-cli/build/executable/pkl-windows-amd64.exe # run Windows executable-
Go to https://gradle.org/release-checksums/ and copy the checksum for the new Gradle version
-
Run the following command twice (until it prints UP-TO-DATE):
gw wrapper --gradle-version [version] --gradle-distribution-sha256-sum [sha]
-
Commit the updated wrapper files
-
(optional) Update gradle/libs.version.toml based on version information from https://search.maven.org, https://plugins.gradle.org, and GitHub repos
-
Validate changes with
gw build buildNative
-
Truffle code generation is performed by Truffle’s annotation processor, which runs as part of task
:pkl-core:compileJava-
Output dir is
generated/truffle/
-
To enable remote JVM debugging when running Gradle tasks (e.g. test), add the flag -Djvmdebug=true.
This will listen on port 5005.
Example: ./gradlew test -Djvmdebug=true
There is an IntelliJ plugin meant for development on the Pkl project itself located in pkl-project-commons.
See its readme for instructions on how to set it up.
For automated build setup examples see our GitHub Actions jobs like our BuildNativeJob.pkl, where we build Pkl automatically.