Buck: buck project

buck project

This command generates the configuration files for an IDE to work with the project. This command creates files in-place in the repository, which is unlike other Buck commands whose output is removed by buck clean. As a result, it is a good idea to add these generated files to the list of ignored files by your choice of source control. IDE-specific details are discussed in each section below.

You can use this command by itself to generate a project for the entire repository.

buck project

You can also use this command to build a project slice (a project that represents a subset of the repository). You can pass any number of build targets or build target patterns to the command. The constructed project slice will contain the specified targets and their dependencies. This is useful for large repositories.

buck project //java/...

Common Parameters

  • --ide Specifies which IDE to create the project for. When using a project slice, Buck tries to determine what type of IDE to use automatically based on the build targets provided. Sometimes it is not possible to determine the type of IDE. You can specify the default ide in the [project] section of your .buckconfig file.
  • --without-tests Indicates that Buck should build a project slice without tests (the default is to include tests on *_library and *_binary rules).
  • --without-dependencies-tests Indicates that Buck should build a project slice with the tests of the specified targets only.

Supported IDEs

IntelliJ

This command processes all of the project_config rules across all of the build files whose targets were specified and uses them to generate the configuration files for an IDE. The generated files include:

  • .idea/libraries/*.xml, each of which defines a library in IntelliJ. A library always corresponds to a prebuilt_jar.
  • .iml files, each of which defines a module in IntelliJ. An .iml file will be created in each directory with a build file that has a project_config. A module can depend on other modules, as well as libraries. It should be noted that although Buck allows multiple build targets per build file, IntelliJ's modules are only defined at the directory level. This means that you may find IntelliJ flagging compilation errors because of missing dependencies of classes outside of your project slice, but which happen to be in the same directory as classes within the slice.
  • .idea/modules.xml, which lists all of the IntelliJ modules in the project.

Xcode

This command processes each apple_binary, apple_bundle, and apple_library specified, and uses them to generate the files and directories that Xcode needs. The generated folders include:

  • For each build target, an *.xcworkspace directory that represents the workspace and contains one or more schemes.
  • For each build target and its dependencies, an *.xcodeproj directory that represents the project. These generated projects are only buildable within the generated workspace.

Parameters

  • --combined-project Indicates that Buck should build a single monoproject for all build targets specified.