Storing .build directory somewhere else?

Should be quite obvious from subject :slight_smile:

Motivation: I'd like to have my projects synced in iCloud Drive, but I realize that constantly evolving .build folder would just throttle my internet connection (and probably iCloud limits if there are any).

Therefore I thought of extracting those folders to somewhere like /tmp/swiftbuild/mypackagename.

Probably symlinks would do the trick, but I'm not entirely sure. Is there an official way of doing so?

1 Like

SwiftPM has a --build-path option that allows you to specify a custom build directory. You'll have to pass it to every SwiftPM invocation that potentially builds stuff. As far as I know it's not possible to specify it once for the package in a config file.

$ swift package
OVERVIEW: Perform operations on Swift packages

USAGE: swift package [options] subcommand

  --build-path            Specify build/cache directory [default: ./.build]

Oh, forgot about that. Pity that we can't set it in Package.swift though :( Thanks anyway