build(swift): include all source files

This commit is contained in:
Lucas Marçal 2025-01-05 20:40:27 -03:00 committed by Amaan Qureshi
parent 767b5486c6
commit 28d5272e71
3 changed files with 17 additions and 1 deletions

View file

@ -14,7 +14,15 @@ let package = Package(
targets: [
.target(name: "TreeSitter",
path: "lib",
sources: ["src/lib.c"],
exclude: [
"src/unicode/ICU_SHA",
"src/unicode/README.md",
"src/unicode/LICENSE",
"src/wasm/stdlib-symbols.txt",
"src/lib.c",
],
sources: ["src"],
publicHeadersPath: "include",
cSettings: [
.headerSearchPath("src"),
.define("_POSIX_C_SOURCE", to: "200112L"),

View file

@ -3,6 +3,8 @@
// as needed, and freeing is mostly a noop. But in the special case of freeing
// the last-allocated pointer, we'll reuse that pointer again.
#ifdef TREE_SITTER_FEATURE_WASM
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@ -107,3 +109,5 @@ void *realloc(void *ptr, size_t new_size) {
memcpy(result, &region->data, region->size);
return result;
}
#endif

View file

@ -1,3 +1,5 @@
#ifdef TREE_SITTER_FEATURE_WASM
unsigned char STDLIB_WASM[] = {
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x1e, 0x06, 0x60,
0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x60, 0x01, 0x7f, 0x00, 0x60, 0x00, 0x00,
@ -1308,3 +1310,5 @@ unsigned char STDLIB_WASM[] = {
0x74
};
unsigned int STDLIB_WASM_LEN = 15673;
#endif