Buck: project_config()


This is liable to change in the future.

A project_config() rule is used to specify the information needed to generate the configuration files for an IDE so the primary build target (and optionally its tests) of a BUCK file can be built using that IDE.

Note that there may only be one project_config() rule per BUCK file.


  • src_target (required) #

    A build rule that will serve as the basis of the generated project. Currently, it must be one of: java_library(), java_test(), android_library(), or android_binary(). The generated IDE project will be of a type that corresponds to the type of the rule.

    Also, the deps of this rule will determine the other IDE projects on which the IDE project for this rule depends. Note that this is a heuristic, but it appears to work reasonably well, in practice.

  • src_roots (defaults to []) #

    The root directories of the source code that correspond to src_target. Values may include:

    • None There are no source roots. This could happen if src_target identifies an Android library project that is purely resources and no Java code.
    • [] The directory that contains the build file is a Java package. In this case, the root of the package must be one of the ancestor directories. Buck can deduce where the root of the package is by using the src_roots property in the [java] section of the .buckconfig.
    • ['src'] The src directory under the build file directory is a source root. This list may contain multiple elements, but in practice, it should almost always contain at most one element. This option supports a list to allow generated source code to be checked in alongside the hand-written source of imported projects. In this case, src_roots would be ['src', 'src-gen'].

  • test_target (defaults to None) #

    If specified, a complementary tests project for src_target. In IntelliJ, source and test code can be grouped together in the same module while having different classpaths. In Eclipse, source and test code are often in separate projects because they need to have different classpaths.

  • test_roots (defaults to []) #

    Same as src_roots, but for test_target.

  • visibility (defaults to []) #

    List of build target patterns that identify the build rules that can include this rule in its deps.

  • licenses (defaults to []) #

    Set of license files for this library. To get the list of license files for a given build rule and all of its dependencies, you can use buck query.

  • labels (defaults to []) #

    Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using buck query attrfilter.


  src_target = ':lib-base',
  src_roots = [ 'src' ],
  test_target = ':tests',
  test_roots = ['tests'],