DUNE-RULES(1)
π dune-rules(1) β Dune Manual π
okay bestie, pull up a chair, because this is the dune-rules page from the Dune Manual and we are going to vibe our way through every single flag together. no skipping, no skimming, we're doing this properly. π
β¨ NAME β¨
dune-rules β Dump rules. that's it. that's the whole name. short, iconic, does exactly what it says on the tin. π
πΈ SYNOPSIS πΈ
dune rules [OPTION]β¦ [TARGET]β¦
literally just dune rules, some options if you want, some targets if you want. she's flexible like that. π¦
π DESCRIPTION π
so what this does is dump Dune rules for whatever targets you hand her. and if you hand her no targets? she dumps all the rules. all of them. every last one. she's an overachiever, we love her for it. π
With --deps, she only prints the dependencies of the matching rules. just the receipts of what each rule depends on, nothing else. no extra baggage. minimalism queen. β¨
By default the output is a list of S-expressions, one S-expression per rule. and each S-expression is giving exactly this shape:
((deps (<dependencies>))
(targets (<targets>))
(context <context-name>)
(action <action>))
now let's break that down because it matters:
<context-name>is the context in which the action is executed. it gets omitted if the action is independent from the context β she's not gonna include a field that doesn't apply, that's just clutter. π<action>is the action, following the same syntax as user actions, as described in the manual. same syntax, same rules, iykyk.
and if S-expressions aren't your thing? use --format=json to dump the same data as JSON. same tea, different cup. π
π OPTIONS π
here we go bestie, the big list. every single one. no cap. π
--action-stderr-on-success=VALβ same as--action-stdout-on-successbut for standard error instead of standard output. and ngl, the pros recommend this combo for large mono-repositories:--action-stdout-on-success=swallowtogether with--action-stderr-on-success=must-be-empty. why? because it ensures that a successful build has a "clean", empty output. tidy. immaculate. β¨--action-stdout-on-success=VALβ tells Dune how to deal with the standard output of actions when they succeed. the possible values are:printto just print it to Dune's output,swallowto completely ignore it, andmust-be-emptyto enforce that the action printed nothing. withmust-be-empty, Dune will consider that the action failed if it printed something to its standard output. so likeβ¦ dramatic much, but effective. π the default isprint.--build-infoβ show build information. that's it. she's showing off her build lore. π«Ά--depsβ only print the dependencies of matching rules. just the deps, bestie, nothing more. π--display-separate-messagesβ separate error messages with a blank line. breathing room for your errors. she's considerate like that. πΈ--error-reporting=VAL(absent=deterministic) β controls when the build errors get reported. here's the tea:earlyreports errors as soon as they are discovered. instant. no waiting.deterministicreports errors at the end of the build, in a deterministic order. this is the default, she likes a tidy queue.twicereports each error twice: once as soon as it's discovered, and then again at the end of the build, in a deterministic order. double the drama, double the info. π
-f,--forceβ force actions associated to aliases to be re-executed even if their dependencies haven't changed. she said run it again and she means it. π₯--file-watcher=VAL(absent=automatic) β the mechanism to detect changes in the source.automaticmakes dune run an external program to detect changes.manualmeans you notify dune that files have changed, manually, by hand, yourself. main character energy, you're in charge. π--format=FORMAT(absent=sexp) βFORMATmust be eithersexporjson. pick your aesthetic. π-o FILEβ output to a file instead of stdout. take it to go. π--passive-watch-modeβ similar to[--watch], but she only starts a build when instructed externally by an RPC. so she's waiting. patiently. on you. π¦-r,--recursiveβ print all rules needed to build the transitive dependencies of the given targets. go deeper. go recursive. π--sandbox=VAL(absentDUNE_SANDBOXenv) β set the sandboxing mode. heads up: some actions require a certain sandboxing mode, so they will ignore this setting. the allowed values are:none,symlink,copy,hardlink. pick your containment strategy bestie. π--stop-on-first-errorβ stop the build as soon as an error is encountered. no need to see the rest, we're done here, thank u next. β-w,--watchβ instead of terminating the build after completion, wait continuously for file changes. she lives here now. she's not leaving. π«Ά--wait-for-filesystem-clockβ okay this one needs setup. Dune digests file contents for better incrementality (yes, it's a word, moving on). these digests are themselves cached. in some cases, Dune needs to drop some digest cache entries in order for things to be reliable. this option makes Dune wait for the file system clock to advance so that it doesn't need to drop anything. and, direct quote from the page: you should probably not care about this option. it's mostly useful for Dune developers to make Dune tests of the digest cache more reproducible. so if that's not youβ¦ it's not you. π
π okay that's part 1! more parts are coming, so don't go anywhere bestie β we're not done. β¨
π COMMON OPTIONS π
okay bestie these ones are the β¨universalβ¨ options, the ones that every single command shares. same energy, every time. π
--always-show-command-lineβ literally always show the full command lines of the programs dune runs. no hiding, we see everything. π--auto-promoteβ auto-promotes files for you, kind of like runningdune promoteright after the build. self-care honestly. β¨--build-dir=FILE(absent βDUNE_BUILD_DIRenv) β the build directory you want. if you don't say anything it's_build, the classic.--cache=VAL(absent βDUNE_CACHEenv) β turn the Dune cache on or off. valid values aredisabled,enabled-except-user-rulesorenabled. the default isenabled-except-user-rules. π--cache-check-probability=VAL(absent βDUNE_CACHE_CHECK_PROBABILITYenv) β checks build reproducibility by re-executing randomly chosen rules and comparing what they produce with what's stored in the Dune cache. β οΈ heads up: cranking up the probability of these checks slows your build down. default probability is zero, meaning literally no rules get checked.--cache-storage-mode=VAL(absent βDUNE_CACHE_STORAGE_MODEenv) β the Dune cache storage mode, one ofauto,hardlinkorcopy. default ishardlink.--config-file=FILEβ load this config file instead of the default one. main character config file energy. π--debug-backtracesβ always print exception backtraces. no mystery crashes, we get receipts. π§Ύ--debug-dependency-pathβ when something errors, print the dependency path from the targets on the command line all the way to the rule that failed. it's giving detective work π--debug-package-logs(absent βDUNE_DEBUG_PACKAGE_LOGSenv) β always print the standard logs when building packages.--default-target=TARGET(absent=@@default) β set the default target, the one that gets used when you don't givedune buildany target at all.--diff-command=VAL(absent βDUNE_DIFF_COMMANDenv) β the shell command used to diff files. use-to disable printing the diff entirely, no diff no drama.--disable-promotion(absent βDUNE_DISABLE_PROMOTIONenv) β disables all promotion rules. periodt. π«--display=MODEβ controls what dune shows you. seedune-config(5)for the deets. valid values areprogress,verbose,short,quietortui.--dump-gc-stats=FILEβ dumps the garbage collector stats into a file once the build is done. gc tea β--help[=FMT](default=auto) β shows this help in format FMT. FMT has to be one ofauto,pager,grofforplain. withauto, the format ends up beingpagerorplainwhenever theTERMenv var isdumbor undefined.--ignore-promoted-rulesβ ignores rules with(mode promote), except the ones with(only ...). the variable%{ignoring_promoted_rules}in dune files reflects whether you passed this option or not. iykyk π--instrument-with=BACKENDS(absent βDUNE_INSTRUMENT_WITHenv) β enables instrumentation by BACKENDS. BACKENDS is a comma-separated list of library names, and each one of them has to declare an instrumentation backend.-j JOBS(absent βDUNE_JOBSenv) β run no more than JOBS commands at the same time. JOBS must be a positive integer, orautoto auto-detect the number of cores (that's the default, bestie π).--no-bufferβ do not buffer the output of commands that dune executes. by default dune buffers subcommand output so nothing interleaves while multiple commands run in parallel. but deadass that can be a whole problem when you're debugging long-running tests π with--no-buffer, commands get direct access to the terminal. note that as a result, their output won't be captured in the log file. you should use this option together with-j 1, to avoid interleaving. and additionally you should use--verbosetoo, to make sure commands are printed before they're executed.--no-configβ do not load the configuration file. simple as that. π--no-print-directoryβ suppresses those "Entering directory" messages. shhh, we're sneaky π€«--only-packages=PACKAGESβ ignores stanzas referring to a package that isn't in PACKAGES. PACKAGES is a comma-separated list of package names. note that this has the same effect as deleting the relevant stanzas from dune files. it's mostly meant for releases. during development, what you probably want instead is to build a particular<package>.installtarget.-p PACKAGES,--for-release-of-packages=PACKAGES(required) β shorthand for--release --pkg=disabled --only-packages PACKAGE. you must use this option in your<package>.opamfiles, so that only what's necessary gets built when your project has multiple packages β and so you also get reproducible builds. crucial π―--pkg=VALβ enable or disable package management. the default behaviour depends on whether a lock directory exists.--profile=VAL(absent βDUNE_PROFILEenv) β pick your build profile, for instancedevorrelease. default isdev.--promote-install-files[=VAL](default=true) β promotes any generated<package>.installfiles to the source tree. β¨--releaseβ puts dune into a reproducible release mode. shorthand for--root . --ignore-promoted-rules --no-config --profile release --always-show-command-line --promote-install-files --require-dune-project-file --default-target @install. you should use this for release builds. for instance, you must use it in your<package>.opamfiles β except if you already use-p, since-pimplies this option. slay but responsibly π--require-dune-project-file[=VAL](default=true) β fail if adune-projectfile is missing. no file, no vibes. π--root=DIR(absent βDUNE_ROOTenv) β use this directory as the workspace root instead of guessing it. note that this option does not change how targets given on the command line are interpreted. it's only intended for scripts.--store-orig-source-dir(absent βDUNE_STORE_ORIG_SOURCE_DIRenv) β stores the original source location indune-packagemetadata. π--target-exec=TOOLCHAIN=CMD(absent βDUNE_TARGET_EXECenv) β a wrapper command for running target binaries when cross-compiling. format:TOOLCHAIN=CMD(e.g.,'windows=wine').--terminal-persistence=MODEβ changes how the log of build results is displayed to the console between rebuilds while you're in--watchmode. supported modes:preserve,clear-on-rebuild,clear-on-rebuild-and-flush-history.--trace-file=FILEβ outputs trace data in catapult format (compatible withchrome://tracing). pretty graphs bestie π--verboseβ same as--display verbose.--versionβ shows version information. π--watch-exclusions=REGEXβ adds a POSIX regular expression that will exclude matching directories fromdune build --watch. you can repeat--watch-exclusionsto add multiple exclusions, and semicolons work as a separator too. if you don't provide any exclusions, a standard set of exclusions is used; however, if you use one or more--watch-exclusions, none of the standard exclusions apply. the standard exclusions are:^_opam /_opam ^_esy /_esy ^\.#.* /\.#.* ~$ ^#[^#]*#$ /#[^#]*#$ ^4913$ /4913$ /.git /.hg :/windows--workspace=FILE(absent βDUNE_WORKSPACEenv) β use this specific workspace file instead of looking one up.-x VAL(absent βDUNE_CROSS_TARGETenv) β cross-compile using this toolchain. π₯
π¦ MORE HELP π¦
want help on just one command? so valid of you. use dune COMMAND --help. that's it, that's the whole section. π
β¨ EXIT STATUS β¨
dune rules exits with:
0β on success. we ate. π1β if an error happened. π130β if it was interrupted by a signal.
πΈ ENVIRONMENT πΈ
these environment variables affect the execution of rules, bestie:
DUNE_BUILD_DIRβ specified build directory._buildif unspecified.DUNE_CACHEβ enable or disable Dune cache (one ofdisabled,enabled-except-user-rulesorenabled). default isenabled-except-user-rules.DUNE_CACHE_CHECK_PROBABILITYβ check build reproducibility by re-executing randomly chosen rules and comparing their results with those stored in Dune cache. β οΈ note: by increasing the probability of such checks you slow down the build. the default probability is zero, i.e. no rules are checked.DUNE_CACHE_STORAGE_MODEβ Dune cache storage mode (one ofauto,hardlinkorcopy). default ishardlink.DUNE_CROSS_TARGETβ cross-compile using this toolchain.DUNE_DEBUG_PACKAGE_LOGSβ always print the standard logs when building packages.DUNE_DIFF_COMMANDβ shell command to use to diff files. use-to disable printing the diff.DUNE_DISABLE_PROMOTIONβ disable all promotion rules.DUNE_INSTRUMENT_WITHβ enable instrumentation by BACKENDS. BACKENDS is a comma-separated list of library names, each one of which must declare an instrumentation backend.DUNE_JOBSβ run no more than JOBS commands simultaneously. JOBS must be a positive integer orautoto auto-detect the number of cores (the default).DUNE_PROFILEβ build profile.devif unspecified orreleaseif-pis set.DUNE_ROOTβ use this directory as workspace root instead of guessing it. note that this option doesn't change the interpretation of targets given on the command line. it is only intended for scripts.DUNE_SANDBOXβ sandboxing mode to use by default. (see--sandbox)DUNE_STORE_ORIG_SOURCE_DIRβ store original source location indune-packagemetadata.DUNE_TARGET_EXECβ wrapper command for running target binaries when cross-compiling. format:TOOLCHAIN=CMD(e.g.,'windows=wine').DUNE_WORKSPACEβ use this specific workspace file instead of looking it up.
π BUGS π
spotted a bug? not the vibe, but okay. check bug reports at https://github.com/ocaml/dune/issues and we'll figure it out together. π«Ά
π SEE ALSO π
okay that's the whole page bestie, you're officially a dune-rules girly now π
this was Dune 3.24.1, page DUNE-RULES(1) β go forth and build, you absolute icon. πβ¨π
π¦ where this page comes from
- ubuntu stonking: ocaml-dune 3.24.1-4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms