This adds logic to build and publish the other executables related to Pkl.
These are:
pkl-doc
pkl-codegen-kotlin
pkl-codegen-java
pkl-codegen-kotlin and pkl-codegen-java are published as executable JARs, whereas pkldoc is published both as an executable JAR, and also native executables (matching the set of os/arch supported by Pkl).
The reason this only publishes executable JARs for pkl-codegen-kotlin and pkl-codegen-java is because we expect that the Java requirement is not a problem for these users, and that the native executable provides negligible added value.
As part of this, the following changes are made:
Introduce pklJavaExecutable plugin, which sets up building and publishing of executable JAR.
Introduce pklNativeExecutable plugin, which sets up building and publishing of native executables.
Introduce NativeImageBuild Gradle task, which knows how to build native-image executables.
Introduce ExecutableSpec extension, for projects that publish executables to configure how those executables should be published.
./griddles buildNative, by default, will only build the executable of the host OS/Arch, and will no longer cross-build.
The target arch of ./gradlew buildNative can be changed using -Dpkl.targetArch=<aarch64|amd64>.
On linux/amd64 only, with ./gradlew buildNative, a statically linked executable can be built using -Dpkl.musl=true
Make javaExecutable a dependency of assemble
Make testStartJavaExecutable a dependency of check
Change name pklNativeBuild to pklNativeLifecycle to better match the plugin's purpose
Remove Truffle SVM classes from main source set (don't publish these classes as part of the pkl-cli JAR)
Change CircleCI definition to publish new executables
Change CircleCI definition to call buildNative instead of individual task names
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/apple/pkl/pull/1023
**Author:** [@bioball](https://github.com/bioball)
**Created:** 3/14/2025
**Status:** ✅ Merged
**Merged:** 3/19/2025
**Merged by:** [@bioball](https://github.com/bioball)
**Base:** `main` ← **Head:** `publish-other-executables`
---
### 📝 Commits (5)
- [`8c9a1b0`](https://github.com/apple/pkl/commit/8c9a1b0d18fde322ddaa755939d051526c3af79b) Publish other executables
- [`943134d`](https://github.com/apple/pkl/commit/943134dd981e1fa37c704473e3b6fc4ebc6681cb) Pass truffle features to all native executables
- [`838e200`](https://github.com/apple/pkl/commit/838e20088593e9747666943f75a0c197ba45ed41) Polish
- [`0d7f44f`](https://github.com/apple/pkl/commit/0d7f44fe6abb7a91e8929c3a606709e03b191776) Re-disable native builds in CI
- [`4051cf0`](https://github.com/apple/pkl/commit/4051cf04b5f71f55193f91fe7af65e35819410d7) Address review feedback
### 📊 Changes
**43 files changed** (+1831 additions, -576 deletions)
<details>
<summary>View changed files</summary>
📝 `.circleci/config.pkl` (+25 -21)
📝 `.circleci/config.yml` (+720 -29)
📝 `.circleci/jobs/BuildNativeJob.pkl` (+14 -8)
📝 `.circleci/jobs/DeployJob.pkl` (+4 -1)
📝 `.circleci/jobs/GradleJob.pkl` (+3 -0)
📝 `DEVELOPMENT.adoc` (+5 -6)
📝 `buildSrc/src/main/kotlin/BuildInfo.kt` (+12 -0)
➕ `buildSrc/src/main/kotlin/ExecutableSpec.kt` (+49 -0)
➕ `buildSrc/src/main/kotlin/NativeImageBuild.kt` (+169 -0)
➕ `buildSrc/src/main/kotlin/pklJavaExecutable.gradle.kts` (+132 -0)
➖ `buildSrc/src/main/kotlin/pklNativeBuild.gradle.kts` (+0 -22)
➕ `buildSrc/src/main/kotlin/pklNativeExecutable.gradle.kts` (+291 -0)
➕ `buildSrc/src/main/kotlin/pklNativeLifecycle.gradle.kts` (+129 -0)
📝 `docs/modules/ROOT/partials/component-attributes.adoc` (+2 -0)
📝 `docs/modules/java-binding/examples/JavaConfigExample.java` (+1 -1)
📝 `docs/modules/java-binding/pages/codegen.adoc` (+43 -7)
📝 `docs/modules/kotlin-binding/examples/KotlinConfigExample.kt` (+1 -1)
📝 `docs/modules/kotlin-binding/pages/codegen.adoc` (+42 -7)
📝 `docs/modules/kotlin-binding/pages/pkl-config-kotlin.adoc` (+1 -1)
📝 `docs/modules/pkl-cli/pages/index.adoc` (+0 -1)
_...and 23 more files_
</details>
### 📄 Description
This adds logic to build and publish the other executables related to Pkl.
These are:
* pkl-doc
* pkl-codegen-kotlin
* pkl-codegen-java
pkl-codegen-kotlin and pkl-codegen-java are published as executable JARs, whereas pkldoc is published both as an executable JAR, and also native executables (matching the set of os/arch supported by Pkl).
The reason this only publishes executable JARs for pkl-codegen-kotlin and pkl-codegen-java is because we expect that the Java requirement is not a problem for these users, and that the native executable provides negligible added value.
As part of this, the following changes are made:
* Introduce `pklJavaExecutable` plugin, which sets up building and publishing of executable JAR.
* Introduce `pklNativeExecutable` plugin, which sets up building and publishing of native executables.
* Introduce `NativeImageBuild` Gradle task, which knows how to build native-image executables.
* Introduce `ExecutableSpec` extension, for projects that publish executables to configure how those executables should be published.
* `./griddles buildNative`, by default, will only build the executable of the host OS/Arch, and will no longer cross-build.
* The target arch of `./gradlew buildNative` can be changed using `-Dpkl.targetArch=<aarch64|amd64>`.
* On linux/amd64 only, with `./gradlew buildNative`, a statically linked executable can be built using `-Dpkl.musl=true`
* Make `javaExecutable` a dependency of `assemble`
* Make `testStartJavaExecutable` a dependency of `check`
* Change name `pklNativeBuild` to `pklNativeLifecycle` to better match the plugin's purpose
* Remove Truffle SVM classes from main source set (don't publish these classes as part of the pkl-cli JAR)
* Change CircleCI definition to publish new executables
* Change CircleCI definition to call `buildNative` instead of individual task names
Closes https://github.com/apple/pkl/issues/991
Closes https://github.com/apple/pkl/issues/992
Closes https://github.com/apple/pkl/issues/285
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/1023
Author: @bioball
Created: 3/14/2025
Status: ✅ Merged
Merged: 3/19/2025
Merged by: @bioball
Base:
main← Head:publish-other-executables📝 Commits (5)
8c9a1b0Publish other executables943134dPass truffle features to all native executables838e200Polish0d7f44fRe-disable native builds in CI4051cf0Address review feedback📊 Changes
43 files changed (+1831 additions, -576 deletions)
View changed files
📝
.circleci/config.pkl(+25 -21)📝
.circleci/config.yml(+720 -29)📝
.circleci/jobs/BuildNativeJob.pkl(+14 -8)📝
.circleci/jobs/DeployJob.pkl(+4 -1)📝
.circleci/jobs/GradleJob.pkl(+3 -0)📝
DEVELOPMENT.adoc(+5 -6)📝
buildSrc/src/main/kotlin/BuildInfo.kt(+12 -0)➕
buildSrc/src/main/kotlin/ExecutableSpec.kt(+49 -0)➕
buildSrc/src/main/kotlin/NativeImageBuild.kt(+169 -0)➕
buildSrc/src/main/kotlin/pklJavaExecutable.gradle.kts(+132 -0)➖
buildSrc/src/main/kotlin/pklNativeBuild.gradle.kts(+0 -22)➕
buildSrc/src/main/kotlin/pklNativeExecutable.gradle.kts(+291 -0)➕
buildSrc/src/main/kotlin/pklNativeLifecycle.gradle.kts(+129 -0)📝
docs/modules/ROOT/partials/component-attributes.adoc(+2 -0)📝
docs/modules/java-binding/examples/JavaConfigExample.java(+1 -1)📝
docs/modules/java-binding/pages/codegen.adoc(+43 -7)📝
docs/modules/kotlin-binding/examples/KotlinConfigExample.kt(+1 -1)📝
docs/modules/kotlin-binding/pages/codegen.adoc(+42 -7)📝
docs/modules/kotlin-binding/pages/pkl-config-kotlin.adoc(+1 -1)📝
docs/modules/pkl-cli/pages/index.adoc(+0 -1)...and 23 more files
📄 Description
This adds logic to build and publish the other executables related to Pkl.
These are:
pkl-codegen-kotlin and pkl-codegen-java are published as executable JARs, whereas pkldoc is published both as an executable JAR, and also native executables (matching the set of os/arch supported by Pkl).
The reason this only publishes executable JARs for pkl-codegen-kotlin and pkl-codegen-java is because we expect that the Java requirement is not a problem for these users, and that the native executable provides negligible added value.
As part of this, the following changes are made:
pklJavaExecutableplugin, which sets up building and publishing of executable JAR.pklNativeExecutableplugin, which sets up building and publishing of native executables.NativeImageBuildGradle task, which knows how to build native-image executables.ExecutableSpecextension, for projects that publish executables to configure how those executables should be published../griddles buildNative, by default, will only build the executable of the host OS/Arch, and will no longer cross-build../gradlew buildNativecan be changed using-Dpkl.targetArch=<aarch64|amd64>../gradlew buildNative, a statically linked executable can be built using-Dpkl.musl=truejavaExecutablea dependency ofassembletestStartJavaExecutablea dependency ofcheckpklNativeBuildtopklNativeLifecycleto better match the plugin's purposebuildNativeinstead of individual task namesCloses https://github.com/apple/pkl/issues/991
Closes https://github.com/apple/pkl/issues/992
Closes https://github.com/apple/pkl/issues/285
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.