nandi/vflutter_ffipublic Fork 0
f7c3825
Commits
Clone
git clone https://git.rickub.com/nandi/vflutter_ffi.git
git clone ssh://git@rickub.com/nandi/vflutter_ffi.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Add a justfile

Running anything here meant remembering that Flutter is not on PATH and that
the headless checks need LD_LIBRARY_PATH pointing at the host build. Both are
now encoded, with the native library as a dependency of every recipe that
needs it, so `just mandelbrot` works from a clean tree.

FLUTTER_BIN overrides the assumed ~/flutter/bin.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandithebull committed 2026-09-18T16:14:46-07:00 Browse files
f7c3825 parent: 81540bb
modified README.md +14 -0
@@ -60,6 +60,20 @@ Ownership across the boundary: **V allocates, Dart copies, V frees.** The Dart
6060 wrapper in `lib/vflutter_ffi.dart` does the `vf_free` in a `finally`, so callers
6161 never hold a pointer and never leak.
6262
63+## Quick start
64+
65+With [`just`](https://github.com/casey/just):
66+
67+```
68+just mandelbrot # build the V library and run the fractal explorer
69+just test # analyze + the example's test suite
70+just bench # V vs Dart timings for the same frame
71+just --list # everything else
72+```
73+
74+Flutter is expected at `~/flutter/bin`; set `FLUTTER_BIN` if yours lives
75+elsewhere.
76+
6377 ## Usage
6478
6579 ```dart
@@ -60,6 +60,20 @@ Ownership across the boundary: **V allocates, Dart copies, V frees.** The Dart
60 wrapper in `lib/vflutter_ffi.dart` does the `vf_free` in a `finally`, so callers60 wrapper in `lib/vflutter_ffi.dart` does the `vf_free` in a `finally`, so callers
61 never hold a pointer and never leak.61 never hold a pointer and never leak.
62 62
63+## Quick start
64+
65+With [`just`](https://github.com/casey/just):
66+
67+```
68+just mandelbrot # build the V library and run the fractal explorer
69+just test # analyze + the example's test suite
70+just bench # V vs Dart timings for the same frame
71+just --list # everything else
72+```
73+
74+Flutter is expected at `~/flutter/bin`; set `FLUTTER_BIN` if yours lives
75+elsewhere.
76+
63 ## Usage77 ## Usage
64 78
65 ```dart79 ```dart
modified example/README.md +6 -0
@@ -39,6 +39,12 @@ in V, not because C-via-V is expected to outrun Dart AOT on arithmetic.
3939
4040 ## Run it
4141
42+```bash
43+just mandelbrot
44+```
45+
46+or, driving Flutter yourself:
47+
4248 ```bash
4349 cd example
4450 flutter run -d linux
@@ -39,6 +39,12 @@ in V, not because C-via-V is expected to outrun Dart AOT on arithmetic.
39 39
40 ## Run it40 ## Run it
41 41
42+```bash
43+just mandelbrot
44+```
45+
46+or, driving Flutter yourself:
47+
42 ```bash48 ```bash
43 cd example49 cd example
44 flutter run -d linux50 flutter run -d linux
added justfile +54 -0
new file mode 100644
@@ -0,0 +1,54 @@
1+# vflutter_ffi — V logic, Flutter front end.
2+#
3+# Flutter is not assumed to be on PATH: set FLUTTER_BIN if yours lives
4+# somewhere other than ~/flutter/bin.
5+
6+flutter_bin := env_var_or_default("FLUTTER_BIN", env_var("HOME") / "flutter/bin")
7+flutter := flutter_bin / "flutter"
8+lib_path := justfile_directory() / "build"
9+
10+_default:
11+ @just --list
12+
13+# Run the Mandelbrot explorer.
14+mandelbrot: build
15+ cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} run -d linux
16+
17+# Alias: the example app is the Mandelbrot explorer.
18+run: mandelbrot
19+
20+# Build the host V library into build/ (-gc none -prod) and check its exports.
21+build:
22+ ./tool/build.sh
23+
24+# Compile the V source to C for iOS/macOS. Run after editing src/vflutter.v.
25+gen-ios:
26+ ./tool/gen_ios_sources.sh
27+
28+# Analyze and test the example. Needs the host library for the FFI calls.
29+test: build
30+ cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} analyze
31+ cd example && LD_LIBRARY_PATH="{{lib_path}}" PATH="{{flutter_bin}}:$PATH" {{flutter}} test
32+
33+# V vs Dart timings for the same frame (AOT, so it matches a release app).
34+bench: build
35+ dart compile exe example/lib/fractal_bench.dart -o /tmp/vflutter_bench
36+ LD_LIBRARY_PATH="{{lib_path}}" /tmp/vflutter_bench
37+
38+# String round-trip and isolate dispatch. No Flutter SDK required.
39+smoke: build
40+ LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/main_test.dart
41+
42+# RSS regression guard for the -gc none ownership rule. No Flutter SDK required.
43+memcheck: build
44+ LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/memory_check.dart
45+
46+# Release build of the example.
47+release: build
48+ cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} build linux --release
49+
50+# Everything CI would run.
51+ci: build smoke memcheck test bench
52+
53+clean:
54+ rm -rf build example/build
new file mode 100644
@@ -0,0 +1,54 @@
1+# vflutter_ffi — V logic, Flutter front end.
2+#
3+# Flutter is not assumed to be on PATH: set FLUTTER_BIN if yours lives
4+# somewhere other than ~/flutter/bin.
5+
6+flutter_bin := env_var_or_default("FLUTTER_BIN", env_var("HOME") / "flutter/bin")
7+flutter := flutter_bin / "flutter"
8+lib_path := justfile_directory() / "build"
9+
10+_default:
11+ @just --list
12+
13+# Run the Mandelbrot explorer.
14+mandelbrot: build
15+ cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} run -d linux
16+
17+# Alias: the example app is the Mandelbrot explorer.
18+run: mandelbrot
19+
20+# Build the host V library into build/ (-gc none -prod) and check its exports.
21+build:
22+ ./tool/build.sh
23+
24+# Compile the V source to C for iOS/macOS. Run after editing src/vflutter.v.
25+gen-ios:
26+ ./tool/gen_ios_sources.sh
27+
28+# Analyze and test the example. Needs the host library for the FFI calls.
29+test: build
30+ cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} analyze
31+ cd example && LD_LIBRARY_PATH="{{lib_path}}" PATH="{{flutter_bin}}:$PATH" {{flutter}} test
32+
33+# V vs Dart timings for the same frame (AOT, so it matches a release app).
34+bench: build
35+ dart compile exe example/lib/fractal_bench.dart -o /tmp/vflutter_bench
36+ LD_LIBRARY_PATH="{{lib_path}}" /tmp/vflutter_bench
37+
38+# String round-trip and isolate dispatch. No Flutter SDK required.
39+smoke: build
40+ LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/main_test.dart
41+
42+# RSS regression guard for the -gc none ownership rule. No Flutter SDK required.
43+memcheck: build
44+ LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/memory_check.dart
45+
46+# Release build of the example.
47+release: build
48+ cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} build linux --release
49+
50+# Everything CI would run.
51+ci: build smoke memcheck test bench
52+
53+clean:
54+ rm -rf build example/build