简体   繁体   中英

How do I install Facebook's Buck Build onto an existing Xcode project?

I am having trouble trouble installing Buck with an existing Xcode project. I was able to successfully get it working with the sample project though. When I try to do it with my project I get a variety of errors such as Error: Could not find or load main class com.facebook.buck.cli.bootstrapper.ClassLoaderBootstrapper . What are some step by step instructions on how to add it successfully?

To generate an XCode project from Buck build files use:

buck project --ide xcode

See the documentation for more information.

If you want to build with Buck, then you need to create the appropriate Buck targets in your BUCK files. For example:

apple_binary(
  name = 'MyBinary',
  deps = [
    ':MyLibrary',
    '//Libraries:AnotherLibrary',
  ],
  preprocessor_flags = ['-fobjc-arc'],
  headers = [
    'MyHeader.h',
  ],
  srcs = [
    'MySource.m',
  ],
  frameworks = [
    '$SDKROOT/System/Library/Frameworks/UIKit.framework',
    '$SDKROOT/System/Library/Frameworks/Foundation.framework',
  ],
)

There are more examples on the Buck website .

As far as I know, there is no automated way to create Buck files from an Xcode project; you can only go the other way. Writing a Buck file is very easy though, and perhaps a good opportunity to tidy up your project.

Once you have written your BUCK files, you can build using:

buck build :MyBinary

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM