mirror of
https://github.com/apple/pkl.git
synced 2026-05-11 09:29:49 +02:00
Publish executables for pkldoc, pkl-codegen-java, pkl-codegen-kotlin (#1023)
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 commit is contained in:
@@ -81,25 +81,30 @@ triggerPackageDocsBuild = "release"
|
||||
|
||||
local buildNativeJobs: Mapping<String, BuildNativeJob> = new {
|
||||
for (_dist in List("release", "snapshot")) {
|
||||
for (_arch in List("amd64", "aarch64")) {
|
||||
for (_os in List("macOS", "linux")) {
|
||||
["pkl-cli-\(_os)-\(_arch)-\(_dist)"] {
|
||||
arch = _arch
|
||||
os = _os
|
||||
isRelease = _dist == "release"
|
||||
for (_project in List("pkl-cli", "pkl-doc")) {
|
||||
for (_arch in List("amd64", "aarch64")) {
|
||||
for (_os in List("macOS", "linux")) {
|
||||
["\(_project)-\(_os)-\(_arch)-\(_dist)"] {
|
||||
arch = _arch
|
||||
os = _os
|
||||
isRelease = _dist == "release"
|
||||
project = _project
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
["pkl-cli-linux-alpine-amd64-\(_dist)"] {
|
||||
arch = "amd64"
|
||||
os = "linux"
|
||||
musl = true
|
||||
isRelease = _dist == "release"
|
||||
}
|
||||
["pkl-cli-windows-amd64-\(_dist)"] {
|
||||
arch = "amd64"
|
||||
os = "windows"
|
||||
isRelease = _dist == "release"
|
||||
["\(_project)-linux-alpine-amd64-\(_dist)"] {
|
||||
arch = "amd64"
|
||||
os = "linux"
|
||||
musl = true
|
||||
isRelease = _dist == "release"
|
||||
project = _project
|
||||
}
|
||||
["\(_project)-windows-amd64-\(_dist)"] {
|
||||
arch = "amd64"
|
||||
os = "windows"
|
||||
isRelease = _dist == "release"
|
||||
project = _project
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,16 +152,15 @@ jobs {
|
||||
name = "Publish release on GitHub"
|
||||
command = #"""
|
||||
# exclude build_artifacts.txt from publish
|
||||
rm -f pkl-cli/build/executable/*.build_artifacts.txt
|
||||
find pkl-cli/build/executable/* -type d | xargs rm -rf
|
||||
rm -f pkl-cli/build/executable/resources
|
||||
rm -f */build/executable/*.build_artifacts.txt
|
||||
find */build/executable/* -type d | xargs rm -rf
|
||||
gh release create "${CIRCLE_TAG}" \
|
||||
--title "${CIRCLE_TAG}" \
|
||||
--target "${CIRCLE_SHA1}" \
|
||||
--verify-tag \
|
||||
--notes "Release notes: https://pkl-lang.org/main/current/release-notes/changelog.html#release-${CIRCLE_TAG}" \
|
||||
--repo "${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" \
|
||||
pkl-cli/build/executable/*
|
||||
*/build/executable/*
|
||||
"""#
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:macExecutableAmd64 pkl-core:testMacExecutableAmd64 pkl-server:testMacExecutableAmd64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.targetArch=amd64 pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
@@ -100,7 +100,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:linuxExecutableAmd64 pkl-core:testLinuxExecutableAmd64 pkl-server:testLinuxExecutableAmd64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
@@ -131,7 +131,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:macExecutableAarch64 pkl-core:testMacExecutableAarch64 pkl-server:testMacExecutableAarch64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
@@ -192,7 +192,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:linuxExecutableAarch64 pkl-core:testLinuxExecutableAarch64 pkl-server:testLinuxExecutableAarch64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
@@ -269,7 +269,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:alpineExecutableAmd64 pkl-core:testAlpineExecutableAmd64 pkl-server:testAlpineExecutableAmd64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.musl=true pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
@@ -301,7 +301,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:windowsExecutableAmd64 pkl-core:testWindowsExecutableAmd64 pkl-server:testWindowsExecutableAmd64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
shell: bash.exe
|
||||
- persist_to_workspace:
|
||||
@@ -316,6 +316,319 @@ jobs:
|
||||
resource_class: windows.large
|
||||
machine:
|
||||
image: windows-server-2022-gui:current
|
||||
pkl-doc-macOS-amd64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: /usr/sbin/softwareupdate --install-rosetta --agree-to-license
|
||||
name: Installing Rosetta 2
|
||||
- run:
|
||||
command: |-
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_x64_mac_hotspot_21.0.5_11.tar.gz -o /tmp/jdk.tar.gz
|
||||
|
||||
mkdir $HOME/jdk \
|
||||
&& cd $HOME/jdk \
|
||||
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.targetArch=amd64 pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /Users/distiller/jdk/Contents/Home
|
||||
resource_class: macos.m1.large.gen1
|
||||
macos:
|
||||
xcode: 15.3.0
|
||||
pkl-doc-linux-amd64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-amd64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
sed -ie '/\[ol8_codeready_builder\]/,/^$/s/enabled=0/enabled=1/g' /etc/yum.repos.d/oracle-linux-ol8.repo \
|
||||
&& microdnf -y install util-linux tree coreutils-single findutils curl tar gzip git zlib-devel gcc-c++ make openssl glibc-langpack-en libstdc++-static \
|
||||
&& microdnf clean all \
|
||||
&& rm -rf /var/cache/dnf
|
||||
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_x64_linux_hotspot_21.0.5_11.tar.gz -o /tmp/jdk.tar.gz
|
||||
|
||||
mkdir /jdk \
|
||||
&& cd /jdk \
|
||||
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
|
||||
|
||||
mkdir -p ~/staticdeps/bin
|
||||
|
||||
cp /usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -Lf https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
|
||||
# install musl
|
||||
if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then
|
||||
curl -Lf https://musl.libc.org/releases/musl-1.2.2.tar.gz -o /tmp/musl.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_musl-1.2.2 \
|
||||
&& cd /tmp/dep_musl-1.2.2 \
|
||||
&& cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "musl-1.2.2: configure..." && ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "musl-1.2.2: make..." && make -s -j4 \
|
||||
&& echo "musl-1.2.2: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_musl-1.2.2
|
||||
|
||||
# native-image expects to find an executable at this path.
|
||||
ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-amd64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: oraclelinux:8-slim
|
||||
pkl-doc-macOS-aarch64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: |-
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_aarch64_mac_hotspot_21.0.5_11.tar.gz -o /tmp/jdk.tar.gz
|
||||
|
||||
mkdir $HOME/jdk \
|
||||
&& cd $HOME/jdk \
|
||||
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /Users/distiller/jdk/Contents/Home
|
||||
resource_class: macos.m1.large.gen1
|
||||
macos:
|
||||
xcode: 15.3.0
|
||||
pkl-doc-linux-aarch64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-aarch64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
sed -ie '/\[ol8_codeready_builder\]/,/^$/s/enabled=0/enabled=1/g' /etc/yum.repos.d/oracle-linux-ol8.repo \
|
||||
&& microdnf -y install util-linux tree coreutils-single findutils curl tar gzip git zlib-devel gcc-c++ make openssl glibc-langpack-en libstdc++-static \
|
||||
&& microdnf clean all \
|
||||
&& rm -rf /var/cache/dnf
|
||||
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_aarch64_linux_hotspot_21.0.5_11.tar.gz -o /tmp/jdk.tar.gz
|
||||
|
||||
mkdir /jdk \
|
||||
&& cd /jdk \
|
||||
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
|
||||
|
||||
mkdir -p ~/staticdeps/bin
|
||||
|
||||
cp /usr/lib/gcc/aarch64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -Lf https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-aarch64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: arm.xlarge
|
||||
docker:
|
||||
- image: arm64v8/oraclelinux:8-slim
|
||||
pkl-doc-linux-alpine-amd64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-amd64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
sed -ie '/\[ol8_codeready_builder\]/,/^$/s/enabled=0/enabled=1/g' /etc/yum.repos.d/oracle-linux-ol8.repo \
|
||||
&& microdnf -y install util-linux tree coreutils-single findutils curl tar gzip git zlib-devel gcc-c++ make openssl glibc-langpack-en libstdc++-static \
|
||||
&& microdnf clean all \
|
||||
&& rm -rf /var/cache/dnf
|
||||
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_x64_linux_hotspot_21.0.5_11.tar.gz -o /tmp/jdk.tar.gz
|
||||
|
||||
mkdir /jdk \
|
||||
&& cd /jdk \
|
||||
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
|
||||
|
||||
mkdir -p ~/staticdeps/bin
|
||||
|
||||
cp /usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -Lf https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
|
||||
# install musl
|
||||
if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then
|
||||
curl -Lf https://musl.libc.org/releases/musl-1.2.2.tar.gz -o /tmp/musl.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_musl-1.2.2 \
|
||||
&& cd /tmp/dep_musl-1.2.2 \
|
||||
&& cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "musl-1.2.2: configure..." && ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "musl-1.2.2: make..." && make -s -j4 \
|
||||
&& echo "musl-1.2.2: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_musl-1.2.2
|
||||
|
||||
# native-image expects to find an executable at this path.
|
||||
ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-amd64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true -Dpkl.musl=true pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: oraclelinux:8-slim
|
||||
pkl-doc-windows-amd64-release:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: |-
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_x64_windows_hotspot_21.0.5_11.zip -o /tmp/jdk.zip
|
||||
|
||||
unzip /tmp/jdk.zip -d /tmp/jdk \
|
||||
&& cd /tmp/jdk/jdk-* \
|
||||
&& mkdir /jdk \
|
||||
&& cp -r . /jdk
|
||||
name: Set up environment
|
||||
shell: bash.exe
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -DreleaseBuild=true pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
shell: bash.exe
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: windows.large
|
||||
machine:
|
||||
image: windows-server-2022-gui:current
|
||||
pkl-cli-macOS-amd64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
@@ -336,7 +649,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-cli:macExecutableAmd64 pkl-core:testMacExecutableAmd64 pkl-server:testMacExecutableAmd64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -Dpkl.targetArch=amd64 pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
@@ -413,7 +726,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-cli:linuxExecutableAmd64 pkl-core:testLinuxExecutableAmd64 pkl-server:testLinuxExecutableAmd64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
@@ -444,7 +757,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-cli:macExecutableAarch64 pkl-core:testMacExecutableAarch64 pkl-server:testMacExecutableAarch64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
@@ -505,7 +818,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-cli:linuxExecutableAarch64 pkl-core:testLinuxExecutableAarch64 pkl-server:testLinuxExecutableAarch64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
@@ -582,7 +895,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-cli:alpineExecutableAmd64 pkl-core:testAlpineExecutableAmd64 pkl-server:testAlpineExecutableAmd64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
@@ -614,7 +927,7 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-cli:windowsExecutableAmd64 pkl-core:testWindowsExecutableAmd64 pkl-server:testWindowsExecutableAmd64
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-cli:buildNative
|
||||
name: gradle buildNative
|
||||
shell: bash.exe
|
||||
- persist_to_workspace:
|
||||
@@ -629,6 +942,319 @@ jobs:
|
||||
resource_class: windows.large
|
||||
machine:
|
||||
image: windows-server-2022-gui:current
|
||||
pkl-doc-macOS-amd64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: /usr/sbin/softwareupdate --install-rosetta --agree-to-license
|
||||
name: Installing Rosetta 2
|
||||
- run:
|
||||
command: |-
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_x64_mac_hotspot_21.0.5_11.tar.gz -o /tmp/jdk.tar.gz
|
||||
|
||||
mkdir $HOME/jdk \
|
||||
&& cd $HOME/jdk \
|
||||
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -Dpkl.targetArch=amd64 pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /Users/distiller/jdk/Contents/Home
|
||||
resource_class: macos.m1.large.gen1
|
||||
macos:
|
||||
xcode: 15.3.0
|
||||
pkl-doc-linux-amd64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-amd64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
sed -ie '/\[ol8_codeready_builder\]/,/^$/s/enabled=0/enabled=1/g' /etc/yum.repos.d/oracle-linux-ol8.repo \
|
||||
&& microdnf -y install util-linux tree coreutils-single findutils curl tar gzip git zlib-devel gcc-c++ make openssl glibc-langpack-en libstdc++-static \
|
||||
&& microdnf clean all \
|
||||
&& rm -rf /var/cache/dnf
|
||||
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_x64_linux_hotspot_21.0.5_11.tar.gz -o /tmp/jdk.tar.gz
|
||||
|
||||
mkdir /jdk \
|
||||
&& cd /jdk \
|
||||
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
|
||||
|
||||
mkdir -p ~/staticdeps/bin
|
||||
|
||||
cp /usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -Lf https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
|
||||
# install musl
|
||||
if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then
|
||||
curl -Lf https://musl.libc.org/releases/musl-1.2.2.tar.gz -o /tmp/musl.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_musl-1.2.2 \
|
||||
&& cd /tmp/dep_musl-1.2.2 \
|
||||
&& cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "musl-1.2.2: configure..." && ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "musl-1.2.2: make..." && make -s -j4 \
|
||||
&& echo "musl-1.2.2: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_musl-1.2.2
|
||||
|
||||
# native-image expects to find an executable at this path.
|
||||
ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-amd64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: oraclelinux:8-slim
|
||||
pkl-doc-macOS-aarch64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: |-
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_aarch64_mac_hotspot_21.0.5_11.tar.gz -o /tmp/jdk.tar.gz
|
||||
|
||||
mkdir $HOME/jdk \
|
||||
&& cd $HOME/jdk \
|
||||
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /Users/distiller/jdk/Contents/Home
|
||||
resource_class: macos.m1.large.gen1
|
||||
macos:
|
||||
xcode: 15.3.0
|
||||
pkl-doc-linux-aarch64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-aarch64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
sed -ie '/\[ol8_codeready_builder\]/,/^$/s/enabled=0/enabled=1/g' /etc/yum.repos.d/oracle-linux-ol8.repo \
|
||||
&& microdnf -y install util-linux tree coreutils-single findutils curl tar gzip git zlib-devel gcc-c++ make openssl glibc-langpack-en libstdc++-static \
|
||||
&& microdnf clean all \
|
||||
&& rm -rf /var/cache/dnf
|
||||
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_aarch64_linux_hotspot_21.0.5_11.tar.gz -o /tmp/jdk.tar.gz
|
||||
|
||||
mkdir /jdk \
|
||||
&& cd /jdk \
|
||||
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
|
||||
|
||||
mkdir -p ~/staticdeps/bin
|
||||
|
||||
cp /usr/lib/gcc/aarch64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -Lf https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-aarch64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: arm.xlarge
|
||||
docker:
|
||||
- image: arm64v8/oraclelinux:8-slim
|
||||
pkl-doc-linux-alpine-amd64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: staticdeps-amd64
|
||||
name: Restore static deps from cache
|
||||
- run:
|
||||
command: |-
|
||||
sed -ie '/\[ol8_codeready_builder\]/,/^$/s/enabled=0/enabled=1/g' /etc/yum.repos.d/oracle-linux-ol8.repo \
|
||||
&& microdnf -y install util-linux tree coreutils-single findutils curl tar gzip git zlib-devel gcc-c++ make openssl glibc-langpack-en libstdc++-static \
|
||||
&& microdnf clean all \
|
||||
&& rm -rf /var/cache/dnf
|
||||
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_x64_linux_hotspot_21.0.5_11.tar.gz -o /tmp/jdk.tar.gz
|
||||
|
||||
mkdir /jdk \
|
||||
&& cd /jdk \
|
||||
&& cat /tmp/jdk.tar.gz | tar --strip-components=1 -xzC .
|
||||
|
||||
mkdir -p ~/staticdeps/bin
|
||||
|
||||
cp /usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.a ~/staticdeps
|
||||
|
||||
# install zlib
|
||||
if [[ ! -f ~/staticdeps/include/zlib.h ]]; then
|
||||
curl -Lf https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz -o /tmp/zlib.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_zlib-1.2.13 \
|
||||
&& cd /tmp/dep_zlib-1.2.13 \
|
||||
&& cat /tmp/zlib.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "zlib-1.2.13: configure..." && ./configure --static --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "zlib-1.2.13: make..." && make -s -j4 \
|
||||
&& echo "zlib-1.2.13: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_zlib-1.2.13
|
||||
fi
|
||||
|
||||
# install musl
|
||||
if [[ ! -f ~/staticdeps/bin/x86_64-linux-musl-gcc ]]; then
|
||||
curl -Lf https://musl.libc.org/releases/musl-1.2.2.tar.gz -o /tmp/musl.tar.gz
|
||||
|
||||
mkdir -p /tmp/dep_musl-1.2.2 \
|
||||
&& cd /tmp/dep_musl-1.2.2 \
|
||||
&& cat /tmp/musl.tar.gz | tar --strip-components=1 -xzC . \
|
||||
&& echo "musl-1.2.2: configure..." && ./configure --disable-shared --prefix="$HOME"/staticdeps > /dev/null \
|
||||
&& echo "musl-1.2.2: make..." && make -s -j4 \
|
||||
&& echo "musl-1.2.2: make install..." && make -s install \
|
||||
&& rm -rf /tmp/dep_musl-1.2.2
|
||||
|
||||
# native-image expects to find an executable at this path.
|
||||
ln -s ~/staticdeps/bin/musl-gcc ~/staticdeps/bin/x86_64-linux-musl-gcc
|
||||
fi
|
||||
name: Set up environment
|
||||
shell: '#!/bin/bash -exo pipefail'
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/staticdeps
|
||||
key: staticdeps-amd64
|
||||
name: Save statics deps to cache
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true -Dpkl.musl=true pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: oraclelinux:8-slim
|
||||
pkl-doc-windows-amd64-snapshot:
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
command: |-
|
||||
# install jdk
|
||||
curl -Lf \
|
||||
https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_x64_windows_hotspot_21.0.5_11.zip -o /tmp/jdk.zip
|
||||
|
||||
unzip /tmp/jdk.zip -d /tmp/jdk \
|
||||
&& cd /tmp/jdk/jdk-* \
|
||||
&& mkdir /jdk \
|
||||
&& cp -r . /jdk
|
||||
name: Set up environment
|
||||
shell: bash.exe
|
||||
- run:
|
||||
command: |-
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew --info --stacktrace -DtestReportsDir=${HOME}/test-results -DpklMultiJdkTesting=true pkl-doc:buildNative
|
||||
name: gradle buildNative
|
||||
shell: bash.exe
|
||||
- persist_to_workspace:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-doc/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
LANG: en_US.UTF-8
|
||||
JAVA_HOME: /jdk
|
||||
resource_class: windows.large
|
||||
machine:
|
||||
image: windows-server-2022-gui:current
|
||||
gradle-check:
|
||||
steps:
|
||||
- checkout
|
||||
@@ -704,6 +1330,9 @@ jobs:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- pkl-doc/build/executable/
|
||||
- pkl-codegen-java/build/executable/
|
||||
- pkl-codegen-kotlin/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
@@ -721,6 +1350,9 @@ jobs:
|
||||
root: '.'
|
||||
paths:
|
||||
- pkl-cli/build/executable/
|
||||
- pkl-doc/build/executable/
|
||||
- pkl-codegen-java/build/executable/
|
||||
- pkl-codegen-kotlin/build/executable/
|
||||
- store_test_results:
|
||||
path: ~/test-results
|
||||
environment:
|
||||
@@ -734,16 +1366,15 @@ jobs:
|
||||
- run:
|
||||
command: |-
|
||||
# exclude build_artifacts.txt from publish
|
||||
rm -f pkl-cli/build/executable/*.build_artifacts.txt
|
||||
find pkl-cli/build/executable/* -type d | xargs rm -rf
|
||||
rm -f pkl-cli/build/executable/resources
|
||||
rm -f */build/executable/*.build_artifacts.txt
|
||||
find */build/executable/* -type d | xargs rm -rf
|
||||
gh release create "${CIRCLE_TAG}" \
|
||||
--title "${CIRCLE_TAG}" \
|
||||
--target "${CIRCLE_SHA1}" \
|
||||
--verify-tag \
|
||||
--notes "Release notes: https://pkl-lang.org/main/current/release-notes/changelog.html#release-${CIRCLE_TAG}" \
|
||||
--repo "${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" \
|
||||
pkl-cli/build/executable/*
|
||||
*/build/executable/*
|
||||
name: Publish release on GitHub
|
||||
docker:
|
||||
- image: maniator/gh:v2.40.1
|
||||
@@ -802,6 +1433,12 @@ workflows:
|
||||
- pkl-cli-linux-aarch64-snapshot
|
||||
- pkl-cli-linux-alpine-amd64-snapshot
|
||||
- pkl-cli-windows-amd64-snapshot
|
||||
- pkl-doc-macOS-amd64-snapshot
|
||||
- pkl-doc-linux-amd64-snapshot
|
||||
- pkl-doc-macOS-aarch64-snapshot
|
||||
- pkl-doc-linux-aarch64-snapshot
|
||||
- pkl-doc-linux-alpine-amd64-snapshot
|
||||
- pkl-doc-windows-amd64-snapshot
|
||||
- deploy-snapshot:
|
||||
requires:
|
||||
- gradle-check
|
||||
@@ -814,6 +1451,12 @@ workflows:
|
||||
- pkl-cli-linux-aarch64-snapshot
|
||||
- pkl-cli-linux-alpine-amd64-snapshot
|
||||
- pkl-cli-windows-amd64-snapshot
|
||||
- pkl-doc-macOS-amd64-snapshot
|
||||
- pkl-doc-linux-amd64-snapshot
|
||||
- pkl-doc-macOS-aarch64-snapshot
|
||||
- pkl-doc-linux-aarch64-snapshot
|
||||
- pkl-doc-linux-alpine-amd64-snapshot
|
||||
- pkl-doc-windows-amd64-snapshot
|
||||
context: pkl-maven-release
|
||||
- trigger-docsite-build:
|
||||
requires:
|
||||
@@ -886,6 +1529,42 @@ workflows:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-doc-macOS-amd64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-doc-linux-amd64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-doc-macOS-aarch64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-doc-linux-aarch64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-doc-linux-alpine-amd64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- pkl-doc-windows-amd64-release:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v?\d+\.\d+\.\d+$/
|
||||
- github-release:
|
||||
requires:
|
||||
- gradle-check
|
||||
@@ -898,6 +1577,12 @@ workflows:
|
||||
- pkl-cli-linux-aarch64-release
|
||||
- pkl-cli-linux-alpine-amd64-release
|
||||
- pkl-cli-windows-amd64-release
|
||||
- pkl-doc-macOS-amd64-release
|
||||
- pkl-doc-linux-amd64-release
|
||||
- pkl-doc-macOS-aarch64-release
|
||||
- pkl-doc-linux-aarch64-release
|
||||
- pkl-doc-linux-alpine-amd64-release
|
||||
- pkl-doc-windows-amd64-release
|
||||
context: pkl-github-release
|
||||
filters:
|
||||
branches:
|
||||
@@ -935,6 +1620,12 @@ workflows:
|
||||
- pkl-cli-linux-aarch64-release
|
||||
- pkl-cli-linux-alpine-amd64-release
|
||||
- pkl-cli-windows-amd64-release
|
||||
- pkl-doc-macOS-amd64-release
|
||||
- pkl-doc-linux-amd64-release
|
||||
- pkl-doc-macOS-aarch64-release
|
||||
- pkl-doc-linux-aarch64-release
|
||||
- pkl-doc-linux-alpine-amd64-release
|
||||
- pkl-doc-windows-amd64-release
|
||||
when:
|
||||
matches:
|
||||
value: << pipeline.git.branch >>
|
||||
|
||||
@@ -24,8 +24,20 @@ arch: "amd64"|"aarch64"
|
||||
/// Whether to link to musl. Otherwise, links to glibc.
|
||||
musl: Boolean = false
|
||||
|
||||
/// The Gradle project under which to generate the executable
|
||||
project: String
|
||||
|
||||
javaVersion = "21.0"
|
||||
|
||||
extraGradleArgs {
|
||||
when (os == "macOS" && arch == "amd64") {
|
||||
"-Dpkl.targetArch=\(arch)"
|
||||
}
|
||||
when (musl) {
|
||||
"-Dpkl.musl=true"
|
||||
}
|
||||
}
|
||||
|
||||
local setupLinuxEnvironment: Config.RunStep =
|
||||
let (muslVersion = "1.2.2")
|
||||
let (zlibVersion = "1.2.13")
|
||||
@@ -131,24 +143,18 @@ steps {
|
||||
}
|
||||
new Config.RunStep {
|
||||
name = "gradle buildNative"
|
||||
local _os =
|
||||
if (module.os == "macOS") "mac"
|
||||
else if (musl) "alpine"
|
||||
else if (module.os == "windows") "windows"
|
||||
else "linux"
|
||||
local jobName = "\(_os)Executable\(arch.capitalize())"
|
||||
when (module.os == "windows") {
|
||||
shell = "bash.exe"
|
||||
}
|
||||
command = #"""
|
||||
export PATH=~/staticdeps/bin:$PATH
|
||||
./gradlew \#(module.gradleArgs) pkl-cli:\#(jobName) pkl-core:test\#(jobName.capitalize()) pkl-server:test\#(jobName.capitalize())
|
||||
./gradlew \#(module.gradleArgs) \#(project):buildNative
|
||||
"""#
|
||||
}
|
||||
new Config.PersistToWorkspaceStep {
|
||||
root = "."
|
||||
paths {
|
||||
"pkl-cli/build/executable/"
|
||||
"\(project)/build/executable/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,14 @@ steps {
|
||||
new Config.RunStep {
|
||||
command = "./gradlew \(self.gradleArgs) \(module.command)"
|
||||
}
|
||||
// add jpkl to workspace so it gets published as a GitHub release
|
||||
// add Java executables to workspace so they get published as a GitHub release
|
||||
new Config.PersistToWorkspaceStep {
|
||||
root = "."
|
||||
paths {
|
||||
"pkl-cli/build/executable/"
|
||||
"pkl-doc/build/executable/"
|
||||
"pkl-codegen-java/build/executable/"
|
||||
"pkl-codegen-kotlin/build/executable/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,8 +51,11 @@ fixed gradleArgs = new Listing {
|
||||
when (isRelease) {
|
||||
"-DreleaseBuild=true"
|
||||
}
|
||||
...extraGradleArgs
|
||||
}.join(" ")
|
||||
|
||||
extraGradleArgs: Listing<String>
|
||||
|
||||
steps: Listing<Config.Step>
|
||||
|
||||
job: Config.Job = new {
|
||||
|
||||
@@ -45,12 +45,11 @@ install {uri-native-prerequisites-windows}[Prerequisites For Native Image on Win
|
||||
[source,shell]
|
||||
----
|
||||
gw clean
|
||||
gw test # run all tests except native executable tests
|
||||
gw testNative # run native executable tests
|
||||
gw spotlessApply # fix code formatting
|
||||
gw build # build everything except native executables
|
||||
gw buildNative # build native executable(s) for current platform
|
||||
# (Alpine executable is only built if ~/staticdeps/bin/musl-gcc exists)
|
||||
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
|
||||
|
||||
@@ -107,6 +107,18 @@ open class BuildInfo(private val project: Project) {
|
||||
}
|
||||
}
|
||||
|
||||
/** The target architecture to build, defaulting to the system architecture. */
|
||||
val targetArch by lazy { System.getProperty("pkl.targetArch") ?: arch }
|
||||
|
||||
/** Tells if this is a cross-arch build (e.g. targeting amd64 when on an aarch64 machine). */
|
||||
val isCrossArch by lazy { arch != targetArch }
|
||||
|
||||
/** Tells if cross-arch builds are supported on this machine. */
|
||||
val isCrossArchSupported by lazy { os.isMacOsX }
|
||||
|
||||
/** Whether to build native executables using the musl toolchain or not. */
|
||||
val musl: Boolean by lazy { java.lang.Boolean.getBoolean("pkl.musl") }
|
||||
|
||||
/** Same logic as [org.gradle.internal.os.OperatingSystem#arch], which is protected. */
|
||||
val arch: String by lazy {
|
||||
when (val arch = System.getProperty("os.arch")) {
|
||||
|
||||
49
buildSrc/src/main/kotlin/ExecutableSpec.kt
Normal file
49
buildSrc/src/main/kotlin/ExecutableSpec.kt
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import org.gradle.api.provider.Property
|
||||
|
||||
abstract class ExecutableSpec {
|
||||
/** The main entrypoint Java class of the executable. */
|
||||
abstract val mainClass: Property<String>
|
||||
|
||||
/**
|
||||
* The name of the native executable.
|
||||
*
|
||||
* Not required if not building a native executable.
|
||||
*/
|
||||
abstract val name: Property<String>
|
||||
|
||||
/** The name of the Java executable. */
|
||||
abstract val javaName: Property<String>
|
||||
|
||||
/** The name of the executable that shows in the description when published to Maven. */
|
||||
abstract val documentationName: Property<String>
|
||||
|
||||
/**
|
||||
* The base name of the Maven publication.
|
||||
*
|
||||
* This becomes the base name of the Artifact ID, with the os and arch suffixed.
|
||||
*
|
||||
* For example, `pkl` becomes `pkl-macos-aarch` for the macOS/aarch64 variant.
|
||||
*/
|
||||
abstract val publicationName: Property<String>
|
||||
|
||||
/** The name of the artifact ID for the Java executable. */
|
||||
abstract val javaPublicationName: Property<String>
|
||||
|
||||
/** The website for this executable. */
|
||||
abstract val website: Property<String>
|
||||
}
|
||||
169
buildSrc/src/main/kotlin/NativeImageBuild.kt
Normal file
169
buildSrc/src/main/kotlin/NativeImageBuild.kt
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import javax.inject.Inject
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.services.BuildService
|
||||
import org.gradle.api.services.BuildServiceParameters
|
||||
import org.gradle.api.tasks.ClasspathNormalizer
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.kotlin.dsl.registerIfAbsent
|
||||
import org.gradle.kotlin.dsl.withNormalizer
|
||||
import org.gradle.process.ExecOperations
|
||||
|
||||
enum class Architecture {
|
||||
AMD64,
|
||||
AARCH64,
|
||||
}
|
||||
|
||||
abstract class NativeImageBuildService : BuildService<BuildServiceParameters.None>
|
||||
|
||||
abstract class NativeImageBuild : DefaultTask() {
|
||||
@get:Input abstract val imageName: Property<String>
|
||||
|
||||
@get:Input abstract val extraNativeImageArgs: ListProperty<String>
|
||||
|
||||
@get:Input abstract val arch: Property<Architecture>
|
||||
|
||||
@get:Input abstract val mainClass: Property<String>
|
||||
|
||||
@get:InputFiles abstract val classpath: ConfigurableFileCollection
|
||||
|
||||
private val outputDir = project.layout.buildDirectory.dir("executable")
|
||||
|
||||
@get:OutputFile val outputFile = outputDir.flatMap { it.file(imageName) }
|
||||
|
||||
@get:Inject protected abstract val execOperations: ExecOperations
|
||||
|
||||
private val graalVm: Provider<BuildInfo.GraalVm> =
|
||||
arch.map { a ->
|
||||
when (a) {
|
||||
Architecture.AMD64 -> buildInfo.graalVmAmd64
|
||||
Architecture.AARCH64 -> buildInfo.graalVmAarch64
|
||||
}
|
||||
}
|
||||
|
||||
private val buildInfo: BuildInfo = project.extensions.getByType(BuildInfo::class.java)
|
||||
|
||||
private val nativeImageCommandName =
|
||||
if (buildInfo.os.isWindows) "native-image.cmd" else "native-image"
|
||||
|
||||
private val nativeImageExecutable = graalVm.map { "${it.baseDir}/bin/$nativeImageCommandName" }
|
||||
|
||||
private val extraArgsFromProperties by lazy {
|
||||
System.getProperties()
|
||||
.filter { it.key.toString().startsWith("pkl.native") }
|
||||
.map { "${it.key}=${it.value}".substring("pkl.native".length) }
|
||||
}
|
||||
|
||||
private val buildService =
|
||||
project.gradle.sharedServices.registerIfAbsent(
|
||||
"nativeImageBuildService",
|
||||
NativeImageBuildService::class,
|
||||
) {
|
||||
maxParallelUsages.set(1)
|
||||
}
|
||||
|
||||
init {
|
||||
// ensure native-image builds run in serial (prevent `gw buildNative` from consuming all host
|
||||
// CPU resources).
|
||||
usesService(buildService)
|
||||
|
||||
group = "build"
|
||||
|
||||
inputs
|
||||
.files(classpath)
|
||||
.withPropertyName("runtimeClasspath")
|
||||
.withNormalizer(ClasspathNormalizer::class)
|
||||
inputs
|
||||
.files(nativeImageExecutable)
|
||||
.withPropertyName("graalVmNativeImage")
|
||||
.withPathSensitivity(PathSensitivity.ABSOLUTE)
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
protected fun run() {
|
||||
execOperations.exec {
|
||||
val exclusions =
|
||||
listOf(buildInfo.libs.findLibrary("graalSdk").get()).map { it.get().module.name }
|
||||
|
||||
executable = nativeImageExecutable.get()
|
||||
workingDir(outputDir)
|
||||
|
||||
args = buildList {
|
||||
// must be emitted before any experimental options are used
|
||||
add("-H:+UnlockExperimentalVMOptions")
|
||||
// currently gives a deprecation warning, but we've been told
|
||||
// that the "initialize everything at build time" *CLI* option is likely here to stay
|
||||
add("--initialize-at-build-time=")
|
||||
// needed for messagepack-java (see https://github.com/msgpack/msgpack-java/issues/600)
|
||||
add("--initialize-at-run-time=org.msgpack.core.buffer.DirectBufferAccess")
|
||||
add("--no-fallback")
|
||||
add("-H:IncludeResources=org/pkl/core/stdlib/.*\\.pkl")
|
||||
add("-H:IncludeResources=org/jline/utils/.*")
|
||||
add("-H:IncludeResourceBundles=org.pkl.core.errorMessages")
|
||||
add("-H:IncludeResourceBundles=org.pkl.parser.errorMessages")
|
||||
add("-H:IncludeResources=org/pkl/commons/cli/PklCARoots.pem")
|
||||
add("-H:Class=${mainClass.get()}")
|
||||
add("-o")
|
||||
add(imageName.get())
|
||||
// the actual limit (currently) used by native-image is this number + 1400 (idea is to
|
||||
// compensate for Truffle's own nodes)
|
||||
add("-H:MaxRuntimeCompileMethods=1800")
|
||||
add("-H:+EnforceMaxRuntimeCompileMethods")
|
||||
add("--enable-url-protocols=http,https")
|
||||
add("-H:+ReportExceptionStackTraces")
|
||||
// disable automatic support for JVM CLI options (puts our main class in full control of
|
||||
// argument parsing)
|
||||
add("-H:-ParseRuntimeOptions")
|
||||
// quick build mode: 40% faster compilation, 20% smaller (but presumably also slower)
|
||||
// executable
|
||||
if (!buildInfo.isReleaseBuild) {
|
||||
add("-Ob")
|
||||
}
|
||||
if (buildInfo.isNativeArch) {
|
||||
add("-march=native")
|
||||
} else {
|
||||
add("-march=compatibility")
|
||||
}
|
||||
// native-image rejects non-existing class path entries -> filter
|
||||
add("--class-path")
|
||||
val pathInput =
|
||||
classpath.filter {
|
||||
it.exists() && !exclusions.any { exclude -> it.name.contains(exclude) }
|
||||
}
|
||||
add(pathInput.asPath)
|
||||
// make sure dev machine stays responsive (15% slowdown on my laptop)
|
||||
val processors =
|
||||
Runtime.getRuntime().availableProcessors() /
|
||||
if (buildInfo.os.isMacOsX && !buildInfo.isCiBuild) 4 else 1
|
||||
add("-J-XX:ActiveProcessorCount=${processors}")
|
||||
// Pass through all `HOMEBREW_` prefixed environment variables to allow build with shimmed
|
||||
// tools.
|
||||
addAll(environment.keys.filter { it.startsWith("HOMEBREW_") }.map { "-E$it" })
|
||||
addAll(extraNativeImageArgs.get())
|
||||
addAll(extraArgsFromProperties)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
132
buildSrc/src/main/kotlin/pklJavaExecutable.gradle.kts
Normal file
132
buildSrc/src/main/kotlin/pklJavaExecutable.gradle.kts
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import kotlin.io.path.createDirectories
|
||||
import kotlin.io.path.writeText
|
||||
import org.gradle.kotlin.dsl.support.serviceOf
|
||||
|
||||
plugins {
|
||||
id("pklJavaLibrary")
|
||||
id("pklPublishLibrary")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
}
|
||||
|
||||
val executableSpec = project.extensions.create("executable", ExecutableSpec::class.java)
|
||||
val buildInfo = project.extensions.getByType<BuildInfo>()
|
||||
|
||||
val javaExecutable by
|
||||
tasks.registering(ExecutableJar::class) {
|
||||
group = "build"
|
||||
dependsOn(tasks.jar)
|
||||
inJar = tasks.shadowJar.flatMap { it.archiveFile }
|
||||
val effectiveJavaName =
|
||||
executableSpec.javaName.map { name -> if (buildInfo.os.isWindows) "$name.bat" else name }
|
||||
outJar = layout.buildDirectory.dir("executable").flatMap { it.file(effectiveJavaName) }
|
||||
|
||||
// uncomment for debugging
|
||||
// jvmArgs.addAll("-ea", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005")
|
||||
}
|
||||
|
||||
fun Task.setupTestStartJavaExecutable(launcher: Provider<JavaLauncher>? = null) {
|
||||
group = "verification"
|
||||
dependsOn(javaExecutable)
|
||||
|
||||
// dummy output to satisfy up-to-date check
|
||||
val outputFile = layout.buildDirectory.file("testStartJavaExecutable/$name")
|
||||
outputs.file(outputFile)
|
||||
|
||||
val execOutput =
|
||||
providers.exec {
|
||||
val executablePath = javaExecutable.get().outputs.files.singleFile
|
||||
if (launcher?.isPresent == true) {
|
||||
commandLine(
|
||||
launcher.get().executablePath.asFile.absolutePath,
|
||||
"-jar",
|
||||
executablePath.absolutePath,
|
||||
"--version",
|
||||
)
|
||||
} else {
|
||||
commandLine(executablePath.absolutePath, "--version")
|
||||
}
|
||||
}
|
||||
|
||||
doLast {
|
||||
val outputText = execOutput.standardOutput.asText.get()
|
||||
if (!outputText.contains(buildInfo.pklVersionNonUnique)) {
|
||||
throw GradleException(
|
||||
"Expected version output to contain current version (${buildInfo.pklVersionNonUnique}), but got '$outputText'"
|
||||
)
|
||||
}
|
||||
outputFile.get().asFile.toPath().apply {
|
||||
try {
|
||||
parent.createDirectories()
|
||||
} catch (ignored: java.nio.file.FileAlreadyExistsException) {}
|
||||
writeText("OK")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val testStartJavaExecutable by tasks.registering { setupTestStartJavaExecutable() }
|
||||
|
||||
// Setup `testStartJavaExecutable` tasks for multi-JDK testing.
|
||||
val testStartJavaExecutableOnOtherJdks =
|
||||
buildInfo.jdkTestRange.map { jdkTarget ->
|
||||
tasks.register("testStartJavaExecutableJdk${jdkTarget.asInt()}") {
|
||||
val toolChainService: JavaToolchainService = serviceOf()
|
||||
val launcher = toolChainService.launcherFor { languageVersion = jdkTarget }
|
||||
setupTestStartJavaExecutable(launcher)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.assemble { dependsOn(javaExecutable) }
|
||||
|
||||
tasks.check {
|
||||
dependsOn(testStartJavaExecutable)
|
||||
if (buildInfo.multiJdkTesting) {
|
||||
dependsOn(testStartJavaExecutableOnOtherJdks)
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
// need to put in `afterEvaluate` because `artifactId` cannot be set lazily.
|
||||
project.afterEvaluate {
|
||||
register<MavenPublication>("javaExecutable") {
|
||||
artifactId = executableSpec.javaPublicationName.get()
|
||||
|
||||
artifact(javaExecutable.map { it.outputs.files.singleFile }) {
|
||||
classifier = null
|
||||
extension = "jar"
|
||||
builtBy(javaExecutable)
|
||||
}
|
||||
|
||||
pom {
|
||||
url = executableSpec.website
|
||||
description =
|
||||
executableSpec.documentationName.map { name ->
|
||||
"""
|
||||
$name executable for Java.
|
||||
Can be executed directly, or with `java -jar <path/to/jpkl>`.
|
||||
Requires Java 17 or higher.
|
||||
"""
|
||||
.trimIndent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing { project.afterEvaluate { sign(publishing.publications["javaExecutable"]) } }
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
val assembleNative by tasks.registering {}
|
||||
|
||||
val testNative by tasks.registering {}
|
||||
|
||||
val checkNative by tasks.registering { dependsOn(testNative) }
|
||||
|
||||
val buildNative by tasks.registering { dependsOn(assembleNative, checkNative) }
|
||||
291
buildSrc/src/main/kotlin/pklNativeExecutable.gradle.kts
Normal file
291
buildSrc/src/main/kotlin/pklNativeExecutable.gradle.kts
Normal file
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
* Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import kotlin.io.path.createDirectories
|
||||
import kotlin.io.path.writeText
|
||||
|
||||
plugins {
|
||||
id("pklGraalVm")
|
||||
id("pklJavaLibrary")
|
||||
id("pklNativeLifecycle")
|
||||
id("pklPublishLibrary")
|
||||
id("com.github.johnrengelman.shadow")
|
||||
}
|
||||
|
||||
// assumes that `pklJavaExecutable` is also applied
|
||||
val executableSpec = project.extensions.getByType<ExecutableSpec>()
|
||||
val buildInfo = project.extensions.getByType<BuildInfo>()
|
||||
|
||||
val stagedMacAmd64Executable: Configuration by configurations.creating
|
||||
val stagedMacAarch64Executable: Configuration by configurations.creating
|
||||
val stagedLinuxAmd64Executable: Configuration by configurations.creating
|
||||
val stagedLinuxAarch64Executable: Configuration by configurations.creating
|
||||
val stagedAlpineLinuxAmd64Executable: Configuration by configurations.creating
|
||||
val stagedWindowsAmd64Executable: Configuration by configurations.creating
|
||||
|
||||
dependencies {
|
||||
fun executableFile(suffix: String) =
|
||||
files(
|
||||
layout.buildDirectory.dir("executable").map { dir ->
|
||||
dir.file(executableSpec.name.map { "$it-$suffix" })
|
||||
}
|
||||
)
|
||||
stagedMacAarch64Executable(executableFile("macos-aarch64"))
|
||||
stagedMacAmd64Executable(executableFile("macos-amd64"))
|
||||
stagedLinuxAmd64Executable(executableFile("linux-amd64"))
|
||||
stagedLinuxAarch64Executable(executableFile("linux-aarch64"))
|
||||
stagedAlpineLinuxAmd64Executable(executableFile("alpine-linux-amd64"))
|
||||
stagedWindowsAmd64Executable(executableFile("windows-amd64.exe"))
|
||||
}
|
||||
|
||||
private fun NativeImageBuild.amd64() {
|
||||
arch = Architecture.AMD64
|
||||
dependsOn(":installGraalVmAmd64")
|
||||
}
|
||||
|
||||
private fun NativeImageBuild.aarch64() {
|
||||
arch = Architecture.AARCH64
|
||||
dependsOn(":installGraalVmAarch64")
|
||||
}
|
||||
|
||||
private fun NativeImageBuild.setClasspath() {
|
||||
classpath.from(sourceSets.main.map { it.output })
|
||||
classpath.from(
|
||||
project(":pkl-commons-cli").extensions.getByType(SourceSetContainer::class)["svm"].output
|
||||
)
|
||||
classpath.from(configurations.runtimeClasspath)
|
||||
}
|
||||
|
||||
val macExecutableAmd64 by
|
||||
tasks.registering(NativeImageBuild::class) {
|
||||
imageName = executableSpec.name.map { "$it-macos-amd64" }
|
||||
mainClass = executableSpec.mainClass
|
||||
amd64()
|
||||
setClasspath()
|
||||
}
|
||||
|
||||
val macExecutableAarch64 by
|
||||
tasks.registering(NativeImageBuild::class) {
|
||||
imageName = executableSpec.name.map { "$it-macos-aarch64" }
|
||||
mainClass = executableSpec.mainClass
|
||||
aarch64()
|
||||
setClasspath()
|
||||
}
|
||||
|
||||
val linuxExecutableAmd64 by
|
||||
tasks.registering(NativeImageBuild::class) {
|
||||
imageName = executableSpec.name.map { "$it-linux-amd64" }
|
||||
mainClass = executableSpec.mainClass
|
||||
amd64()
|
||||
setClasspath()
|
||||
}
|
||||
|
||||
val linuxExecutableAarch64 by
|
||||
tasks.registering(NativeImageBuild::class) {
|
||||
imageName = executableSpec.name.map { "$it-linux-aarch64" }
|
||||
mainClass = executableSpec.mainClass
|
||||
aarch64()
|
||||
setClasspath()
|
||||
// Ensure compatibility for kernels with page size set to 4k, 16k and 64k
|
||||
// (e.g. Raspberry Pi 5, Asahi Linux)
|
||||
extraNativeImageArgs.add("-H:PageSize=65536")
|
||||
}
|
||||
|
||||
val alpineExecutableAmd64 by
|
||||
tasks.registering(NativeImageBuild::class) {
|
||||
imageName = executableSpec.name.map { "$it-alpine-linux-amd64" }
|
||||
mainClass = executableSpec.mainClass
|
||||
amd64()
|
||||
setClasspath()
|
||||
extraNativeImageArgs.addAll(listOf("--static", "--libc=musl"))
|
||||
}
|
||||
|
||||
val windowsExecutableAmd64 by
|
||||
tasks.registering(NativeImageBuild::class) {
|
||||
imageName = executableSpec.name.map { "$it-windows-amd64" }
|
||||
mainClass = executableSpec.mainClass
|
||||
amd64()
|
||||
setClasspath()
|
||||
extraNativeImageArgs.add("-Dfile.encoding=UTF-8")
|
||||
}
|
||||
|
||||
val assembleNative by tasks.existing
|
||||
|
||||
val testStartNativeExecutable by
|
||||
tasks.registering {
|
||||
dependsOn(assembleNative)
|
||||
|
||||
// dummy file for up-to-date checking
|
||||
val outputFile = project.layout.buildDirectory.file("testStartNativeExecutable/output.txt")
|
||||
outputs.file(outputFile)
|
||||
|
||||
val execOutput =
|
||||
providers.exec { commandLine(assembleNative.get().outputs.files.singleFile, "--version") }
|
||||
|
||||
doLast {
|
||||
val outputText = execOutput.standardOutput.asText.get()
|
||||
if (!outputText.contains(buildInfo.pklVersionNonUnique)) {
|
||||
throw GradleException(
|
||||
"Expected version output to contain current version (${buildInfo.pklVersionNonUnique}), but got '$outputText'"
|
||||
)
|
||||
}
|
||||
outputFile.get().asFile.toPath().apply {
|
||||
try {
|
||||
parent.createDirectories()
|
||||
} catch (ignored: java.nio.file.FileAlreadyExistsException) {}
|
||||
writeText("OK")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Expose underlying task's outputs
|
||||
private fun <T : Task> Task.wraps(other: TaskProvider<T>) {
|
||||
dependsOn(other)
|
||||
outputs.files(other)
|
||||
}
|
||||
|
||||
val testNative by tasks.existing { dependsOn(testStartNativeExecutable) }
|
||||
|
||||
val assembleNativeMacOsAarch64 by tasks.existing { wraps(macExecutableAarch64) }
|
||||
|
||||
val assembleNativeMacOsAmd64 by tasks.existing { wraps(macExecutableAmd64) }
|
||||
|
||||
val assembleNativeLinuxAarch64 by tasks.existing { wraps(linuxExecutableAarch64) }
|
||||
|
||||
val assembleNativeLinuxAmd64 by tasks.existing { wraps(linuxExecutableAmd64) }
|
||||
|
||||
val assembleNativeAlpineLinuxAmd64 by tasks.existing { wraps(alpineExecutableAmd64) }
|
||||
|
||||
val assembleNativeWindowsAmd64 by tasks.existing { wraps(windowsExecutableAmd64) }
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
// need to put in `afterEvaluate` because `artifactId` cannot be set lazily.
|
||||
project.afterEvaluate {
|
||||
create<MavenPublication>("macExecutableAmd64") {
|
||||
artifactId = "${executableSpec.publicationName.get()}-macos-amd64"
|
||||
artifact(stagedMacAmd64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "bin"
|
||||
builtBy(stagedMacAmd64Executable)
|
||||
}
|
||||
pom {
|
||||
name = "${executableSpec.publicationName.get()}-macos-amd64"
|
||||
url = executableSpec.website
|
||||
description =
|
||||
executableSpec.documentationName.map { name ->
|
||||
"Native $name executable for macOS/amd64."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
create<MavenPublication>("macExecutableAarch64") {
|
||||
artifactId = "${executableSpec.publicationName.get()}-macos-aarch64"
|
||||
artifact(stagedMacAarch64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "bin"
|
||||
builtBy(stagedMacAarch64Executable)
|
||||
}
|
||||
pom {
|
||||
name = "${executableSpec.publicationName.get()}-macos-aarch64"
|
||||
url = executableSpec.website
|
||||
description =
|
||||
executableSpec.documentationName.map { name ->
|
||||
"Native $name executable for macOS/aarch64."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
create<MavenPublication>("linuxExecutableAmd64") {
|
||||
artifactId = "${executableSpec.publicationName.get()}-linux-amd64"
|
||||
artifact(stagedLinuxAmd64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "bin"
|
||||
builtBy(stagedLinuxAmd64Executable)
|
||||
}
|
||||
pom {
|
||||
name = "${executableSpec.publicationName.get()}-linux-amd64"
|
||||
url = executableSpec.website
|
||||
description =
|
||||
executableSpec.documentationName.map { name ->
|
||||
"Native $name executable for linux/amd64."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
create<MavenPublication>("linuxExecutableAarch64") {
|
||||
artifactId = "${executableSpec.publicationName.get()}-linux-aarch64"
|
||||
artifact(stagedLinuxAarch64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "bin"
|
||||
builtBy(stagedLinuxAarch64Executable)
|
||||
}
|
||||
pom {
|
||||
name = "${executableSpec.publicationName.get()}-linux-aarch64"
|
||||
url = executableSpec.website
|
||||
description =
|
||||
executableSpec.documentationName.map { name ->
|
||||
"Native $name executable for linux/aarch64."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
create<MavenPublication>("alpineLinuxExecutableAmd64") {
|
||||
artifactId = "${executableSpec.publicationName.get()}-alpine-linux-amd64"
|
||||
artifact(stagedAlpineLinuxAmd64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "bin"
|
||||
builtBy(stagedAlpineLinuxAmd64Executable)
|
||||
}
|
||||
pom {
|
||||
name = "${executableSpec.publicationName.get()}-alpine-linux-amd64"
|
||||
url = executableSpec.website
|
||||
description =
|
||||
executableSpec.documentationName.map { name ->
|
||||
"Native $name executable for linux/amd64 and statically linked to musl."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
create<MavenPublication>("windowsExecutableAmd64") {
|
||||
artifactId = "${executableSpec.publicationName.get()}-windows-amd64"
|
||||
artifact(stagedWindowsAmd64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "exe"
|
||||
builtBy(stagedWindowsAmd64Executable)
|
||||
}
|
||||
pom {
|
||||
name = "${executableSpec.publicationName.get()}-windows-amd64"
|
||||
url = executableSpec.website
|
||||
description =
|
||||
executableSpec.documentationName.map { name ->
|
||||
"Native $name executable for windows/amd64."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
project.afterEvaluate {
|
||||
sign(publishing.publications["linuxExecutableAarch64"])
|
||||
sign(publishing.publications["linuxExecutableAmd64"])
|
||||
sign(publishing.publications["macExecutableAarch64"])
|
||||
sign(publishing.publications["macExecutableAmd64"])
|
||||
sign(publishing.publications["alpineLinuxExecutableAmd64"])
|
||||
sign(publishing.publications["windowsExecutableAmd64"])
|
||||
}
|
||||
}
|
||||
129
buildSrc/src/main/kotlin/pklNativeLifecycle.gradle.kts
Normal file
129
buildSrc/src/main/kotlin/pklNativeLifecycle.gradle.kts
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
val assembleNativeMacOsAarch64 by tasks.registering { group = "build" }
|
||||
|
||||
val assembleNativeMacOsAmd64 by tasks.registering { group = "build" }
|
||||
|
||||
val assembleNativeLinuxAarch64 by tasks.registering { group = "build" }
|
||||
|
||||
val assembleNativeLinuxAmd64 by tasks.registering { group = "build" }
|
||||
|
||||
val assembleNativeAlpineLinuxAmd64 by tasks.registering { group = "build" }
|
||||
|
||||
val assembleNativeWindowsAmd64 by tasks.registering { group = "build" }
|
||||
|
||||
val testNativeMacOsAarch64 by tasks.registering { group = "verification" }
|
||||
|
||||
val testNativeMacOsAmd64 by tasks.registering { group = "verification" }
|
||||
|
||||
val testNativeLinuxAarch64 by tasks.registering { group = "verification" }
|
||||
|
||||
val testNativeLinuxAmd64 by tasks.registering { group = "verification" }
|
||||
|
||||
val testNativeAlpineLinuxAmd64 by tasks.registering { group = "verification" }
|
||||
|
||||
val testNativeWindowsAmd64 by tasks.registering { group = "verification" }
|
||||
|
||||
val buildInfo = project.extensions.getByType<BuildInfo>()
|
||||
|
||||
private fun <T : Task> Task.wraps(other: TaskProvider<T>) {
|
||||
dependsOn(other)
|
||||
outputs.files(other)
|
||||
}
|
||||
|
||||
val assembleNative by
|
||||
tasks.registering {
|
||||
group = "build"
|
||||
|
||||
if (!buildInfo.isCrossArchSupported && buildInfo.isCrossArch) {
|
||||
throw GradleException("Cross-arch builds are not supported on ${buildInfo.os.name}")
|
||||
}
|
||||
|
||||
when {
|
||||
buildInfo.os.isMacOsX && buildInfo.targetArch == "aarch64" -> {
|
||||
wraps(assembleNativeMacOsAarch64)
|
||||
}
|
||||
buildInfo.os.isMacOsX && buildInfo.targetArch == "amd64" -> {
|
||||
wraps(assembleNativeMacOsAmd64)
|
||||
}
|
||||
buildInfo.os.isLinux && buildInfo.targetArch == "aarch64" -> {
|
||||
wraps(assembleNativeLinuxAarch64)
|
||||
}
|
||||
buildInfo.os.isLinux && buildInfo.targetArch == "amd64" -> {
|
||||
if (buildInfo.musl) wraps(assembleNativeAlpineLinuxAmd64)
|
||||
else wraps(assembleNativeLinuxAmd64)
|
||||
}
|
||||
buildInfo.os.isWindows && buildInfo.targetArch == "amd64" -> {
|
||||
wraps(assembleNativeWindowsAmd64)
|
||||
}
|
||||
buildInfo.musl -> {
|
||||
throw GradleException("Building musl on ${buildInfo.os} is not supported")
|
||||
}
|
||||
else -> {
|
||||
throw GradleException(
|
||||
"Unsupported os/arch pair: ${buildInfo.os.name}/${buildInfo.targetArch}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val testNative by
|
||||
tasks.registering {
|
||||
group = "verification"
|
||||
|
||||
if (!buildInfo.isCrossArchSupported && buildInfo.isCrossArch) {
|
||||
throw GradleException("Cross-arch builds are not supported on ${buildInfo.os.name}")
|
||||
}
|
||||
|
||||
when {
|
||||
buildInfo.os.isMacOsX && buildInfo.targetArch == "aarch64" -> {
|
||||
dependsOn(testNativeMacOsAarch64)
|
||||
}
|
||||
buildInfo.os.isMacOsX && buildInfo.targetArch == "amd64" -> {
|
||||
dependsOn(testNativeMacOsAmd64)
|
||||
}
|
||||
buildInfo.os.isLinux && buildInfo.targetArch == "aarch64" -> {
|
||||
dependsOn(testNativeLinuxAarch64)
|
||||
}
|
||||
buildInfo.os.isLinux && buildInfo.targetArch == "amd64" -> {
|
||||
if (buildInfo.musl) dependsOn(testNativeAlpineLinuxAmd64)
|
||||
else dependsOn(testNativeLinuxAmd64)
|
||||
}
|
||||
buildInfo.os.isWindows && buildInfo.targetArch == "amd64" -> {
|
||||
dependsOn(testNativeWindowsAmd64)
|
||||
}
|
||||
buildInfo.musl -> {
|
||||
throw GradleException("Building musl on ${buildInfo.os} is not supported")
|
||||
}
|
||||
else -> {
|
||||
throw GradleException(
|
||||
"Unsupported os/arch pair: ${buildInfo.os.name}/${buildInfo.targetArch}"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val checkNative by
|
||||
tasks.registering {
|
||||
group = "verification"
|
||||
dependsOn(testNative)
|
||||
}
|
||||
|
||||
val buildNative by
|
||||
tasks.registering {
|
||||
group = "build"
|
||||
dependsOn(assembleNative, checkNative)
|
||||
}
|
||||
@@ -145,3 +145,5 @@ endif::[]
|
||||
:uri-messagepack-spec: https://github.com/msgpack/msgpack/blob/master/spec.md
|
||||
|
||||
:uri-pkl-roadmap: https://github.com/orgs/apple/projects/12/views/1
|
||||
|
||||
:uri-sonatype-snapshot-download: https://s01.oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.pkl-lang&v={pkl-artifact-version}
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.pkl.core.ModuleSource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
// the pkl/pkl-examples repo has a similar example
|
||||
// the pkl-jvm-examples repo has a similar example
|
||||
public class JavaConfigExample {
|
||||
@Test
|
||||
public void usage() {
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
include::ROOT:partial$component-attributes.adoc[]
|
||||
:uri-pkl-codegen-java-maven-module: {uri-maven-docsite}/artifact/org.pkl-lang/pkl-codegen-java
|
||||
|
||||
:uri-pkl-codegen-java-download: {uri-sonatype-snapshot-download}&a=pkl-cli-codegen-java&e=jar
|
||||
|
||||
ifdef::is-release-version[]
|
||||
:uri-pkl-cli-codegen-java-download: {github-releases}/pkl-codegen-java
|
||||
endif::[]
|
||||
|
||||
The Java source code generator takes Pkl class definitions as an input, and generates corresponding Java classes with equally named properties.
|
||||
|
||||
The benefits of code generation are:
|
||||
@@ -103,8 +109,41 @@ endif::[]
|
||||
[[install-cli]]
|
||||
=== CLI
|
||||
|
||||
The CLI is bundled with the Java library.
|
||||
As we do not currently ship the CLI as a self-contained Jar, we recommend to provision it with a Maven compatible build tool as shown in <<install-library>>.
|
||||
The CLI is available as a Java executable.
|
||||
|
||||
It works on multiple platforms, and requires a Java 17 (or higher) runtime on the system path.
|
||||
|
||||
To download:
|
||||
|
||||
[tabs]
|
||||
====
|
||||
macOS/Linux::
|
||||
+
|
||||
[source,shell]
|
||||
[subs="+attributes"]
|
||||
----
|
||||
curl -L -o pkl-codegen-java '{uri-pkl-codegen-java-download}'
|
||||
chmod +x pkl-codegen-java
|
||||
./pkl-codegen-java --version
|
||||
----
|
||||
|
||||
Windows::
|
||||
+
|
||||
[source,PowerShell]
|
||||
[subs="+attributes"]
|
||||
----
|
||||
Invoke-WebRequest '{uri-pkl-codegen-java-download}' -OutFile pkl-codegen-java.bat
|
||||
.\pkl-codegen-java --version
|
||||
----
|
||||
====
|
||||
|
||||
This should print something similar to:
|
||||
|
||||
[source,shell]
|
||||
[subs="+attributes"]
|
||||
----
|
||||
pkl-codegen-java {pkl-version} (macOS 14.2, Java 17.0.10)
|
||||
----
|
||||
|
||||
[[codegen-java-usage]]
|
||||
== Usage
|
||||
@@ -123,10 +162,7 @@ For more information, refer to the Javadoc documentation.
|
||||
|
||||
=== CLI
|
||||
|
||||
As explained in <<install-cli,Installation>>, the CLI is bundled with the Java library.
|
||||
To run the CLI, execute the library Jar or its `org.pkl.codegen.java.Main` main class.
|
||||
|
||||
*Synopsis:* `java -cp <classpath> -jar pkl-codegen-java.jar [<options>] <modules>`
|
||||
*Synopsis:* `pkl-codegen-java [<options>] <modules>`
|
||||
|
||||
`<modules>`::
|
||||
The absolute or relative URIs of the modules to generate classes for.
|
||||
@@ -180,4 +216,4 @@ include::../../pkl-cli/partials/cli-common-options.adoc[]
|
||||
== Full Example
|
||||
|
||||
For a ready-to-go example with full source code,
|
||||
see link:{uri-codegen-java-example}[codegen-java] in the _pkl/pkl-examples_ repository.
|
||||
see link:{uri-codegen-java-example}[codegen-java] in the _pkl-jvm-examples_ repository.
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.pkl.config.kotlin.to
|
||||
import org.pkl.core.ModuleSource
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
// the pkl/pkl-examples repo has a similar example
|
||||
// the pkl-jvm-examples repo has a similar example
|
||||
class KotlinConfigExample {
|
||||
@Test
|
||||
fun usage() {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
= Kotlin Code Generator
|
||||
include::ROOT:partial$component-attributes.adoc[]
|
||||
:uri-pkl-codegen-kotlin-maven-module: {uri-maven-docsite}/artifact/org.pkl-lang/pkl-codegen-kotlin
|
||||
:uri-pkl-codegen-kotlin-download: {uri-sonatype-snapshot-download}&a=pkl-cli-codegen-kotlin&e=jar
|
||||
|
||||
ifdef::is-release-version[]
|
||||
:uri-pkl-codegen-kotlin-download: {github-releases}/pkl-codegen-kotlin
|
||||
endif::[]
|
||||
|
||||
The Kotlin source code generator reads Pkl classes and generates corresponding Kotlin classes with equally named properties.
|
||||
|
||||
@@ -83,8 +88,41 @@ To use the library in a Maven project, declare the following dependency:
|
||||
[[install-cli]]
|
||||
=== CLI
|
||||
|
||||
The CLI is bundled with the library.
|
||||
As we do not currently ship the CLI as a self-contained Jar, we recommend to provision it with a Maven compatible build tool as shown in <<install-library>>.
|
||||
The CLI is available as a Java executable.
|
||||
|
||||
It works on multiple platforms, and requires a Java 17 (or higher) runtime on the system path.
|
||||
|
||||
To download:
|
||||
|
||||
[tabs]
|
||||
====
|
||||
macOS/Linux::
|
||||
+
|
||||
[source,shell]
|
||||
[subs="+attributes"]
|
||||
----
|
||||
curl -L -o pkl-codegen-kotlin '{uri-pkl-codegen-kotlin-download}'
|
||||
chmod +x pkl-codegen-kotlin
|
||||
./pkl-codegen-kotlin --version
|
||||
----
|
||||
|
||||
Windows::
|
||||
+
|
||||
[source,PowerShell]
|
||||
[subs="+attributes"]
|
||||
----
|
||||
Invoke-WebRequest '{uri-pkl-codegen-kotlin-download}' -OutFile pkl-codegen-kotlin.bat
|
||||
.\pkl-codegen-kotlin --version
|
||||
----
|
||||
====
|
||||
|
||||
This should print something similar to:
|
||||
|
||||
[source,shell]
|
||||
[subs="+attributes"]
|
||||
----
|
||||
pkl-codegen-kotlin {pkl-version} (macOS 14.2, Java 17.0.10)
|
||||
----
|
||||
|
||||
[[usage]]
|
||||
== Usage
|
||||
@@ -103,10 +141,7 @@ For more information, refer to the KDoc documentation.
|
||||
|
||||
=== CLI
|
||||
|
||||
As mentioned in <<install-cli,Installation>>, the CLI is bundled with the library.
|
||||
To run the CLI, execute the library Jar or its `org.pkl.codegen.kotlin.Main` main class.
|
||||
|
||||
*Synopsis:* `java -cp <classpath> -jar pkl-codegen-kotlin.jar [<options>] <modules>`
|
||||
*Synopsis:* `pkl-codegen-kotlin [<options>] <modules>`
|
||||
|
||||
`<modules>`::
|
||||
The absolute or relative URIs of the modules to generate classes for.
|
||||
@@ -133,4 +168,4 @@ include::../../pkl-cli/partials/cli-common-options.adoc[]
|
||||
== Full Example
|
||||
|
||||
For a ready-to-go example with full source code,
|
||||
see link:{uri-codegen-kotlin-example}[codegen-kotlin] in the _pkl/pkl-examples_ repository.
|
||||
see link:{uri-codegen-kotlin-example}[codegen-kotlin] in the _pkl-jvm-examples_ repository.
|
||||
|
||||
@@ -116,7 +116,7 @@ include::{examplesdir}/KotlinConfigExample.kt[tags=nullable]
|
||||
Converting to `String` would result in a `ConversionException`.
|
||||
|
||||
For a ready-to-go example with full source code,
|
||||
see link:{uri-config-kotlin-example}[config-kotlin] in the _pkl/pkl-examples_ repository.
|
||||
see link:{uri-config-kotlin-example}[config-kotlin] in the _pkl-jvm-examples_ repository.
|
||||
|
||||
== Further Information
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ include::ROOT:partial$component-attributes.adoc[]
|
||||
:uri-homebrew: https://brew.sh
|
||||
:uri-mise: https://mise.jdx.dev
|
||||
|
||||
:uri-sonatype-snapshot-download: https://s01.oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.pkl-lang&v={pkl-artifact-version}
|
||||
:uri-pkl-macos-amd64-download: {uri-sonatype-snapshot-download}&a=pkl-cli-macos-amd64&e=bin
|
||||
:uri-pkl-macos-aarch64-download: {uri-sonatype-snapshot-download}&a=pkl-cli-macos-aarch64&e=bin
|
||||
:uri-pkl-linux-amd64-download: {uri-sonatype-snapshot-download}&a=pkl-cli-linux-amd64&e=bin
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.pkl.core.PModule;
|
||||
import org.pkl.core.PObject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
// the pkl/pkl-examples repo has a similar example
|
||||
// the pkl-jvm-examples repo has a similar example
|
||||
@SuppressWarnings({"unchecked", "unused", "ConstantConditions"})
|
||||
public class CoreEvaluatorExample {
|
||||
@Test
|
||||
|
||||
@@ -5,6 +5,23 @@ include::ROOT:partial$component-attributes.adoc[]
|
||||
:uri-DocPackageInfo: {uri-pkl-stdlib-docs}/DocPackageInfo/
|
||||
:uri-CliDocGenerator: {uri-pkl-doc-main-sources}/CliDocGenerator.kt
|
||||
:uri-DocGenerator: {uri-pkl-doc-main-sources}/DocGenerator.kt
|
||||
:uri-pkldoc-macos-amd64-download: {uri-sonatype-snapshot-download}&a=pkldoc-macos-amd64&e=bin
|
||||
:uri-pkldoc-macos-aarch64-download: {uri-sonatype-snapshot-download}&a=pkldoc-macos-aarch64&e=bin
|
||||
:uri-pkldoc-linux-amd64-download: {uri-sonatype-snapshot-download}&a=pkldoc-linux-amd64&e=bin
|
||||
:uri-pkldoc-linux-aarch64-download: {uri-sonatype-snapshot-download}&a=pkldoc-linux-aarch64&e=bin
|
||||
:uri-pkldoc-alpine-download: {uri-sonatype-snapshot-download}&a=pkldoc-alpine-linux-amd64&e=bin
|
||||
:uri-pkldoc-windows-download: {uri-sonatype-snapshot-download}&a=pkldoc-windows-amd64&e=exe
|
||||
:uri-pkldoc-java-download: {uri-sonatype-snapshot-download}&a=pkldoc-java&e=jar
|
||||
|
||||
ifdef::is-release-version[]
|
||||
:uri-pkldoc-macos-amd64-download: {github-releases}/pkldoc-macos-amd64
|
||||
:uri-pkldoc-macos-aarch64-download: {github-releases}/pkldoc-macos-aarch64
|
||||
:uri-pkldoc-linux-amd64-download: {github-releases}/pkldoc-linux-amd64
|
||||
:uri-pkldoc-linux-aarch64-download: {github-releases}/pkldoc-linux-aarch64
|
||||
:uri-pkldoc-alpine-download: {github-releases}/pkldoc-alpine-linux-amd64
|
||||
:uri-pkldoc-windows-download: {github-releases}/pkldoc-windows-amd64.exe
|
||||
:uri-pkldoc-java-download: {github-releases}/jpkldoc
|
||||
endif::[]
|
||||
|
||||
_Pkldoc_ is a documentation website generator that produces navigable and searchable API documentation for Pkl modules.
|
||||
|
||||
@@ -153,8 +170,33 @@ endif::[]
|
||||
[[install-cli]]
|
||||
=== CLI
|
||||
|
||||
The CLI is bundled with the library and does not currently ship as a native executable or a self-contained Jar.
|
||||
We recommend to provision it with a Maven compatible build tool as shown in <<install-library,Library Installation>>.
|
||||
The CLI comes in multiple flavors:
|
||||
|
||||
* Native macOS executable for amd64 (tested on macOS 10.15)
|
||||
* Native Linux executable for amd64
|
||||
* Native Linux executable for aarch64
|
||||
* Native Alpine Linux executable for amd64 (cross-compiled and tested on Oracle Linux 8)
|
||||
* Native Windows executable for amd64 (tested on Windows Server 2022)
|
||||
* Java executable (tested with Java 17/21 on macOS and Oracle Linux)
|
||||
|
||||
.What is the Difference Between the Linux and Alpine Linux Executables?
|
||||
[NOTE]
|
||||
====
|
||||
The Linux executable is dynamically linked against _glibc_ and _libstdc{plus}{plus}_,
|
||||
whereas, the Alpine Linux executable is statically linked against _musl libc_ and _libstdc{plus}{plus}_.
|
||||
====
|
||||
|
||||
The Java executable works on multiple platforms and has a smaller binary size than the native executables.
|
||||
However, it requires a Java 17 (or higher) runtime on the system path, and has a noticeable startup delay.
|
||||
|
||||
Download links:
|
||||
|
||||
* macOS aarch64: {uri-pkldoc-macos-aarch64-download}
|
||||
* macOS amd64: {uri-pkldoc-macos-amd64-download}
|
||||
* Linux aarch64: {uri-pkldoc-linux-aarch64-download}
|
||||
* Linux amd64: {uri-pkldoc-linux-amd64-download}
|
||||
* Alpine Linux amd64: {uri-pkldoc-alpine-download}
|
||||
* Windows amd64: {uri-pkldoc-windows-download}
|
||||
|
||||
[[usage]]
|
||||
== Usage
|
||||
@@ -216,10 +258,7 @@ For more information, refer to the Javadoc documentation.
|
||||
|
||||
=== CLI
|
||||
|
||||
As mentioned in <<install-cli,CLI Installation>>, the CLI is bundled with the library.
|
||||
To run the CLI, execute the library Jar or its `org.pkl.doc.Main` class.
|
||||
|
||||
*Synopsis:* `java -cp <classpath> -jar pkl-doc.jar [<options>] <modules>`
|
||||
*Synopsis:* `pkldoc [<options>] <modules>`
|
||||
|
||||
`<modules>`::
|
||||
The absolute or relative URIs of docsite descriptors, package descriptors, and the modules for which to generate documentation.
|
||||
@@ -252,4 +291,4 @@ include::../../pkl-cli/partials/cli-common-options.adoc[]
|
||||
== Full Example
|
||||
|
||||
For a ready-to-go example with full source code and detailed walkthrough,
|
||||
see link:{uri-pkldoc-example}[pkldoc] in the _pkl/pkl-examples_ repository.
|
||||
see link:{uri-pkldoc-example}[pkldoc] in the _pkl-jvm-examples_ repository.
|
||||
|
||||
@@ -134,7 +134,7 @@ $ ./gradlew evalPkl
|
||||
----
|
||||
|
||||
For a ready-to-go example with full source code,
|
||||
see link:{uri-build-eval-example}[codegen-java] in the _pkl/pkl-examples_ repository.
|
||||
see link:{uri-build-eval-example}[codegen-java] in the _pkl-jvm-examples_ repository.
|
||||
|
||||
=== Configuration Options
|
||||
|
||||
@@ -361,7 +361,7 @@ $ ./gradlew genJava
|
||||
----
|
||||
|
||||
For a ready-to-go example with full source code,
|
||||
see link:{uri-codegen-java-example}[codegen-java] in the _pkl/pkl-examples_ repository.
|
||||
see link:{uri-codegen-java-example}[codegen-java] in the _pkl-jvm-examples_ repository.
|
||||
|
||||
=== Configuration Options
|
||||
|
||||
@@ -451,7 +451,7 @@ $ ./gradlew genKotlin
|
||||
----
|
||||
|
||||
For a ready-to-go example with full source code,
|
||||
see link:{uri-codegen-kotlin-example}[codegen-kotlin] in the _pkl/pkl-examples_ repository.
|
||||
see link:{uri-codegen-kotlin-example}[codegen-kotlin] in the _pkl-jvm-examples_ repository.
|
||||
|
||||
=== Configuration Options
|
||||
|
||||
@@ -520,7 +520,7 @@ $ ./gradlew pkldoc
|
||||
----
|
||||
|
||||
For a ready-to-go example with full source code,
|
||||
see link:{uri-pkldoc-example}[pkldoc] in the _pkl/pkl-examples_ repository.
|
||||
see link:{uri-pkldoc-example}[pkldoc] in the _pkl-jvm-examples_ repository.
|
||||
|
||||
=== Configuration Options
|
||||
|
||||
|
||||
@@ -72,21 +72,15 @@ org.eclipse.jetty:jetty-util:11.0.24=testCompileClasspath,testImplementationDepe
|
||||
org.eclipse.jetty:jetty-webapp:11.0.24=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.eclipse.jetty:jetty-xml:11.0.24=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.fusesource.jansi:jansi:2.4.1=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.compiler:compiler:24.1.2=compileClasspath,compileOnlyDependenciesMetadata
|
||||
org.graalvm.nativeimage:native-image-base:24.1.2=compileClasspath,compileOnlyDependenciesMetadata
|
||||
org.graalvm.nativeimage:objectfile:24.1.2=compileClasspath,compileOnlyDependenciesMetadata
|
||||
org.graalvm.nativeimage:pointsto:24.1.2=compileClasspath,compileOnlyDependenciesMetadata
|
||||
org.graalvm.nativeimage:svm:24.1.2=compileClasspath,compileOnlyDependenciesMetadata
|
||||
org.graalvm.nativeimage:truffle-runtime-svm:24.1.2=compileClasspath,compileOnlyDependenciesMetadata
|
||||
org.graalvm.polyglot:polyglot:24.1.2=compileClasspath,compileOnlyDependenciesMetadata,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.sdk:collections:24.1.2=compileClasspath,compileOnlyDependenciesMetadata,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.sdk:graal-sdk:24.1.2=compileClasspath,compileOnlyDependenciesMetadata,runtimeClasspath,testRuntimeClasspath
|
||||
org.graalvm.sdk:jniutils:24.1.2=compileClasspath,compileOnlyDependenciesMetadata,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.sdk:jniutils:24.1.2=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.sdk:nativeimage:24.1.2=compileClasspath,compileOnlyDependenciesMetadata,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.sdk:word:24.1.2=compileClasspath,compileOnlyDependenciesMetadata,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.truffle:truffle-api:24.1.2=compileClasspath,compileOnlyDependenciesMetadata,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.truffle:truffle-compiler:24.1.2=compileClasspath,compileOnlyDependenciesMetadata,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.truffle:truffle-runtime:24.1.2=compileClasspath,compileOnlyDependenciesMetadata,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.truffle:truffle-api:24.1.2=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.truffle:truffle-compiler:24.1.2=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.truffle:truffle-runtime:24.1.2=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.hamcrest:hamcrest-core:2.2=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.hamcrest:hamcrest:2.2=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.intellij.deps:trove4j:1.0.20200330=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
|
||||
@@ -21,14 +21,15 @@ plugins {
|
||||
pklAllProjects
|
||||
pklKotlinLibrary
|
||||
pklPublishLibrary
|
||||
pklNativeBuild
|
||||
pklJavaExecutable
|
||||
pklNativeExecutable
|
||||
`maven-publish`
|
||||
|
||||
// already on build script class path (see buildSrc/build.gradle.kts),
|
||||
// hence must only specify plugin ID here
|
||||
@Suppress("DSL_SCOPE_VIOLATION") id(libs.plugins.shadow.get().pluginId)
|
||||
id(libs.plugins.shadow.get().pluginId)
|
||||
|
||||
@Suppress("DSL_SCOPE_VIOLATION") alias(libs.plugins.checksum)
|
||||
alias(libs.plugins.checksum)
|
||||
}
|
||||
|
||||
// make Java executable available to other subprojects
|
||||
@@ -45,16 +46,7 @@ publishing {
|
||||
}
|
||||
}
|
||||
|
||||
val stagedMacAmd64Executable: Configuration by configurations.creating
|
||||
val stagedMacAarch64Executable: Configuration by configurations.creating
|
||||
val stagedLinuxAmd64Executable: Configuration by configurations.creating
|
||||
val stagedLinuxAarch64Executable: Configuration by configurations.creating
|
||||
val stagedAlpineLinuxAmd64Executable: Configuration by configurations.creating
|
||||
val stagedWindowsAmd64Executable: Configuration by configurations.creating
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.svm)
|
||||
compileOnly(libs.truffleSvm)
|
||||
implementation(libs.truffleRuntime)
|
||||
compileOnly(libs.graalSdk)
|
||||
|
||||
@@ -73,15 +65,6 @@ dependencies {
|
||||
|
||||
testImplementation(projects.pklCommonsTest)
|
||||
testImplementation(libs.wiremock)
|
||||
|
||||
fun executableDir(name: String) = files(layout.buildDirectory.dir("executable/$name"))
|
||||
stagedMacAmd64Executable(executableDir("pkl-macos-amd64"))
|
||||
stagedMacAmd64Executable(executableDir("pkl-macos-amd64"))
|
||||
stagedMacAarch64Executable(executableDir("pkl-macos-aarch64"))
|
||||
stagedLinuxAmd64Executable(executableDir("pkl-linux-amd64"))
|
||||
stagedLinuxAarch64Executable(executableDir("pkl-linux-aarch64"))
|
||||
stagedAlpineLinuxAmd64Executable(executableDir("pkl-alpine-linux-amd64"))
|
||||
stagedWindowsAmd64Executable(executableDir("pkl-windows-amd64.exe"))
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
@@ -100,15 +83,6 @@ tasks.shadowJar {
|
||||
exclude("module-info.*")
|
||||
}
|
||||
|
||||
val javaExecutable by
|
||||
tasks.registering(ExecutableJar::class) {
|
||||
inJar.set(tasks.shadowJar.flatMap { it.archiveFile })
|
||||
outJar.set(layout.buildDirectory.file("executable/jpkl"))
|
||||
|
||||
// uncomment for debugging
|
||||
// jvmArgs.addAll("-ea", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005")
|
||||
}
|
||||
|
||||
val testJavaExecutable by
|
||||
tasks.registering(Test::class) {
|
||||
testClassesDirs = tasks.test.get().testClassesDirs
|
||||
@@ -116,7 +90,7 @@ val testJavaExecutable by
|
||||
// compiled test classes
|
||||
sourceSets.test.get().output +
|
||||
// java executable
|
||||
javaExecutable.get().outputs.files +
|
||||
tasks.javaExecutable.get().outputs.files +
|
||||
// test-only dependencies
|
||||
// (test dependencies that are also main dependencies must already be contained in java
|
||||
// executable;
|
||||
@@ -140,7 +114,7 @@ private fun setupJavaExecutableRun(
|
||||
configurator: Exec.() -> Unit = {},
|
||||
) =
|
||||
tasks.register(name, Exec::class) {
|
||||
dependsOn(javaExecutable)
|
||||
dependsOn(tasks.javaExecutable)
|
||||
val outputFile = layout.buildDirectory.file(name) // dummy output to satisfy up-to-date check
|
||||
outputs.file(outputFile)
|
||||
|
||||
@@ -151,7 +125,7 @@ private fun setupJavaExecutableRun(
|
||||
}
|
||||
standardOutput = OutputStream.nullOutputStream()
|
||||
|
||||
args("-jar", javaExecutable.get().outputs.files.singleFile.toString(), *args)
|
||||
args("-jar", tasks.javaExecutable.get().outputs.files.singleFile.toString(), *args)
|
||||
|
||||
doFirst { outputFile.get().asFile.delete() }
|
||||
|
||||
@@ -160,25 +134,6 @@ private fun setupJavaExecutableRun(
|
||||
configurator()
|
||||
}
|
||||
|
||||
// 0.14 Java executable was broken because javaExecutable.jvmArgs wasn't commented out.
|
||||
// To catch this and similar problems, test that Java executable starts successfully.
|
||||
val testStartJavaExecutable by
|
||||
setupJavaExecutableRun("testStartJavaExecutable", arrayOf("--version"))
|
||||
|
||||
// Setup `testStartJavaExecutable` tasks for multi-JDK testing.
|
||||
val testStartJavaExecutableOnOtherJdks =
|
||||
if (buildInfo.multiJdkTesting) {
|
||||
buildInfo.jdkTestRange.map { jdkTarget ->
|
||||
setupJavaExecutableRun(
|
||||
"testStartJavaExecutableJdk${jdkTarget.asInt()}",
|
||||
arrayOf("--version"),
|
||||
serviceOf<JavaToolchainService>().launcherFor { languageVersion = jdkTarget },
|
||||
)
|
||||
}
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
|
||||
val evalTestFlags = arrayOf("eval", "-x", "1 + 1", "pkl:base")
|
||||
|
||||
fun Exec.useRootDirAndSuppressOutput() {
|
||||
@@ -207,335 +162,35 @@ val testEvalJavaExecutableOnOtherJdks =
|
||||
tasks.check {
|
||||
dependsOn(
|
||||
testJavaExecutable,
|
||||
testStartJavaExecutable,
|
||||
testJavaExecutableOnOtherJdks,
|
||||
testStartJavaExecutableOnOtherJdks,
|
||||
testEvalJavaExecutable,
|
||||
testEvalJavaExecutableOnOtherJdks,
|
||||
)
|
||||
}
|
||||
|
||||
fun Exec.configureExecutable(
|
||||
graalVm: BuildInfo.GraalVm,
|
||||
outputFile: Provider<RegularFile>,
|
||||
extraArgs: List<String> = listOf(),
|
||||
) {
|
||||
inputs
|
||||
.files(sourceSets.main.map { it.output })
|
||||
.withPropertyName("mainSourceSets")
|
||||
.withPathSensitivity(PathSensitivity.RELATIVE)
|
||||
inputs
|
||||
.files(configurations.runtimeClasspath)
|
||||
.withPropertyName("runtimeClasspath")
|
||||
.withNormalizer(ClasspathNormalizer::class)
|
||||
val nativeImageCommandName = if (buildInfo.os.isWindows) "native-image.cmd" else "native-image"
|
||||
inputs
|
||||
.files(file(graalVm.baseDir).resolve("bin/$nativeImageCommandName"))
|
||||
.withPropertyName("graalVmNativeImage")
|
||||
.withPathSensitivity(PathSensitivity.ABSOLUTE)
|
||||
outputs.file(outputFile)
|
||||
outputs.cacheIf { true }
|
||||
|
||||
workingDir(outputFile.map { it.asFile.parentFile })
|
||||
executable = "${graalVm.baseDir}/bin/$nativeImageCommandName"
|
||||
|
||||
// For any system properties starting with `pkl.native`, strip off that prefix and pass the rest
|
||||
// through as arguments to native-image.
|
||||
//
|
||||
// Allow setting args using flags like
|
||||
// (-Dpkl.native-Dpolyglot.engine.userResourceCache=/my/cache/dir) when building through Gradle.
|
||||
val extraArgsFromProperties =
|
||||
System.getProperties()
|
||||
.filter { it.key.toString().startsWith("pkl.native") }
|
||||
.map { "${it.key}=${it.value}".substring("pkl.native".length) }
|
||||
|
||||
// JARs to exclude from the class path for the native-image build.
|
||||
val exclusions = listOf(libs.graalSdk).map { it.get().module.name }
|
||||
// https://www.graalvm.org/22.0/reference-manual/native-image/Options/
|
||||
argumentProviders.add(
|
||||
CommandLineArgumentProvider {
|
||||
buildList {
|
||||
// must be emitted before any experimental options are used
|
||||
add("-H:+UnlockExperimentalVMOptions")
|
||||
// currently gives a deprecation warning, but we've been told
|
||||
// that the "initialize everything at build time" *CLI* option is likely here to stay
|
||||
add("--initialize-at-build-time=")
|
||||
// needed for messagepack-java (see https://github.com/msgpack/msgpack-java/issues/600)
|
||||
add("--initialize-at-run-time=org.msgpack.core.buffer.DirectBufferAccess")
|
||||
add("--no-fallback")
|
||||
add("-H:IncludeResources=org/pkl/core/stdlib/.*\\.pkl")
|
||||
add("-H:IncludeResources=org/jline/utils/.*")
|
||||
add("-H:IncludeResourceBundles=org.pkl.core.errorMessages")
|
||||
add("-H:IncludeResources=org/pkl/commons/cli/PklCARoots.pem")
|
||||
add("-H:Class=org.pkl.cli.Main")
|
||||
add("-o")
|
||||
add(outputFile.get().asFile.name)
|
||||
// the actual limit (currently) used by native-image is this number + 1400 (idea is to
|
||||
// compensate for Truffle's own nodes)
|
||||
add("-H:MaxRuntimeCompileMethods=1800")
|
||||
add("-H:+EnforceMaxRuntimeCompileMethods")
|
||||
add("--enable-url-protocols=http,https")
|
||||
add("-H:+ReportExceptionStackTraces")
|
||||
// disable automatic support for JVM CLI options (puts our main class in full control of
|
||||
// argument parsing)
|
||||
add("-H:-ParseRuntimeOptions")
|
||||
// quick build mode: 40% faster compilation, 20% smaller (but presumably also slower)
|
||||
// executable
|
||||
if (!buildInfo.isReleaseBuild) {
|
||||
add("-Ob")
|
||||
}
|
||||
if (buildInfo.isNativeArch) {
|
||||
add("-march=native")
|
||||
} else {
|
||||
add("-march=compatibility")
|
||||
}
|
||||
// native-image rejects non-existing class path entries -> filter
|
||||
add("--class-path")
|
||||
val pathInput =
|
||||
sourceSets.main.get().output +
|
||||
configurations.runtimeClasspath.get().filter {
|
||||
it.exists() && !exclusions.any { exclude -> it.name.contains(exclude) }
|
||||
}
|
||||
add(pathInput.asPath)
|
||||
// make sure dev machine stays responsive (15% slowdown on my laptop)
|
||||
val processors =
|
||||
Runtime.getRuntime().availableProcessors() /
|
||||
if (buildInfo.os.isMacOsX && !buildInfo.isCiBuild) 4 else 1
|
||||
add("-J-XX:ActiveProcessorCount=${processors}")
|
||||
// Pass through all `HOMEBREW_` prefixed environment variables to allow build with shimmed
|
||||
// tools.
|
||||
addAll(environment.keys.filter { it.startsWith("HOMEBREW_") }.map { "-E$it" })
|
||||
addAll(extraArgs)
|
||||
addAll(extraArgsFromProperties)
|
||||
}
|
||||
}
|
||||
)
|
||||
tasks.checkNative {
|
||||
dependsOn(":pkl-core:checkNative")
|
||||
dependsOn(":pkl-server:checkNative")
|
||||
}
|
||||
|
||||
/** Builds the pkl CLI for macOS/amd64. */
|
||||
val macExecutableAmd64: TaskProvider<Exec> by
|
||||
tasks.registering(Exec::class) {
|
||||
dependsOn(":installGraalVmAmd64")
|
||||
configureExecutable(
|
||||
buildInfo.graalVmAmd64,
|
||||
layout.buildDirectory.file("executable/pkl-macos-amd64"),
|
||||
)
|
||||
}
|
||||
|
||||
/** Builds the pkl CLI for macOS/aarch64. */
|
||||
val macExecutableAarch64: TaskProvider<Exec> by
|
||||
tasks.registering(Exec::class) {
|
||||
dependsOn(":installGraalVmAarch64")
|
||||
configureExecutable(
|
||||
buildInfo.graalVmAarch64,
|
||||
layout.buildDirectory.file("executable/pkl-macos-aarch64"),
|
||||
listOf("-H:+AllowDeprecatedBuilderClassesOnImageClasspath"),
|
||||
)
|
||||
}
|
||||
|
||||
/** Builds the pkl CLI for linux/amd64. */
|
||||
val linuxExecutableAmd64: TaskProvider<Exec> by
|
||||
tasks.registering(Exec::class) {
|
||||
dependsOn(":installGraalVmAmd64")
|
||||
configureExecutable(
|
||||
buildInfo.graalVmAmd64,
|
||||
layout.buildDirectory.file("executable/pkl-linux-amd64"),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the pkl CLI for linux/aarch64.
|
||||
*
|
||||
* Right now, this is built within a container on Mac using emulation because CI does not have ARM
|
||||
* instances.
|
||||
*/
|
||||
val linuxExecutableAarch64: TaskProvider<Exec> by
|
||||
tasks.registering(Exec::class) {
|
||||
dependsOn(":installGraalVmAarch64")
|
||||
configureExecutable(
|
||||
buildInfo.graalVmAarch64,
|
||||
layout.buildDirectory.file("executable/pkl-linux-aarch64"),
|
||||
listOf(
|
||||
// Ensure compatibility for kernels with page size set to 4k, 16k and 64k
|
||||
// (e.g. Raspberry Pi 5, Asahi Linux)
|
||||
"-H:PageSize=65536"
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a statically linked CLI for linux/amd64.
|
||||
*
|
||||
* Note: we don't publish the same for linux/aarch64 because native-image doesn't support this.
|
||||
* Details: https://www.graalvm.org/22.0/reference-manual/native-image/ARM64/
|
||||
*/
|
||||
val alpineExecutableAmd64: TaskProvider<Exec> by
|
||||
tasks.registering(Exec::class) {
|
||||
dependsOn(":installGraalVmAmd64")
|
||||
configureExecutable(
|
||||
buildInfo.graalVmAmd64,
|
||||
layout.buildDirectory.file("executable/pkl-alpine-linux-amd64"),
|
||||
listOf("--static", "--libc=musl"),
|
||||
)
|
||||
}
|
||||
|
||||
val windowsExecutableAmd64: TaskProvider<Exec> by
|
||||
tasks.registering(Exec::class) {
|
||||
dependsOn(":installGraalVmAmd64")
|
||||
configureExecutable(
|
||||
buildInfo.graalVmAmd64,
|
||||
layout.buildDirectory.file("executable/pkl-windows-amd64"),
|
||||
listOf("-Dfile.encoding=UTF-8"),
|
||||
)
|
||||
}
|
||||
|
||||
tasks.assembleNative {
|
||||
when {
|
||||
buildInfo.os.isMacOsX -> {
|
||||
dependsOn(macExecutableAmd64)
|
||||
if (buildInfo.arch == "aarch64") {
|
||||
dependsOn(macExecutableAarch64)
|
||||
}
|
||||
}
|
||||
buildInfo.os.isWindows -> {
|
||||
dependsOn(windowsExecutableAmd64)
|
||||
}
|
||||
buildInfo.os.isLinux && buildInfo.arch == "aarch64" -> {
|
||||
dependsOn(linuxExecutableAarch64)
|
||||
}
|
||||
buildInfo.os.isLinux && buildInfo.arch == "amd64" -> {
|
||||
dependsOn(linuxExecutableAmd64)
|
||||
if (buildInfo.hasMuslToolchain) {
|
||||
dependsOn(alpineExecutableAmd64)
|
||||
}
|
||||
}
|
||||
}
|
||||
executable {
|
||||
name = "pkl"
|
||||
javaName = "jpkl"
|
||||
documentationName = "Pkl CLI"
|
||||
publicationName = "pkl-cli"
|
||||
javaPublicationName = "pkl-cli-java"
|
||||
mainClass = "org.pkl.cli.Main"
|
||||
website = "https://pkl-lang.org/main/current/pkl-cli/index.html"
|
||||
}
|
||||
|
||||
// make Java executable available to other subprojects
|
||||
// (we don't do the same for native executables because we don't want tasks assemble/build to build
|
||||
// them)
|
||||
artifacts {
|
||||
add("javaExecutable", javaExecutable.map { it.outputs.files.singleFile }) {
|
||||
add("javaExecutable", tasks.javaExecutable.map { it.outputs.files.singleFile }) {
|
||||
name = "pkl-cli-java"
|
||||
classifier = null
|
||||
extension = "jar"
|
||||
builtBy(javaExecutable)
|
||||
builtBy(tasks.javaExecutable)
|
||||
}
|
||||
}
|
||||
|
||||
// region Maven Publishing
|
||||
publishing {
|
||||
publications {
|
||||
register<MavenPublication>("javaExecutable") {
|
||||
artifactId = "pkl-cli-java"
|
||||
|
||||
artifact(javaExecutable.map { it.outputs.files.singleFile }) {
|
||||
classifier = null
|
||||
extension = "jar"
|
||||
builtBy(javaExecutable)
|
||||
}
|
||||
|
||||
pom {
|
||||
url.set("https://github.com/apple/pkl/tree/main/pkl-cli")
|
||||
description.set(
|
||||
"""
|
||||
Pkl CLI executable for Java.
|
||||
Can be executed directly, or with `java -jar <path/to/jpkl>`.
|
||||
Requires Java 17 or higher.
|
||||
"""
|
||||
.trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
create<MavenPublication>("macExecutableAmd64") {
|
||||
artifactId = "pkl-cli-macos-amd64"
|
||||
artifact(stagedMacAmd64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "bin"
|
||||
builtBy(stagedMacAmd64Executable)
|
||||
}
|
||||
pom {
|
||||
name.set("pkl-cli-macos-amd64")
|
||||
url.set("https://github.com/apple/pkl/tree/main/pkl-cli")
|
||||
description.set("Native Pkl CLI executable for macOS/amd64.")
|
||||
}
|
||||
}
|
||||
create<MavenPublication>("macExecutableAarch64") {
|
||||
artifactId = "pkl-cli-macos-aarch64"
|
||||
artifact(stagedMacAarch64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "bin"
|
||||
builtBy(stagedMacAarch64Executable)
|
||||
}
|
||||
pom {
|
||||
name.set("pkl-cli-macos-aarch64")
|
||||
url.set("https://github.com/apple/pkl/tree/main/pkl-cli")
|
||||
description.set("Native Pkl CLI executable for macOS/aarch64.")
|
||||
}
|
||||
}
|
||||
create<MavenPublication>("linuxExecutableAmd64") {
|
||||
artifactId = "pkl-cli-linux-amd64"
|
||||
artifact(stagedLinuxAmd64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "bin"
|
||||
builtBy(stagedLinuxAmd64Executable)
|
||||
}
|
||||
pom {
|
||||
name.set("pkl-cli-linux-amd64")
|
||||
url.set("https://github.com/apple/pkl/tree/main/pkl-cli")
|
||||
description.set("Native Pkl CLI executable for linux/amd64.")
|
||||
}
|
||||
}
|
||||
create<MavenPublication>("linuxExecutableAarch64") {
|
||||
artifactId = "pkl-cli-linux-aarch64"
|
||||
artifact(stagedLinuxAarch64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "bin"
|
||||
builtBy(stagedLinuxAarch64Executable)
|
||||
}
|
||||
pom {
|
||||
name.set("pkl-cli-linux-aarch64")
|
||||
url.set("https://github.com/apple/pkl/tree/main/pkl-cli")
|
||||
description.set("Native Pkl CLI executable for linux/aarch64.")
|
||||
}
|
||||
}
|
||||
create<MavenPublication>("alpineLinuxExecutableAmd64") {
|
||||
artifactId = "pkl-cli-alpine-linux-amd64"
|
||||
artifact(stagedAlpineLinuxAmd64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "bin"
|
||||
builtBy(stagedAlpineLinuxAmd64Executable)
|
||||
}
|
||||
pom {
|
||||
name.set("pkl-cli-alpine-linux-amd64")
|
||||
url.set("https://github.com/apple/pkl/tree/main/pkl-cli")
|
||||
description.set("Native Pkl CLI executable for linux/amd64 and statically linked to musl.")
|
||||
}
|
||||
}
|
||||
|
||||
create<MavenPublication>("windowsExecutableAmd64") {
|
||||
artifactId = "pkl-cli-windows-amd64"
|
||||
artifact(stagedWindowsAmd64Executable.singleFile) {
|
||||
classifier = null
|
||||
extension = "exe"
|
||||
builtBy(stagedWindowsAmd64Executable)
|
||||
}
|
||||
pom {
|
||||
name.set("pkl-cli-windows-amd64")
|
||||
url.set("https://github.com/apple/pkl/tree/main/pkl-cli")
|
||||
description.set("Native Pkl CLI executable for windows/amd64.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
sign(publishing.publications["javaExecutable"])
|
||||
sign(publishing.publications["linuxExecutableAarch64"])
|
||||
sign(publishing.publications["linuxExecutableAmd64"])
|
||||
sign(publishing.publications["macExecutableAarch64"])
|
||||
sign(publishing.publications["macExecutableAmd64"])
|
||||
sign(publishing.publications["alpineLinuxExecutableAmd64"])
|
||||
sign(publishing.publications["windowsExecutableAmd64"])
|
||||
} // endregion
|
||||
|
||||
@@ -75,4 +75,4 @@ org.opentest4j:opentest4j:1.2.0=testJdk17CompileClasspath,testJdk17Implementatio
|
||||
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
|
||||
org.organicdesign:Paguro:3.10.3=runtimeClasspath,testRuntimeClasspath
|
||||
org.snakeyaml:snakeyaml-engine:2.9=runtimeClasspath,testRuntimeClasspath
|
||||
empty=annotationProcessor,compileOnlyDependenciesMetadata,intransitiveDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDef,kotlinScriptDefExtensions,runtimeOnlyDependenciesMetadata,signatures,sourcesJar,testAnnotationProcessor,testApiDependenciesMetadata,testCompileOnlyDependenciesMetadata,testIntransitiveDependenciesMetadata,testJdk17AnnotationProcessor,testJdk17ApiDependenciesMetadata,testJdk17CompileOnlyDependenciesMetadata,testJdk17IntransitiveDependenciesMetadata,testJdk17KotlinScriptDefExtensions,testKotlinScriptDef,testKotlinScriptDefExtensions
|
||||
empty=annotationProcessor,compileOnlyDependenciesMetadata,intransitiveDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDef,kotlinScriptDefExtensions,runtimeOnlyDependenciesMetadata,shadow,signatures,sourcesJar,testAnnotationProcessor,testApiDependenciesMetadata,testCompileOnlyDependenciesMetadata,testIntransitiveDependenciesMetadata,testJdk17AnnotationProcessor,testJdk17ApiDependenciesMetadata,testJdk17CompileOnlyDependenciesMetadata,testJdk17IntransitiveDependenciesMetadata,testJdk17KotlinScriptDefExtensions,testKotlinScriptDef,testKotlinScriptDefExtensions
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@ plugins {
|
||||
pklAllProjects
|
||||
pklKotlinLibrary
|
||||
pklPublishLibrary
|
||||
pklJavaExecutable
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,6 +32,14 @@ dependencies {
|
||||
testImplementation(projects.pklCommonsTest)
|
||||
}
|
||||
|
||||
executable {
|
||||
javaName = "pkl-codegen-java"
|
||||
documentationName = "Pkl Codegen Java"
|
||||
javaPublicationName = "pkl-cli-codegen-java"
|
||||
mainClass = "org.pkl.codegen.java.Main"
|
||||
website = "https://pkl-lang.org/main/current/java-binding/codegen.html"
|
||||
}
|
||||
|
||||
// with `org.gradle.parallel=true` and without the line below, `test` strangely runs into:
|
||||
// java.lang.NoClassDefFoundError: Lorg/pkl/config/java/ConfigEvaluator;
|
||||
// perhaps somehow related to InMemoryJavaCompiler?
|
||||
|
||||
@@ -86,4 +86,4 @@ org.opentest4j:opentest4j:1.2.0=testJdk17CompileClasspath,testJdk17Implementatio
|
||||
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
|
||||
org.organicdesign:Paguro:3.10.3=runtimeClasspath,testRuntimeClasspath
|
||||
org.snakeyaml:snakeyaml-engine:2.9=runtimeClasspath,testRuntimeClasspath
|
||||
empty=annotationProcessor,compileOnlyDependenciesMetadata,intransitiveDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDef,kotlinScriptDefExtensions,runtimeOnlyDependenciesMetadata,signatures,sourcesJar,testAnnotationProcessor,testApiDependenciesMetadata,testCompileOnlyDependenciesMetadata,testIntransitiveDependenciesMetadata,testJdk17AnnotationProcessor,testJdk17ApiDependenciesMetadata,testJdk17CompileOnlyDependenciesMetadata,testJdk17IntransitiveDependenciesMetadata,testJdk17KotlinScriptDefExtensions,testKotlinScriptDef,testKotlinScriptDefExtensions
|
||||
empty=annotationProcessor,compileOnlyDependenciesMetadata,intransitiveDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDef,kotlinScriptDefExtensions,runtimeOnlyDependenciesMetadata,shadow,signatures,sourcesJar,testAnnotationProcessor,testApiDependenciesMetadata,testCompileOnlyDependenciesMetadata,testIntransitiveDependenciesMetadata,testJdk17AnnotationProcessor,testJdk17ApiDependenciesMetadata,testJdk17CompileOnlyDependenciesMetadata,testJdk17IntransitiveDependenciesMetadata,testJdk17KotlinScriptDefExtensions,testKotlinScriptDef,testKotlinScriptDefExtensions
|
||||
|
||||
@@ -17,6 +17,7 @@ plugins {
|
||||
pklAllProjects
|
||||
pklKotlinLibrary
|
||||
pklPublishLibrary
|
||||
pklJavaExecutable
|
||||
}
|
||||
|
||||
publishing {
|
||||
@@ -53,3 +54,11 @@ dependencies {
|
||||
testImplementation(projects.pklCommonsTest)
|
||||
testRuntimeOnly(libs.kotlinScripting)
|
||||
}
|
||||
|
||||
executable {
|
||||
javaName = "pkl-codegen-kotlin"
|
||||
documentationName = "Pkl Codegen Kotlin"
|
||||
javaPublicationName = "pkl-cli-codegen-kotlin"
|
||||
mainClass = "org.pkl.codegen.kotlin.Main"
|
||||
website = "https://pkl-lang.org/main/current/kotlin-binding/codegen.html"
|
||||
}
|
||||
|
||||
@@ -25,12 +25,21 @@ net.bytebuddy:byte-buddy:1.15.11=testCompileClasspath,testImplementationDependen
|
||||
net.java.dev.jna:jna:5.14.0=runtimeClasspath,testRuntimeClasspath
|
||||
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath,testImplementationDependenciesMetadata,testJdk17CompileClasspath,testJdk17ImplementationDependenciesMetadata,testRuntimeOnlyDependenciesMetadata
|
||||
org.assertj:assertj-core:3.27.3=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.polyglot:polyglot:24.1.2=runtimeClasspath,testRuntimeClasspath
|
||||
org.graalvm.sdk:collections:24.1.2=runtimeClasspath,testRuntimeClasspath
|
||||
org.graalvm.sdk:graal-sdk:24.1.2=runtimeClasspath,testRuntimeClasspath
|
||||
org.graalvm.sdk:nativeimage:24.1.2=runtimeClasspath,testRuntimeClasspath
|
||||
org.graalvm.sdk:word:24.1.2=runtimeClasspath,testRuntimeClasspath
|
||||
org.graalvm.truffle:truffle-api:24.1.2=runtimeClasspath,testRuntimeClasspath
|
||||
org.graalvm.compiler:compiler:24.1.2=svmClasspath
|
||||
org.graalvm.nativeimage:native-image-base:24.1.2=svmClasspath
|
||||
org.graalvm.nativeimage:objectfile:24.1.2=svmClasspath
|
||||
org.graalvm.nativeimage:pointsto:24.1.2=svmClasspath
|
||||
org.graalvm.nativeimage:svm:24.1.2=svmClasspath
|
||||
org.graalvm.nativeimage:truffle-runtime-svm:24.1.2=svmClasspath
|
||||
org.graalvm.polyglot:polyglot:24.1.2=runtimeClasspath,svmClasspath,testRuntimeClasspath
|
||||
org.graalvm.sdk:collections:24.1.2=runtimeClasspath,svmClasspath,testRuntimeClasspath
|
||||
org.graalvm.sdk:graal-sdk:24.1.2=runtimeClasspath,svmClasspath,testRuntimeClasspath
|
||||
org.graalvm.sdk:jniutils:24.1.2=svmClasspath
|
||||
org.graalvm.sdk:nativeimage:24.1.2=runtimeClasspath,svmClasspath,testRuntimeClasspath
|
||||
org.graalvm.sdk:word:24.1.2=runtimeClasspath,svmClasspath,testRuntimeClasspath
|
||||
org.graalvm.truffle:truffle-api:24.1.2=runtimeClasspath,svmClasspath,testRuntimeClasspath
|
||||
org.graalvm.truffle:truffle-compiler:24.1.2=svmClasspath
|
||||
org.graalvm.truffle:truffle-runtime:24.1.2=svmClasspath
|
||||
org.jetbrains.intellij.deps:trove4j:1.0.20200330=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-build-common:2.0.21=kotlinBuildToolsApiClasspath
|
||||
org.jetbrains.kotlin:kotlin-build-tools-api:2.0.21=kotlinBuildToolsApiClasspath
|
||||
@@ -42,16 +51,16 @@ org.jetbrains.kotlin:kotlin-daemon-embeddable:2.0.21=kotlinBuildToolsApiClasspat
|
||||
org.jetbrains.kotlin:kotlin-klib-commonizer-embeddable:2.0.21=kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-native-prebuilt:2.0.21=kotlinNativeBundleConfiguration
|
||||
org.jetbrains.kotlin:kotlin-reflect:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-script-runtime:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-scripting-common:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17
|
||||
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17
|
||||
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17
|
||||
org.jetbrains.kotlin:kotlin-scripting-jvm:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17
|
||||
org.jetbrains.kotlin:kotlin-script-runtime:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathSvm,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-scripting-common:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathSvm,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17
|
||||
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathSvm,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17
|
||||
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathSvm,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17
|
||||
org.jetbrains.kotlin:kotlin-scripting-jvm:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathSvm,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathSvm,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains:annotations:13.0=compileClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.jetbrains:annotations:13.0=compileClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathSvm,kotlinCompilerPluginClasspathTest,kotlinCompilerPluginClasspathTestJdk17,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.jetbrains:markdown-jvm:0.7.3=runtimeClasspath,testRuntimeClasspath
|
||||
org.jetbrains:markdown:0.7.3=implementationDependenciesMetadata,runtimeClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-api:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
|
||||
@@ -68,9 +77,9 @@ org.junit.platform:junit-platform-engine:1.8.2=testJdk17RuntimeClasspath
|
||||
org.junit.platform:junit-platform-launcher:1.8.2=testJdk17RuntimeClasspath
|
||||
org.junit:junit-bom:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
|
||||
org.junit:junit-bom:5.8.2=testJdk17CompileClasspath,testJdk17ImplementationDependenciesMetadata,testJdk17RuntimeClasspath
|
||||
org.msgpack:msgpack-core:0.9.8=runtimeClasspath,testRuntimeClasspath
|
||||
org.msgpack:msgpack-core:0.9.8=runtimeClasspath,svmClasspath,testRuntimeClasspath
|
||||
org.opentest4j:opentest4j:1.2.0=testJdk17CompileClasspath,testJdk17ImplementationDependenciesMetadata,testJdk17RuntimeClasspath
|
||||
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
|
||||
org.organicdesign:Paguro:3.10.3=runtimeClasspath,testRuntimeClasspath
|
||||
org.snakeyaml:snakeyaml-engine:2.9=runtimeClasspath,testRuntimeClasspath
|
||||
empty=annotationProcessor,compileOnlyDependenciesMetadata,intransitiveDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDef,kotlinScriptDefExtensions,runtimeOnlyDependenciesMetadata,signatures,sourcesJar,testAnnotationProcessor,testApiDependenciesMetadata,testCompileOnlyDependenciesMetadata,testIntransitiveDependenciesMetadata,testJdk17AnnotationProcessor,testJdk17ApiDependenciesMetadata,testJdk17CompileOnlyDependenciesMetadata,testJdk17IntransitiveDependenciesMetadata,testJdk17KotlinScriptDefExtensions,testKotlinScriptDef,testKotlinScriptDefExtensions
|
||||
org.organicdesign:Paguro:3.10.3=runtimeClasspath,svmClasspath,testRuntimeClasspath
|
||||
org.snakeyaml:snakeyaml-engine:2.9=runtimeClasspath,svmClasspath,testRuntimeClasspath
|
||||
empty=annotationProcessor,compileOnlyDependenciesMetadata,intransitiveDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDef,kotlinScriptDefExtensions,runtimeOnlyDependenciesMetadata,signatures,sourcesJar,svmAnnotationProcessor,svmApiDependenciesMetadata,svmCompileClasspath,svmCompileOnlyDependenciesMetadata,svmImplementationDependenciesMetadata,svmIntransitiveDependenciesMetadata,svmKotlinScriptDefExtensions,svmRuntimeClasspath,testAnnotationProcessor,testApiDependenciesMetadata,testCompileOnlyDependenciesMetadata,testIntransitiveDependenciesMetadata,testJdk17AnnotationProcessor,testJdk17ApiDependenciesMetadata,testJdk17CompileOnlyDependenciesMetadata,testJdk17IntransitiveDependenciesMetadata,testJdk17KotlinScriptDefExtensions,testKotlinScriptDef,testKotlinScriptDefExtensions
|
||||
|
||||
@@ -19,6 +19,11 @@ plugins {
|
||||
pklPublishLibrary
|
||||
}
|
||||
|
||||
val svmClasspath: Configuration by configurations.creating
|
||||
|
||||
// used by pklNativeExecutable.gradle.kts
|
||||
@Suppress("unused") val svm: SourceSet by sourceSets.creating { compileClasspath = svmClasspath }
|
||||
|
||||
dependencies {
|
||||
api(projects.pklCore)
|
||||
api(libs.clikt)
|
||||
@@ -26,6 +31,10 @@ dependencies {
|
||||
|
||||
implementation(projects.pklCommons)
|
||||
testImplementation(projects.pklCommonsTest)
|
||||
|
||||
svmClasspath(libs.svm)
|
||||
svmClasspath(libs.truffleSvm)
|
||||
svmClasspath(projects.pklCore)
|
||||
}
|
||||
|
||||
publishing {
|
||||
|
||||
@@ -30,7 +30,11 @@ private val theme = Theme { styles["markdown.code.span"] = TextStyle(bold = true
|
||||
fun <T : BaseCliktCommand<T>> T.installCommonOptions() {
|
||||
installMordantMarkdown()
|
||||
|
||||
versionOption(Release.current().versionInfo, names = setOf("-v", "--version"), message = { it })
|
||||
versionOption(
|
||||
Release.current().versionInfo,
|
||||
names = setOf("-v", "--version"),
|
||||
message = { if (commandName == "pkl") it else it.replaceFirst("Pkl", commandName) },
|
||||
)
|
||||
|
||||
context { terminal = Terminal(theme = theme) }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.pkl.cli.svm;
|
||||
package org.pkl.commons.cli.svm;
|
||||
|
||||
import org.graalvm.nativeimage.hosted.Feature;
|
||||
import org.pkl.core.runtime.BaseModule;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.pkl.cli.svm;
|
||||
package org.pkl.commons.cli.svm;
|
||||
|
||||
import com.oracle.svm.core.annotate.Alias;
|
||||
import com.oracle.svm.core.annotate.RecomputeFieldValue;
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.pkl.cli.svm;
|
||||
package org.pkl.commons.cli.svm;
|
||||
|
||||
import com.oracle.svm.core.annotate.Alias;
|
||||
import com.oracle.svm.core.annotate.RecomputeFieldValue;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.pkl.cli.svm;
|
||||
package org.pkl.commons.cli.svm;
|
||||
|
||||
import com.oracle.svm.core.annotate.TargetClass;
|
||||
import com.oracle.svm.truffle.TruffleFeature;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.pkl.cli.svm;
|
||||
package org.pkl.commons.cli.svm;
|
||||
|
||||
import com.oracle.svm.core.annotate.Alias;
|
||||
import com.oracle.svm.core.annotate.RecomputeFieldValue;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.pkl.cli.svm;
|
||||
package org.pkl.commons.cli.svm;
|
||||
|
||||
import com.oracle.svm.core.annotate.TargetClass;
|
||||
import com.oracle.svm.truffle.TruffleFeature;
|
||||
@@ -20,7 +20,7 @@ plugins {
|
||||
pklAllProjects
|
||||
pklJavaLibrary
|
||||
pklPublishLibrary
|
||||
pklNativeBuild
|
||||
pklNativeLifecycle
|
||||
idea
|
||||
}
|
||||
|
||||
@@ -175,28 +175,17 @@ val testWindowsExecutableAmd64 by
|
||||
configureExecutableTest("WindowsLanguageSnippetTestsEngine")
|
||||
}
|
||||
|
||||
tasks.testNative {
|
||||
when {
|
||||
buildInfo.os.isMacOsX -> {
|
||||
dependsOn(testMacExecutableAmd64)
|
||||
if (buildInfo.arch == "aarch64") {
|
||||
dependsOn(testMacExecutableAarch64)
|
||||
}
|
||||
}
|
||||
buildInfo.os.isLinux && buildInfo.arch == "aarch64" -> {
|
||||
dependsOn(testLinuxExecutableAarch64)
|
||||
}
|
||||
buildInfo.os.isLinux && buildInfo.arch == "amd64" -> {
|
||||
dependsOn(testLinuxExecutableAmd64)
|
||||
if (buildInfo.hasMuslToolchain) {
|
||||
dependsOn(testAlpineExecutableAmd64)
|
||||
}
|
||||
}
|
||||
buildInfo.os.isWindows -> {
|
||||
dependsOn(testWindowsExecutableAmd64)
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.testNativeMacOsAarch64 { dependsOn(testMacExecutableAarch64) }
|
||||
|
||||
tasks.testNativeMacOsAmd64 { dependsOn(testMacExecutableAmd64) }
|
||||
|
||||
tasks.testNativeLinuxAarch64 { dependsOn(testLinuxExecutableAarch64) }
|
||||
|
||||
tasks.testNativeLinuxAmd64 { dependsOn(testLinuxExecutableAmd64) }
|
||||
|
||||
tasks.testNativeAlpineLinuxAmd64 { dependsOn(testAlpineExecutableAmd64) }
|
||||
|
||||
tasks.testNativeWindowsAmd64 { dependsOn(testWindowsExecutableAmd64) }
|
||||
|
||||
tasks.clean {
|
||||
delete("generated/")
|
||||
|
||||
@@ -119,4 +119,4 @@ org.opentest4j:opentest4j:1.2.0=testJdk17CompileClasspath,testJdk17Implementatio
|
||||
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
|
||||
org.organicdesign:Paguro:3.10.3=runtimeClasspath,testRuntimeClasspath
|
||||
org.snakeyaml:snakeyaml-engine:2.9=runtimeClasspath,testRuntimeClasspath
|
||||
empty=annotationProcessor,compileOnlyDependenciesMetadata,intransitiveDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDef,kotlinScriptDefExtensions,runtimeOnlyDependenciesMetadata,signatures,sourcesJar,testAnnotationProcessor,testApiDependenciesMetadata,testCompileOnlyDependenciesMetadata,testIntransitiveDependenciesMetadata,testJdk17AnnotationProcessor,testJdk17ApiDependenciesMetadata,testJdk17CompileOnlyDependenciesMetadata,testJdk17IntransitiveDependenciesMetadata,testJdk17KotlinScriptDefExtensions,testKotlinScriptDef,testKotlinScriptDefExtensions
|
||||
empty=annotationProcessor,compileOnlyDependenciesMetadata,intransitiveDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDef,kotlinScriptDefExtensions,runtimeOnlyDependenciesMetadata,shadow,signatures,sourcesJar,stagedAlpineLinuxAmd64Executable,stagedLinuxAarch64Executable,stagedLinuxAmd64Executable,stagedMacAarch64Executable,stagedMacAmd64Executable,stagedWindowsAmd64Executable,testAnnotationProcessor,testApiDependenciesMetadata,testCompileOnlyDependenciesMetadata,testIntransitiveDependenciesMetadata,testJdk17AnnotationProcessor,testJdk17ApiDependenciesMetadata,testJdk17CompileOnlyDependenciesMetadata,testJdk17IntransitiveDependenciesMetadata,testJdk17KotlinScriptDefExtensions,testKotlinScriptDef,testKotlinScriptDefExtensions
|
||||
|
||||
@@ -16,12 +16,22 @@
|
||||
plugins {
|
||||
pklAllProjects
|
||||
pklKotlinLibrary
|
||||
pklPublishLibrary
|
||||
pklJavaExecutable
|
||||
pklNativeExecutable
|
||||
pklHtmlValidator
|
||||
@Suppress("DSL_SCOPE_VIOLATION") // https://youtrack.jetbrains.com/issue/KTIJ-19369
|
||||
alias(libs.plugins.kotlinxSerialization)
|
||||
}
|
||||
|
||||
executable {
|
||||
mainClass = "org.pkl.doc.Main"
|
||||
name = "pkldoc"
|
||||
javaName = "jpkldoc"
|
||||
documentationName = "Pkldoc CLI"
|
||||
publicationName = "pkldoc"
|
||||
javaPublicationName = "jpkldoc"
|
||||
website = "https://pkl-lang.org/main/current/pkl-doc/index.html"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.pklCore)
|
||||
implementation(projects.pklCommonsCli)
|
||||
|
||||
@@ -17,7 +17,7 @@ plugins {
|
||||
pklAllProjects
|
||||
pklJavaLibrary
|
||||
pklKotlinLibrary
|
||||
pklNativeBuild
|
||||
pklNativeLifecycle
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -82,27 +82,14 @@ val testWindowsExecutableAmd64 by
|
||||
configureNativeTest()
|
||||
}
|
||||
|
||||
val testNative by tasks.existing
|
||||
tasks.testNativeMacOsAarch64 { dependsOn(testMacExecutableAarch64) }
|
||||
|
||||
testNative {
|
||||
when {
|
||||
buildInfo.os.isMacOsX -> {
|
||||
dependsOn(testMacExecutableAmd64)
|
||||
if (buildInfo.arch == "aarch64") {
|
||||
dependsOn(testMacExecutableAarch64)
|
||||
}
|
||||
}
|
||||
buildInfo.os.isWindows -> {
|
||||
dependsOn(testWindowsExecutableAmd64)
|
||||
}
|
||||
buildInfo.os.isLinux && buildInfo.arch == "aarch64" -> {
|
||||
dependsOn(testLinuxExecutableAarch64)
|
||||
}
|
||||
buildInfo.os.isLinux && buildInfo.arch == "amd64" -> {
|
||||
dependsOn(testLinuxExecutableAmd64)
|
||||
if (buildInfo.hasMuslToolchain) {
|
||||
dependsOn(testAlpineExecutableAmd64)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.testNativeMacOsAmd64 { dependsOn(testMacExecutableAmd64) }
|
||||
|
||||
tasks.testNativeLinuxAarch64 { dependsOn(testLinuxExecutableAarch64) }
|
||||
|
||||
tasks.testNativeLinuxAmd64 { dependsOn(testLinuxExecutableAmd64) }
|
||||
|
||||
tasks.testNativeAlpineLinuxAmd64 { dependsOn(testAlpineExecutableAmd64) }
|
||||
|
||||
tasks.testNativeWindowsAmd64 { dependsOn(testWindowsExecutableAmd64) }
|
||||
|
||||
@@ -66,7 +66,10 @@ val javadocJar by
|
||||
archiveClassifier.set("javadoc")
|
||||
}
|
||||
|
||||
tasks.shadowJar { archiveBaseName.set("pkl-tools-all") }
|
||||
tasks.shadowJar {
|
||||
dependsOn(":pkl-doc:shadowJar")
|
||||
archiveBaseName.set("pkl-tools-all")
|
||||
}
|
||||
|
||||
private fun Exec.configureTestStartFatJar(launcher: Provider<JavaLauncher>) {
|
||||
dependsOn(tasks.shadowJar)
|
||||
|
||||
Reference in New Issue
Block a user