| Add a justfile f7c3825 nandithebull yesterday | 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 | |
| Add a WebAssembly backend for the example 728acaa nandithebull yesterday | 10 | # Port for `just web`. Override with WEB_PORT=9000 just web |
| 11 | web_port := env_var_or_default("WEB_PORT", "8080") |
| 12 | |
| Add a justfile f7c3825 nandithebull yesterday | 13 | _default: |
| 14 | @just --list |
| 15 | |
| 16 | # Run the Mandelbrot explorer. |
| 17 | mandelbrot: build |
| 18 | cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} run -d linux |
| 19 | |
| 20 | # Alias: the example app is the Mandelbrot explorer. |
| 21 | run: mandelbrot |
| 22 | |
| 23 | # Build the host V library into build/ (-gc none -prod) and check its exports. |
| 24 | build: |
| 25 | ./tool/build.sh |
| 26 | |
| 27 | # Compile the V source to C for iOS/macOS. Run after editing src/vflutter.v. |
| 28 | gen-ios: |
| 29 | ./tool/gen_ios_sources.sh |
| 30 | |
| Add a WebAssembly backend for the example 728acaa nandithebull yesterday | 31 | # emcc is not installed: tool/bin/emcc is a DotSlash file that fetches a |
| 32 | # content-pinned emscripten on first run and caches it in ~/.cache/dotslash. |
| 33 | # Only `dotslash` itself needs to be on PATH. |
| 34 | # |
| 35 | # Compile the V source to WebAssembly for the web build. |
| 36 | wasm: |
| 37 | ./tool/build_wasm.sh |
| 38 | |
| 39 | # Headless check of the wasm module — no browser, no Flutter. |
| 40 | test-wasm: wasm |
| 41 | node tool/test_wasm.mjs |
| 42 | |
| 43 | # Same frame from the wasm and native kernels, compared byte for byte. |
| 44 | parity: build wasm |
| 45 | ./tool/check_parity.sh |
| 46 | |
| 47 | # Prints a URL and waits; no browser is launched. Hot restart still works |
| 48 | # (press R). Override the port with WEB_PORT=9000 just web |
| 49 | # |
| 50 | # Serve the Mandelbrot explorer, with V running as wasm. |
| 51 | web: wasm |
| 52 | cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} run -d web-server --web-port={{web_port}} |
| 53 | |
| 54 | # Release web build of the example. Output: example/build/web/ |
| 55 | build-web: wasm |
| 56 | cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} build web --release |
| 57 | |
| 58 | # Load the built web app in headless Chrome and assert V drew a real frame. |
| 59 | check-web: build-web |
| 60 | ./tool/check_web.sh |
| 61 | |
| Add a justfile f7c3825 nandithebull yesterday | 62 | # Analyze and test the example. Needs the host library for the FFI calls. |
| 63 | test: build |
| 64 | cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} analyze |
| 65 | cd example && LD_LIBRARY_PATH="{{lib_path}}" PATH="{{flutter_bin}}:$PATH" {{flutter}} test |
| 66 | |
| 67 | # V vs Dart timings for the same frame (AOT, so it matches a release app). |
| 68 | bench: build |
| 69 | dart compile exe example/lib/fractal_bench.dart -o /tmp/vflutter_bench |
| 70 | LD_LIBRARY_PATH="{{lib_path}}" /tmp/vflutter_bench |
| 71 | |
| Raise the isolate ceiling to 32, and add the sweep that justifies it 59a731a nandithebull yesterday | 72 | # Sweep the isolate count to find the best band split for this machine. |
| 73 | sweep: build |
| 74 | dart compile exe example/lib/tile_sweep.dart -o /tmp/vflutter_sweep |
| 75 | LD_LIBRARY_PATH="{{lib_path}}" /tmp/vflutter_sweep |
| 76 | |
| Add a justfile f7c3825 nandithebull yesterday | 77 | # String round-trip and isolate dispatch. No Flutter SDK required. |
| 78 | smoke: build |
| 79 | LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/main_test.dart |
| 80 | |
| 81 | # RSS regression guard for the -gc none ownership rule. No Flutter SDK required. |
| 82 | memcheck: build |
| 83 | LD_LIBRARY_PATH="{{lib_path}}" dart example/lib/memory_check.dart |
| 84 | |
| 85 | # Release build of the example. |
| 86 | release: build |
| 87 | cd example && PATH="{{flutter_bin}}:$PATH" {{flutter}} build linux --release |
| 88 | |
| 89 | # Everything CI would run. |
| Add a WebAssembly backend for the example 728acaa nandithebull yesterday | 90 | ci: build smoke memcheck test bench test-wasm parity check-web |
| Add a justfile f7c3825 nandithebull yesterday | 91 | |
| 92 | clean: |
| Add a WebAssembly backend for the example 728acaa nandithebull yesterday | 93 | rm -rf build example/build example/web/vflutter.js example/web/vflutter.wasm |