Buck: Common Parameters

Common Parameters

Some command-line parameters affect the operation of Buck itself, regardless of which subcommand is being run.

Parameters

  • --verbose

    Sets the verbosity level of the console output. For example:

    buck targets --verbose 10
    

  • --no-cache

    Disables the build artifact cache.

  • --config

    Overrides settings specified in .buckconfig. For example:

    buck build --config cache.mode=dir ...
    

    The --config parameter can be specified multiple times on the same command line. Note, however, that if the same configuration option is specified more than once, Buck uses the last value specified ("last write wins"). For example, the following invocation of buck build builds the //:prod target, rather than the //:dev target, which was specified earlier on the command line.

    #
    # Build for development? 
    #
    # No, build for production.
    #
    buck build --config 'alias.main=//:dev' --config 'alias.main=//:prod' main
    

    The preferred method of overriding values in .buckconfig is by using a .buckconfig.local file. Overriding values of .buckconfig from the command line makes reproducing builds difficult.

  • --num-threads

    The number of threads that buck should use when executing jobs. This defaults to 1.25 times the number of processors in the system; on systems with hyperthreading, this means that each core is counted twice. The number of threads to use for building can also be set by adding a "threads" key to the "build" section of the .buckconfig file.

    The order of precedence for setting the number of build threads (from highest to lowest) is:

    1. command-line option
    2. .buckconfig setting
    3. default value

    The number of active threads may not always be equal to this argument.

  • --flagfile /path/to/commandline-args or @/path/to/commandline-args

    Additional command-line arguments can be stored in external files (flag files), one argument per line. The arguments in these files can themselves be --flagfile or @ arguments, which would then include a second file's contents as arguments.

    # File config/common
    --verbose
    

    # File config/gcc
    @config/common
    --config
    cxx.cxx=/usr/bin/g++
    ...
    

    # File config/clang
    @config/common
    --config
    cxx.cxx=/usr/bin/clang++
    ...
    

    buck build @config/gcc foo/bar:
    buck build @config/clang foo/bar:
    

    Lines in flag files must not have any leading or trailing white space.

    The equals sign (=) separates the specified property and value. There should be no whitespace between the property and equals sign, nor between the equals sign and the value.

    We recommend that you use --flagfile rather than the @ symbol as it is more self-describing.

    If Buck is regularly invoked with different sets of arguments, we recommend that you use flag files, as they can be stored in source control, making builds more reproducible.