[swift-dev] Override the path to the Swift compiler?

Greg Parker gparker at apple.com
Thu Jun 1 15:50:26 CDT 2017

> On May 30, 2017, at 4:48 PM, Jimmy Yue via swift-dev <swift-dev at swift.org> wrote:
> Hey Swift Devs,
> Does there happen to be an environment variable, similar to 'CC' for C, that I could use to override the path to the Swift compiler? If so, is there also one for ibtool, metal, etc.?
> I want to redirect swift calls to a bash script that does some processing before running the original compile call. Preferably, I would have all the information available to the swift call (input files, output files, etc.), which makes using a build rule a little difficult.

You might be able to do this using the "Build Rules" settings in Xcode. (project settings > target settings > Build Rules > click Copy to Target for the file type you are interested in)

Xcode honors SWIFT_LIBRARY_PATH and SWIFT_EXEC in project settings, but that is designed to substitute the entire Swift toolchain, not just the Swift compiler itself. SWIFT_EXEC might work if your wrapper script lives next to swiftc in the filesystem.

Greg Parker     gparker at apple.com <mailto:gparker at apple.com>     Runtime Wrangler

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170601/4b99b2df/attachment.html>

More information about the swift-dev mailing list