Ddoc
$(D_S rdmd,
Synopsis
In a command prompt:
% cat myprog.d
import std.stdio;
void main()
{
writeln("Hello, world without explicit compilations!");
}
% rdmd myprog
Hello, world without explicit compilations!
%
Inside a D program:
% cat myprog.d
#!/usr/bin/rdmd
import std.stdio;
void main()
{
writeln("Hello, world with automated script running!");
}
% ./myprog.d
Hello, world with automated script running!
%
(Under Windows replace $(B cat) with $(B type) and $(B
#!/usr/bin/rdmd) with $(B #!rdmd), the latter assuming that $(B rdmd)
can be found in your path.)
Description
$(P $(B rdmd) is a companion to the $(B dmd) compiler that simplifies
the typical edit-compile-link-run or edit-make-run cycle to a rapid
edit-run cycle. Like $(B make) and other tools, $(B rdmd) uses the
relative dates of the files involved to minimize the amount of work
necessary. Unlike $(B make), $(B rdmd) tracks dependencies and
freshness without requiring additional information from the user.)
$(P $(B rdmd): $(UL
$(LI shields its user from the notion that producing a running program
from D programming language files may entail several concerted steps
against different source files producing various intermediate files;)
$(LI automatically infers and builds dependent files, transitively, by
following $(B import) directives;)
$(LI recognizes and passes down all of $(B dmd)'s command-line options;)
$(LI understands how various $(B dmd) compiler options (e.g. $(B
-release) vs. $(B -debug)) affect generation of intermediate files,
and avoids conflations (e.g., does not unwittingly run a debug
executable when the release executable is asked for);)
$(LI recompiles files only on a needed basis, e.g. two invocations of
$(B rdmd) in sequence without an intervening change to any relevant
source file does not produce the executable again.)
))
Usage
$(P
$(B rdmd) [$(I dmd and rdmd options)] $(I progfile)[.d] [$(I program arguments)]
)
$(P In addition to $(B dmd)'s options, $(B rdmd) recognizes the following:
)
$(DL
$(DT $(B --build-only)) $(DD just build the executable, don't run it)
$(DT $(B --chatty)) $(DD write dmd commands to stdout before executing
them)
$(DT $(B --compiler)=/path/to/compiler) $(DD use the specified
compiler (e.g. gdmd) instead of dmd)
$(DT $(B --dry-run)) $(DD do not compile, just show what commands
would be run (implies --chatty))
$(DT $(B --eval)=code) $(DD evaluate code including it in $(D_PARAM
void main(char[][] args) { ... }) (multiple --eval allowed, will be
evaluated in turn))
$(DT $(B --force)) $(DD force a rebuild even if apparently not
necessary)
$(DT $(B --help)) $(DD show a help message and exit)
$(DT $(B --loop)=code) $(DD like --eval, but code will be additionally
included in a loop $(D_PARAM foreach (line; stdin.byLine()) { ... }))
$(DT $(B --main)) $(DD add an empty $(D_PARAM void main() {}) function
(useful for running unittests))
$(DT $(B --man)) $(DD open web browser on manual page)
$(DT $(B --shebang)) $(DD rdmd is in a shebang line (put as first argument))
)
Download
$(UL $(LI View syntax-colored $(LINK2
http://dsource.org/projects/phobos/browser/trunk/tools/rdmd.d, source
code))
$(LI $(LINK2
http://dsource.org/projects/phobos/browser/trunk/tools/rdmd.d?format=txt,
Download)))
Author
$(LINK2 http://erdani.org, Andrei Alexandrescu)
)
Macros:
TITLE=rdmd
WIKI=rdmd