DUNE-TOP(1)
π DUNE-TOP(1) π
okay bestie. so you found yourself in the Dune Manual and this lil page is DUNE-TOP β the one that spits out toplevel directives. buckle up, we're going shopping for directives. ποΈβ¨
πΈ NAME πΈ
dune-top β print a list of toplevel directives for including directories and loading cma files. that's it. that's the whole vibe. π
π¦ SYNOPSIS π¦
dune top [OPTION]β¦ [DIR]
π DESCRIPTION π
Print a list of toplevel directives for including directories and loading cma files. like, that's the job. no notes. π
The output of dune ocaml top should be evaluated in a toplevel to make the libraries available there. so you don't just stare at it, bestie, you feed it to your toplevel. π§
In many toplevels this can be achieved by using the #use_output command, e.g.:
#use_output "dune ocaml top"
slay. that's literally the entire move. π
β¨ OPTIONS β¨
--action-stderr-on-success=VALβ same as--action-stdout-on-successbut for standard error instead of standard output. ngl a genuinely good default for large mono-repos is--action-stdout-on-success=swallowplus--action-stderr-on-success=must-be-empty. that combo guarantees a successful build has a "clean" empty output. immaculate. π--action-stdout-on-success=VALβ tells Dune how to handle the standard output of actions when they succeed. possible values, bestie:print(just print it to Dune's output),swallow(completely ignore it), andmust-be-empty(enforce that the action printed nothing β with this one, Dune treats the action as failed if it printed anything to its standard output). the default isprint. π«--build-infoβ show build information. it's giving receipts. π§Ύ--context=CONTEXT(absent=default) β select the context where to build/run top. π--display-separate-messagesβ separate error messages with a blank line. room to breathe, periodt. πΈ--error-reporting=VAL(absent=deterministic) β controls when build errors get reported.earlyreports errors as soon as they're discovered.deterministicreports errors at the end of the build in a deterministic order.twicereports each error twice: once as soon as it's discovered, and then again at the end of the build, in a deterministic order. choose your fighter. π₯-f,--forceβ force actions associated to aliases to be re-executed even if their dependencies haven't changed. no cap, it just does it anyway. πͺ--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. π--passive-watch-modeβ similar to[--watch], but it only starts a build when instructed externally by an RPC. it waits to be told. lowkey iconic. π--sandbox=VAL(absentDUNE_SANDBOXenv) β set the sandboxing mode. some actions require a certain sandboxing mode, so they will ignore this setting. allowed values are:none,symlink,copy,hardlink. π§--stop-on-first-errorβ stop the build as soon as an error is encountered. no second chances, we're done here. β-w,--watchβ instead of terminating the build after completion, wait continuously for file changes. it just. keeps. watching. ποΈπποΈ--wait-for-filesystem-clockβ Dune digests file contents for better incremental builds, and 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 filesystem clock to advance so it doesn't need to drop anything. 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. π°οΈβ¨
π COMMON OPTIONS π
these options are common to all commands. like, the whole family. π«Ά
--always-show-command-lineβ always show the full command lines of programs executed by dune. π--auto-promoteβ automatically promote files. this is similar to runningdune promoteafter the build. π«--build-dir=FILE(absentDUNE_BUILD_DIRenv) β specified build directory._buildif unspecified. π--cache=VAL(absentDUNE_CACHEenv) β enable or disable Dune cache (one ofdisabled,enabled-except-user-rulesorenabled). default isenabled-except-user-rules. π--cache-check-probability=VAL(absentDUNE_CACHE_CHECK_PROBABILITYenv) β 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. π΄--cache-storage-mode=VAL(absentDUNE_CACHE_STORAGE_MODEenv) β Dune cache storage mode (one ofauto,hardlinkorcopy). default ishardlink. ποΈ--config-file=FILEβ load this configuration file instead of the default one. not like other configs. π--debug-backtracesβ always print exception backtraces. π--debug-dependency-pathβ in case of error, print the dependency path from the targets on the command line to the rule that failed. π΅οΈ--debug-package-logs(absentDUNE_DEBUG_PACKAGE_LOGSenv) β always print the standard logs when building packages. π--default-target=TARGET(absent=@@default) β set the default target that is used when none is specified todune build. π―--diff-command=VAL(absentDUNE_DIFF_COMMANDenv) β shell command to use to diff files. use-to disable printing the diff. π--disable-promotion(absentDUNE_DISABLE_PROMOTIONenv) β disable all promotion rules. π«--display=MODEβ control the display mode of Dune. seedune-config(5)for more details. valid values for this option areprogress,verbose,short,quietortui. πΊ--dump-gc-stats=FILEβ dump the garbage collector stats to a file after the build is complete. ποΈβ¨--help[=FMT](default=auto) β show this help in format FMT. the value FMT must be one ofauto,pager,grofforplain. withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined. π--ignore-promoted-rulesβ ignore rules with(mode promote), except ones with(only ...). the variable%{ignoring_promoted_rules}in dune files reflects whether this option was passed or not. π«₯--instrument-with=BACKENDS(absentDUNE_INSTRUMENT_WITHenv) β enable instrumentation by BACKENDS. BACKENDS is a comma-separated list of library names, each one of which must declare an instrumentation backend. ποΈ-j JOBS(absentDUNE_JOBSenv) β run no more than JOBS commands simultaneously. JOBS must be a positive integer orautoto auto-detect the number of cores (the default). π§΅--no-bufferβ do not buffer the output of commands executed by dune. by default dune buffers the output of subcommands, in order to prevent interleaving when multiple commands are executed in parallel. however, this can be an issue when debugging long running tests. with--no-buffer, commands have 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 in conjunction with-j 1, to avoid interleaving. additionally you should use--verboseas well, to make sure that commands are printed before they are being executed. π°--no-configβ do not load the configuration file. π--no-print-directoryβ suppress"Entering directory"messages. π€«--only-packages=PACKAGESβ ignore stanzas referring to a package that is not 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 is mostly meant for releases. during development, it is likely that what you 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, in order to build only what's necessary when your project contains multiple packages as well as getting reproducible builds. β οΈ required, bestie, don't skip it.--pkg=VALβ enable or disable package management. the default behaviour depends on whether a lock directory exists. π--profile=VAL(absentDUNE_PROFILEenv) β select the build profile, for instancedevorrelease. the default isdev. π--promote-install-files[=VAL](default=true) β promote any generated<package>.installfiles to the source tree. π€--releaseβ put 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 option for release builds. for instance, you must use this option in your<package>.opamfiles. except if you already use-p, as-pimplies this option. π--require-dune-project-file[=VAL](default=true) β fail if adune-projectfile is missing. π¨--root=DIR(absentDUNE_ROOTenv) β 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. π³--store-orig-source-dir(absentDUNE_STORE_ORIG_SOURCE_DIRenv) β store original source location indune-packagemetadata. ποΈ--target-exec=TOOLCHAIN=CMD(absentDUNE_TARGET_EXECenv) β wrapper command for running target binaries when cross-compiling. format:TOOLCHAIN=CMD(e.g.,'windows=wine'). π·--terminal-persistence=MODEβ change how the log of build results are displayed to the console between rebuilds while in--watchmode. supported modes:preserve,clear-on-rebuild,clear-on-rebuild-and-flush-history. π₯οΈ--trace-file=FILEβ output trace data in catapult format (compatible withchrome://tracing). π--verboseβ same as--display verbose. π£οΈ--versionβ show version information. π·οΈ--watch-exclusions=REGEXβ adds a POSIX regular expression that will exclude matching directories fromdune build --watch. the option--watch-exclusionscan be repeated to add multiple exclusions. semicolons can be also used as a separator. if no exclusions are provided, then a standard set of exclusions is used; however, if one or more--watch-exclusionsare used, none of the standard exclusions are used. the standard exclusions are:^_opam/_opam^_esy/_esy^\.#.*/\.#.*~$^#[^#]*#$/#[^#]*#$^4913$/4913$/.git/.hg:/windows. π§--workspace=FILE(absentDUNE_WORKSPACEenv) β use this specific workspace file instead of looking it up. π-x VAL(absentDUNE_CROSS_TARGETenv) β cross-compile using this toolchain. π
π«Ά MORE HELP π«Ά
Use dune COMMAND --help for help on a single command. one command at a time, we love a focused queen. π
β EXIT STATUS β
dune top exits with:
0β on success. we love to see it. π1β if an error happened. π130β if it was interrupted by a signal. π
bestie there's more coming β part 2 is right behind this one, don't go anywhere π
πΈ ENVIRONMENT πΈ
okay bestie, these are the little environment variables that change how topβ¦ wait, no, how dune behaves when you run it π they're like the settings your terminal hands over before you even say a word. Set them in your shell, in your CI, wherever β they all affect the execution of top. Yes, the manpage says top. We're just keeping it real. β¨
DUNE_BUILD_DIRβ the build directory you want, periodt. If you don't say anything, it's_buildand that's that πDUNE_CACHEβ turns the Dune cache on or off, and it takes one ofdisabled,enabled-except-user-rulesorenabled. The default isenabled-except-user-rules. Likeβ¦ she has opinions, but she's reasonable πDUNE_CACHE_CHECK_PROBABILITYβ checks whether your build is actually reproducible by re-running randomly chosen rules and comparing their results to the ones already chilling in the Dune cache π¦. Warning bestie: bumping this probability up slows your build down. The default probability is zero, meaning no rules get checked at all. Zero. None. Living free πDUNE_CACHE_STORAGE_MODEβ the storage mode the Dune cache uses, one ofauto,hardlinkorcopy. Default ishardlink. Linky link πDUNE_CROSS_TARGETβ cross-compile using this toolchain π οΈDUNE_DEBUG_PACKAGE_LOGSβ always print the standard logs when building packages. Not sometimes. Always. The logs are the moment and she will not hide them π’DUNE_DIFF_COMMANDβ the shell command used to diff files. Pass-if you want to disable printing the diff entirely. Use-if the diff is giving too much πDUNE_DISABLE_PROMOTIONβ disables all promotion rules. Every single one. Bye πDUNE_INSTRUMENT_WITHβ enables instrumentation by BACKENDS. BACKENDS is a comma-separated list of library names, and each one of those libraries has to declare an instrumentation backend. No backend declaration, no entry π«DUNE_JOBSβ run no more than JOBS commands at the same time. JOBS has to be a positive integer, orautoto auto-detect the number of cores (that's the default). Casual parallel slay π₯DUNE_PROFILEβ the build profile. It'sdevif nothing is specified, orreleaseif-pis set ποΈDUNE_ROOTβ use this directory as the workspace root instead of letting dune guess it. Heads up though: this option doesn't change how targets given on the command line are interpreted, okay? It's only intended for scripts. Scripts only. Iconic but stay in your lane π§DUNE_SANDBOXβ the sandboxing mode to use by default. (see--sandbox) ποΈDUNE_STORE_ORIG_SOURCE_DIRβ stores the original source location indune-packagemetadata. Memory unlocked πDUNE_TARGET_EXECβ a wrapper command for running target binaries when cross-compiling. Format isTOOLCHAIN=CMD, for example'windows=wine'πDUNE_WORKSPACEβ use this specific workspace file instead of looking it up. No hunting, no guessing, you already know her π
π BUGS π
Found a bug? Not the vibe, but also so valid β check the bug reports at https://github.com/ocaml/dune/issues and tell the maintainers everything ππ«Ά
π SEE ALSO π
dune(1)β go read her too, she's the main character π
and that's a wrap, bestie β¨ this was the manpage for Dune 3.24.1, the DUNE-TOP(1) page β go build something iconic with it. no cap, you got this π
ππ
π¦ 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