You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.adoc
+19-4Lines changed: 19 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,8 @@ This is a basic HTTP server that is configured via Pkl in the `pkl/` directory.
6
6
7
7
== Requirements
8
8
9
-
* Swift +5.9
10
-
* Pkl +0.25.0
9
+
* Swift +6.1
10
+
* Pkl +0.30.0;s
11
11
12
12
== Project structure
13
13
@@ -23,7 +23,10 @@ This is a basic HTTP server that is configured via Pkl in the `pkl/` directory.
23
23
| Generated Swift sources from Pkl
24
24
25
25
| `Sources/App/`
26
-
| Swift files
26
+
| Swift files for runtime evaluation example
27
+
28
+
| `Sources/BuildTimeEval/`
29
+
| Swift files for build-time evaluation example
27
30
|===
28
31
29
32
== Codegen
@@ -45,6 +48,18 @@ With that installed, generate Swift sources via:
45
48
pkl-gen-swift pkl/**.pkl -o Sources/Gen
46
49
----
47
50
51
+
== Build-time evaluation
52
+
53
+
The example in `Sources/BuildTimeEval/` shows how the https://pkl-lang.org/main/current/bindings-specification/binary-encoding.html[`pkl-binary` encoding] can be used to configure applications.
54
+
This mechanism separates evaluation of Pkl code from application runtime by encoding the configuration data as `pkl-binary`, storing it in a file, and loading it later during application startup.
55
+
This example works identically to the runtime evaluation example, but does not require the application to spawn the Pkl CLI as a subprocess.
56
+
57
+
The configuration module is rendered as `pkl-binary` by running:
��Config�:file:///Users/jbasch/src/pkl-swift-examples/pkl/Config.pkl���hostname�localhost��port����tcpNoDelayÓ�backlog̀��serverName�Pkl Swift Example Server
0 commit comments