Introduce C library for Pkl (#1238)

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: Kushal Pisavadia <kushal.p@apple.com>
Co-authored-by: Jen Basch <jbasch94@gmail.com>
Co-authored-by: Islon Scherer <i_desouzascherer@apple.com>
This commit is contained in:
Daniel Chao
2026-07-25 04:15:26 +00:00
committed by GitHub
co-authored by Kushal Pisavadia Jen Basch Islon Scherer
parent 175e2b6273
commit 67df676359
51 changed files with 4982 additions and 349 deletions
@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2026 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.
@@ -24,7 +24,7 @@ public interface MessageTransport extends AutoCloseable {
}
interface RequestHandler {
void handleRequest(Message.Request msg) throws ProtocolException, IOException;
void handleRequest(Message.Request msg) throws ProtocolException;
}
interface ResponseHandler {
@@ -123,7 +123,7 @@ public final class MessageTransports {
}
}
protected abstract static class AbstractMessageTransport implements MessageTransport {
public abstract static class AbstractMessageTransport implements MessageTransport {
private final Logger logger;
private MessageTransport.OneWayHandler oneWayHandler =
@@ -151,7 +151,7 @@ public final class MessageTransports {
protected abstract void doSend(Message message) throws ProtocolException, IOException;
protected void accept(Message message) throws ProtocolException, IOException {
protected void accept(Message message) throws ProtocolException {
log("Received message: {0}", message);
if (message instanceof Message.OneWay msg) {
oneWayHandler.handleOneWay(msg);