Skip to content

Commit 9e04094

Browse files
committed
fix: node, wasm and zig build
Signed-off-by: Peefy <[email protected]>
1 parent 49a50a8 commit 9e04094

File tree

10 files changed

+19
-1366
lines changed

10 files changed

+19
-1366
lines changed

nodejs/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ npm-debug.log*
99
yarn-debug.log*
1010
yarn-error.log*
1111
lerna-debug.log*
12+
pnpm-lock.yaml
1213

1314
# Diagnostic reports (https://nodejs.org/api/report.html)
1415
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
@@ -121,7 +122,7 @@ dist
121122
.AppleDouble
122123
.LSOverride
123124

124-
# Icon must end with two
125+
# Icon must end with two
125126
Icon
126127

127128

nodejs/pnpm-lock.yaml

Lines changed: 0 additions & 1352 deletions
This file was deleted.

swift/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extern crate kcl_api;
22

3-
#[no_mangle]
3+
#[unsafe(no_mangle)]
44
pub extern "C" fn callNative(
55
name_ptr: *const u8,
66
name_len: usize,

wasm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ npm install
8989
### Building
9090

9191
```shell
92-
npm run compile
92+
npm run build
9393
```
9494

9595
### Testing

wasm/examples/go/pkg/module/module.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func New(path string) (*KCLModule, error) {
4242
}
4343
linker := wasmtime.NewLinker(engine)
4444
err = linker.DefineWasi()
45-
linker.FuncWrap("env", "kcl_plugin_invoke_json_wasm", func(_name int32, _args int32, _kwargs int32) int32 {
45+
linker.FuncWrap("env", "kclvm_plugin_invoke_json_wasm", func(_name int32, _args int32, _kwargs int32) int32 {
4646
return 0
4747
})
4848
if err != nil {

wasm/examples/rust/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl KCLModule {
5353
let mut linker: Linker<State> = Linker::new(&engine);
5454
linker.func_wrap(
5555
"env",
56-
"kcl_plugin_invoke_json_wasm",
56+
"kclvm_plugin_invoke_json_wasm",
5757
|_caller: Caller<'_, State>, _name: i32, _args: i32, _kwargs: i32| 0,
5858
)?;
5959
preview1::add_to_linker_sync(&mut linker, |my_state| &mut my_state.wasi)?;

wasm/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"prettier": "^2.8.4"
2424
},
2525
"devDependencies": {
26+
"@jest/globals": "^30.2.0",
2627
"@types/jest": "^29.5.12",
2728
"@types/node": "^20.12.0",
2829
"jest": "^29.7.0",

wasm/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export async function load(opts?: KCLWasmLoadOptions) {
9393

9494
const imports = {
9595
env: {
96-
kcl_plugin_invoke_json_wasm: (
96+
kclvm_plugin_invoke_json_wasm: (
9797
_method: number,
9898
_args: number,
9999
_kwargs: number

zig/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This repo is under development, PRs welcome!
66

77
### Prerequisites
88

9-
+ Zig 0.13.0+
9+
+ Zig 0.15.0+
1010

1111
### Build and Test
1212

zig/build.zig

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ pub fn build(b: *std.Build) void {
1919

2020
const lib = b.addLibrary(.{
2121
.name = "kcl_lib_zig",
22-
.root_source_file = b.path("src/root.zig"),
23-
.target = target,
24-
.optimize = optimize,
25-
.kind = .static,
22+
.root_module = b.createModule(.{
23+
.root_source_file = b.path("src/root.zig"),
24+
.target = b.graph.host,
25+
.optimize = optimize,
26+
}),
2627
});
2728

2829
lib.linkLibC();
@@ -43,9 +44,11 @@ pub fn build(b: *std.Build) void {
4344
// Creates a step for unit testing. This only builds the test executable
4445
// but does not run it.
4546
const lib_unit_tests = b.addTest(.{
46-
.root_source_file = b.path("src/root.zig"),
47-
.target = target,
48-
.optimize = optimize,
47+
.root_module = b.createModule(.{
48+
.root_source_file = b.path("src/root.zig"),
49+
.target = b.graph.host,
50+
.optimize = optimize,
51+
}),
4952
});
5053

5154
lib_unit_tests.linkLibC();

0 commit comments

Comments
 (0)