Skip to content

Commit 46db74a

Browse files
KushalPbioball
andcommitted
Introduce C library for Pkl
This introduces native C bindings for Pkl. This uses native-image to generate a C library for Pkl. This generated library from native-image is wrapped with our own library, in `pkl.h`. This produces a static and a dynamic library for each os/arch variant that Pkl currently supports. Co-authored-by: Dan Chao <daniel.h.chao@gmail.com>
1 parent 8c5bd3b commit 46db74a

File tree

64 files changed

+3526
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3526
-333
lines changed

.circleci/config.pkl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import "jobs/DeployJob.pkl"
2121
import "jobs/GradleCheckJob.pkl"
2222
import "jobs/SimpleGradleJob.pkl"
2323

24-
local prbJobs: Listing<String> = gradleCheckJobs.keys.toListing()
24+
local prbJobs: Listing<String> = (gradleCheckJobs.keys + buildNativeJobs.keys.filter((it) -> it.startsWith("libpkl") && it.endsWith("snapshot"))).toListing()
2525

2626
local buildAndTestJobs = (prbJobs) {
2727
"bench"
@@ -81,14 +81,15 @@ triggerPackageDocsBuild = "release"
8181

8282
local buildNativeJobs: Mapping<String, BuildNativeJob> = new {
8383
for (_dist in List("release", "snapshot")) {
84-
for (_project in List("pkl-cli", "pkl-doc")) {
84+
for (_project in List("pkl-cli", "pkl-doc", "libpkl")) {
8585
for (_arch in List("amd64", "aarch64")) {
8686
for (_os in List("macOS", "linux")) {
8787
["\(_project)-\(_os)-\(_arch)-\(_dist)"] {
8888
arch = _arch
8989
os = _os
9090
isRelease = _dist == "release"
9191
project = _project
92+
buildDir = if (_project == "libpkl") "libpkl/build/native-libs/" else "\(_project)/build/executable/"
9293
}
9394
}
9495
}
@@ -98,12 +99,14 @@ local buildNativeJobs: Mapping<String, BuildNativeJob> = new {
9899
musl = true
99100
isRelease = _dist == "release"
100101
project = _project
102+
buildDir = if (_project == "libpkl") "libpkl/build/native-libs/" else "\(_project)/build/executable/"
101103
}
102104
["\(_project)-windows-amd64-\(_dist)"] {
103105
arch = "amd64"
104106
os = "windows"
105107
isRelease = _dist == "release"
106108
project = _project
109+
buildDir = if (_project == "libpkl") "libpkl/build/native-libs/" else "\(_project)/build/executable/"
107110
}
108111
}
109112
}

0 commit comments

Comments
 (0)