build command runs the full Refractor pipeline: compiles your Dart source to kernel bytecode, applies obfuscation passes defined in refractor.yaml, and outputs the result in your chosen format.
Usage
Options
Input Dart file or directory to compile. Specify the entrypoint of your application.Short flag:
-iOutput directory path. The final artifact will be written as
build/out.<extension> where the extension depends on the target type.Short flag: -oTarget format to build for. Determines the output file type and compilation strategy.Short flag:
-tAllowed values:exe- Standalone executable (no extension)aot- AOT snapshot (.aotextension)jit- JIT snapshot (.jitextension)kernel- Kernel bytecode only (.dillextension)
Build Pipeline
The build command executes these steps:Load Configuration
Reads
refractor.yaml from the current directory. The build will fail if this file is missing or malformed.Compile to Kernel
Compiles the input Dart file to kernel bytecode (
.dill format) using dart compile kernel.Apply Obfuscation Passes
Processes the kernel bytecode with each enabled pass:
- Rename - Rewrites identifiers to short meaningless names
- String Encryption - XOR-encodes string literals with runtime decoder
- Dead Code Injection - Inserts unreachable branches
Compile to Target
Compiles the obfuscated kernel to the specified target format using
dart compile <target>.Examples
Build Executable (Default)
Compile to a standalone executable:build/out (executable file)
Build Kernel Only
Compile to obfuscated kernel bytecode without final compilation:build/out.dill
Build AOT Snapshot
Generate an ahead-of-time compiled snapshot:dist/out.aot
Custom Input File
Build from a different entrypoint:build/server/out
Build JIT Snapshot
Create a just-in-time compiled snapshot:build/out.jit
Output
On success, the command prints:- Creates the output directory if it doesn’t exist
- Writes the symbol map to the path specified in
refractor.yaml - Returns exit code
0on success
Related Commands
refractor init
Generate a starter configuration file
refractor inspect
Inspect the contents of a .dill file