Linux command
dune 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Build the project
dune build
Run tests
dune test
Run an executable
dune exec [program]
Clean build artifacts
dune clean
Build and watch for changes
dune build --watch
Format code
dune fmt
Create new project
dune init project [name]
说明
Dune is the standard build system for OCaml and Reason projects. It automatically discovers project structure, handles dependencies, and provides fast incremental builds with caching. Projects are configured with dune files using an S-expression syntax. Dune integrates with opam for package management and supports cross-compilation, multiple build contexts, and IDE integration.
参数
- build _targets_
- Build specified targets or all.
- test
- Run tests.
- exec _program_
- Build and execute program.
- clean
- Remove build artifacts.
- init _component_ _name_
- Initialize new component (project, library, executable, test).
- fmt
- Format source code using ocamlformat.
- promote
- Promote expected test outputs.
- cache
- Manage the shared build artifact cache.
- install
- Install packages defined in the project.
- --watch, -w
- Rebuild continuously on file changes.
- --force
- Force rebuild of all targets.
- --verbose
- Display full command lines of executed programs.
FAQ
What is the dune command used for?
Dune is the standard build system for OCaml and Reason projects. It automatically discovers project structure, handles dependencies, and provides fast incremental builds with caching. Projects are configured with dune files using an S-expression syntax. Dune integrates with opam for package management and supports cross-compilation, multiple build contexts, and IDE integration.
How do I run a basic dune example?
Run `dune build` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does build _targets_ do in dune?
Build specified targets or all.