flora is a fast and secure runtime that lets you write discord bots for your servers, with a rich TypeScript SDK, without worrying about running infrastructure. [mirror]
Buck2 (Rust/V8)#
This repository includes a Buck2 setup for Rust builds of:
apps/runtime(floralib + bin)crates/flora_configcrates/flora_macroscrates/flora_typegen
Prerequisites#
buck2- Rust toolchain (
cargo,rustc) - For V8 source-mode builds:
gn,ninja,python3,clang/libclang(for bindgen)
Dependency Snapshot Sync#
Update Cargo metadata snapshot used by Buck2 tooling:
buck2 run //tools/buck:sync_rust_deps
# or directly:
tools/buck/sync_rust_deps.sh
Buckify third-party crates with Reindeer (for Buck-native Rust dependency graph migration):
./x buckify-rust-deps
# or directly:
tools/buck/buckify_rust_deps.sh
Reindeer config: third-party/reindeer.toml.
Important:
third-party/rust/vendorandthird-party/rust/.cargoare generated-local and not committed.tools/buck/sync_rust_deps.shupdates snapshots only (cargo-metadata.json,Cargo.lock.snapshot) and does not rewrite generatedthird-party/rust/BUCK2.
Helper Script#
From repo root:
# build runtime dev
./x build-dev
# build runtime release path
./x build-release
# runtime dev run
./x run-dev
# runtime release run
./x run-release
# snapshot Cargo metadata for Buck tooling
./x sync-rust-deps
# reindeer vendor + buckify
./x buckify-rust-deps
./x normalizes BINDGEN_EXTRA_CLANG_ARGS when needed (nix clang wrapper case).
Add/Update Rust Dependencies#
Use this flow whenever you add or update crates:
# 1) update manifests, then refresh lockfile
cargo check
# 2) refresh Buck snapshots
./x sync-rust-deps
# 3) regenerate reindeer Buck third-party rules
./x buckify-rust-deps
# 4) sanity-check Buck build
buck2 build //apps/runtime:flora_lib
If reindeer is missing:
nix profile install nixpkgs#reindeer
Build Targets#
# runtime (default V8 mode)
buck2 build //apps/runtime:flora_bin
# runtime release binary
buck2 build //apps/runtime:flora_bin_release
# runtime library
buck2 build //apps/runtime:flora_lib
# runtime with source V8 build path
buck2 build //apps/runtime:flora_bin_v8_source
# support crates
buck2 build //crates/flora_config:flora_config
buck2 build //crates/flora_macros:flora_macros
buck2 build //crates/flora_typegen:flora_typegen
# aggregate
buck2 build //:build_all_rust
Check/Test Targets#
buck2 build //:check_rust
buck2 build //:test_rust
V8 Source Mode#
Use //apps/runtime:flora_bin_v8_source when changing submodules/rusty_v8.
Common env before building:
export V8_FROM_SOURCE=1
export LIBCLANG_PATH=/usr/lib/llvm-19/lib
export GN=/usr/bin/gn
export NINJA=/usr/bin/ninja
export PYTHON=python3
The flora_bin_v8_source target already forces V8_FROM_SOURCE=1 for that build action.
Notes#
- Buck2 here is local/dev focused; CI integration is intentionally out of scope.
- Cargo remains source-of-truth for dependency resolution and lockfile state.