Skip to content

Commit

Permalink
build(swift): include all source files
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLucasMarcal authored and amaanq committed Jan 6, 2025
1 parent 767b548 commit 28d5272
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
4 changes: 4 additions & 0 deletions lib/src/wasm/stdlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -107,3 +109,5 @@ void *realloc(void *ptr, size_t new_size) {
memcpy(result, &region->data, region->size);
return result;
}

#endif
4 changes: 4 additions & 0 deletions lib/src/wasm/wasm-stdlib.h
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -1308,3 +1310,5 @@ unsigned char STDLIB_WASM[] = {
0x74
};
unsigned int STDLIB_WASM_LEN = 15673;

#endif

0 comments on commit 28d5272

Please sign in to comment.