Using `swift-build-tool` to build a llbuild manifest

Hi there,

I'm trying to deepen my understanding of llbuild manifests for mixed language targets. I have created several simple Xcode projects:

  • Swift Package with only Swift sources
  • Swift Package with only Objective-C sources
  • Framework with mixed Swift and Objective-C sources
  • CocoaPods project with mixed Swift and Objective-C sources

I've noticed that for each product, the Xcode build log looks like steps from an llbuild manifest.

I'm trying to experiment on a new project structure and directly calling swift-build-tool on a custom .yaml llbuild manifest seems like a good way to iterate on how Xcode would build this new project structure.

I have cloned apple/swift-llbuild and followed the build instructions.

To start out, I noticed that building a Swift Package leaves a debug.yaml in the package's .build/ directory. This file looks like a llbuild manifest so my naive assumption is that I can directly invoke swift-build-tool to build the manifest.

Starting out simple, I know my Swift Package with only Swift sources builds successfully with swift build so tried to invoke swift-build-tool on the debug.yaml that is left in the .build/ after running swift build.
I ran:

‣ pwd  /Users/nickcooke/Developer/swift-llbuild/build/bin
‣ ./swift-build-tool \
    --verbose \
    --chdir /Users/nickcooke/Developer/SwiftPackage \
    -f .build/debug.yaml \
    "main"

And received:

.build/debug.yaml:2:3: error: unable to configure client
  name: basic
  ^
<unknown>:0: error: unable to load build file

I've searched around and feel a bit blocked on how to proceed.

Any input regarding the issue or my approach is very much appreciated!


Edit: I also tried using Xcode's built in swift-build-tool but got the same result!

‣ $(xcode-select --print-path)/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool \
    --verbose \
    -f .build/debug.yaml \
    "main"
2 Likes

You may have more luck using xcrun llbuild -- that said, I am not sure how well the llbuild CLI works, both SwiftPM and Xcode interact with llbuild through its library interface.

1 Like