blob: 4980d2357661f7ccd118733790947d06d8ef5e1e [file] [log] [blame]
{namespace buck.buckconfig}
{template .soyweb}
{param title: '.buckconfig' /}
{param content}
The root of your project may contain a configuration file
named <code>.buckconfig</code>. If present, Buck will read this file
before executing its business logic so that any customizations specified
in <code>.buckconfig</code> will take effect. This file uses the
{sp}<a href="">INI file format</a>.
The root of your project may also contain a second configuration file
named <code>.buckconfig.local</code>. Its format is exactly the same as
that of <code>.buckconfig</code>, but any definition in <code>.buckconfig.local</code>{sp}
will override that of <code>.buckconfig</code>. In practice, <code>.buckconfig</code> will be a
version-controlled file that contains settings that are applicable to all team members (such as
standard includes for build files), whereas <code>.buckconfig.local</code> will be excluded from
version control because it contains user-specific overrides (such as personal aliases).
As demonstrated in the <a href="{ROOT}setup/quick_start.html">Quick Start</a>{sp}
instructions, aliases for build targets can be defined in
app = //apps/myapp:app
apptest = //apps/myapp:test
This facilitates command-line use:
buck build app
buck test apptest
This section may define an <code>includes</code> property that can specify a
path to a file of macros and constants that will automatically be included in
every build file. Therefore, defining the following:
includes = //core/DEFS
is the equivalent of manually invoking <code>include_defs('//core/DEFS')</code>
{sp}at the start of every build file. See
{sp}<a href="{ROOT}function/include_defs.html"><code>include_defs()</code></a>
{sp}for more details.
This section configures build artifact caching, which can be disabled
(default), on the filesystem, or in a distributed cache that can be shared
among developers. Note that the <code>mode</code> property determines which
other properties, if any, are relevant to caching configuration. The following
example configures buck to use directory-based caching, in which case the
Cassandra-related settings are ignored.
# Build artifact caching configuration.
# mode is a comma-separated set of caching mechanisms to use:
# dir : Use a directory-based cache.
# cassandra : Use a distributed Cassandra cache.
# The default set is empty.
mode = dir, cassandra
# Directory path used for directory-based caching. The default directory is
# buck-cache.
dir = buck-cache
# Comma-separated set of known Cassandra cache nodes, for example:
# hosts =,
# The default set is empty.
hosts = localhost
# Port on which to connect to Cassandra cache nodes. The default port is
# 9160.
port = 9160
# Treat the Cassandra cache as readonly or readwrite. The default mode is
# readwrite.
cassandra_mode = readwrite
Initial Cassandra setup is generally straightforward, and warrants no special
instructions beyond the following:
<li>The <code>thrift_framed_transport_size_in_mb</code> and
{sp}<code>thrift_max_message_length_in_mb</code> defaults may be too low,
depending on maximum artifact size. If these settings are left too low,
then larger artifacts will not be cached and throughput may suffer due to
network transport error recovery.
<li>The <code>scripts/init_cassandra_node.cql</code> script must be run once
in order to create the <code>ArtifactCache</code> keyspace that buck
Specify the following to disable colorized output:
ui = false
This section may define a <code>src_roots</code> property that specifies
file paths to roots of Java code (where a root contains a tree
of Java folders where the folder structure mirrors the package structure).
This list of paths is comma-delimited. Paths that start with a slash are
relative to the root of the project. All other paths can match a folder
anywhere in the tree. For example:
src_roots = src, /java/, /javatests/
Will match the <code>java</code> and <code>javatests</code> folders in the
root of the project, as well as any folder named <code>src</code> in the
<strong>Note:</strong> This is primarily used as a hack to help determine
where resources from a <code>java_library()</code> should be placed within the
generated JAR file. Hopefully <code>src_roots</code> will be removed at some
This section may define both <code>min_version</code> and{sp}
<code>max_version</code> properties to enable Buck to check before building an{sp}
{call buck.ndk_library /} that the project supports the configured NDK. Both
properties must be specified to enable this check. For example, to support
only versions r7 through r8d:
min_version = r7
max_version = r8d
This section may define a <code>timeout</code> for each test that buck runs.
The value given is in milliseconds.
# This specifies a maximum timeout of 5 minutes (300000
# milliseconds) per test. A JUnit test can override this
# via its `@Test` annotation.
timeout = 300000
This section may define a <code>default_android_manifest</code> property
to identify the <code>AndroidManifest.xml</code> that should be used when
the <code>src_target</code> of a
{sp}<a href="{ROOT}rule/project_config.html"><code>project_config()</code>
</a> rule is an Android rule (e.g.,
{sp}<a href="{ROOT}rule/android_library.html"><code>android_library()</code>
</a>), but there is no <code>AndroidManifest.xml</code> file in the same
directory as the build file. Because an IDE configuration for an Android
project needs an <code>AndroidManifest.xml</code>, this provides a convenient
fallback, preventing the need to litter your project with boilerplate
{sp}<code>AndroidManifest.xml</code> files.
default_android_manifest = //shared/AndroidManifest.xml
This section may also define an <code>initial_targets</code> property,
which is a space-delimited list of build targets to run when
{sp}<code>buck project</code> is executed. Frequently, this is a list of
{sp}<code>genrule</code>s whose outputs need to exist in order for an IDE
to be able to build a project natively (i.e., without the help of Buck).
For example, if you had a <code>genrule()</code> for generating a JAR from
a <a href="">Thrift definition file</a>, and you had
a <code>java_library()</code> rule that depended on that JAR, then you would
want to be sure that <code>genrule()</code> was built before importing the
project into IntelliJ because IntelliJ does not know how to build
your <code>genrule()</code> as part of its built-in build process:
initial_targets = //java/com/facebook/schema:generate_thrift_jar
This section may also define an <code>ignore</code> property that specifies a
comma-separated list of subtrees within the project root which are ignored in
the following contexts:
<li>Buck daemon filesystem monitoring
<li>Filesystem traversal when searching for tests and BUCK files
<li>IntelliJ project indexing
Buck automatically excludes its own output, e.g. <code>buck-out</code>,
{sp}<code>.buckd</code>, and <code>.idea</code>, as well as the cache directory
(see the "dir" setting of the "cache" section), but it makes no assumptions
about source control systems.
ignore = .git
This section may also define a <code>temp_files</code> property that
specifies a comma-separated list of <code>java.util.regex.Pattern</code> regular
expressions which match temporary and backup files which should be ignored by Buck
daemon filesystem monitoring. Setting this property to match any temporary files
created by your IDE or editor will avoid unnecessary cache invalidation when using
the Buck daemon.
temp_files = ^#.*#$, .*~$, .*\.swp$
A <code>post_process</code> property can reference a script that should be
executed after the project files are generated. Because <code>buck project</code> is
currently based on heuristics, the IntelliJ project that it generates may not be
exactly what you want if you are using a non-traditional project structure.
In these cases, you may want to let <code>buck project</code> do the bulk of the
heavy-lifting, and then let your <code>post_process</code> script do some cleanup
on the generated files.
post_process = ./scripts/
This section controls how buck will log information about builds for later
max_traces = 25
Will limit buck to creating, at most, 25{sp}
<a href="{ROOT}about/performance_tuning.html">Chrome Traces</a>.