Home

About

xfBuild is a fast build tool for D. Its main strength lies in the fact that it caches dependencies between modules, as well as their modification times. Hence, it may exactly and trivially infer what to compile when a file is changed. It will usually do its job with just one compiler run (two in rare cases). Normally xfBuild is more than twice as fast as ReBuild in incremental builds. To achieve these merits, it uses a recently added frontend feature, which outputs a file with inter-module dependencies. This feature is supported in DMD >= 1.047, DMD >= 2.031 and LDC >= 0.9.1. xfBuild has been tested on projects with 300+ modules and achieves build times of around 2–3 seconds when just a few modules need to be recompiled therein (on a 1.7GHz Intel Centrino CPU with DMD-Win).

Example

xfbuild.exe Main.d +v +profile +oR:\Main.exe -version=TangoTrace3 -I../ext/ddl -L/M -L/NOPACKFUNCTIONS -g -I../../ -I../ext TangoTrace3.obj -version=DogNoExtSupportAsserts

Options prefixed with + are for xfBuild. The rest is for the compiler.

    +x=PACKAGE      Don't compile any modules within the package
    +full           Perform a full build
    +clean          Remove object files
    +redep          Remove the dependency file
    +v              Print the compilation commands
    +h              Manage headers for faster compilation
    +mod-limit=NUM  Compile max NUM modules at a time
    +D=DEPS         Put the resulting dependencies into DEPS [default: .deps]
    +O=OBJS         Put compiled objects into OBJS [default: .objs]
    +q              Use -oq when compiling (only supported by ldc)
    +noop           Don't use -op when compiling
    +nolink         Don't link
    +o=OUTPUT       Link objects into the resulting binary OUTPUT
    +c=COMPILER     Use the D Compiler COMPILER [default: dmd]
    +C=EXT          Extension of the compiler-generated object files
                    [default: .obj on Windows, .o otherwise]
    +rmo            Reverse Module Order
                    (when compiling - might uncrash OPTLINK)
    +R              Recursively scan directories for modules
    +nodeps         Don't use dependencies' file
    +keeprsp        Don't remove .rsp files upon errors

Multithreading options:
    +threads=NUM           Number of theads to use [default: CPU core count]
    +no-affinity           Do NOT manage process affinity (New feature which
                           should prevent DMD hanging on multi-core systems)
    +linker-affinity=MASK  Process affinity mask for the linker
                           (hexadecimal) [default: 1 (OS-dependent)]


Environment Variables:
        XFBUILDFLAGS You can put any option from above into that variable
                       Note: Keep in mind that command line options override
                             those
        D_COMPILER   The D Compiler to use [default: dmd]
                       Note: XFBUILDFLAGS and command line options override
                             this

xfBuild creates a .deps file to cache dependencies between modules. If something goes wrong (linker crashes, xfBuild crashes), delete this file and cross fingers.

Building xfBuild

Prerequisite: fresh Tango off the trunk and a recent D compiler.

    hg clone http://bitbucket.org/h3r3tic/xfbuild/
    cd xfbuild

then just run ./build.sh or ./ldcBuild.sh or build.bat

Status

Tested on:

  • Windows XP SP3 x86
  • Debian Lenny x86_64
  • Arch 2009.02 x86 Patches of all sorts are welcome. Future plans for xfBuild include flexible configuration and multi-threaded builds.

Updated

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.