How can I remove or ignore arguments from the swift compiler

Im trying to use an older xcode toolchain (3.1) with my latest xcode version (10).

Starting with a blank project and trying to build I get the following error.

:0: error: unknown argument: '-enable-batch-mode'
:0: error: unknown argument: '-enforce-exclusivity=checked'
:0: error: unknown argument: '-index-store-path'
Command CompileSwiftSources failed with a nonzero exit code

When I look at the compiler output I can clearly see these parameters being passed (cropped for brevity).

/Library/Developer/Toolchains/swift-3.1-RELEASE.xctoolchain/usr/bin/swiftc -incremental -module-name MyTestApp -Onone -enable-batch-mode -enforce-exclusivity=checked -DDEBUG -sdk

Is it possible to tell the compiler to ignore these parameters or remove them somehow?

I need the source to be running in xcode so I can debug an issue with a legacy project.

Just use the appropriate older version of Xcode. Xcode versions aren't backward compatible with older toolchains.

2 Likes

This is the correct approach. One thing to add is that I also needed to download device support for my newer ios devices and add it to the xcode package,