Hello, we have a large(17000+ source files in main target + many packages) mixed(Swift+ObjC) project. When we build it on Xcode 12.5.1, everything is ok. When we tried to build it on Xcode 13+, getting compile error "Argument list too long.” We researched and understood that the problem is a buffer(ARG_MAX) overflow when the compiler passes the path to all source files to ARG_MAX.
error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver (Argument list too long)
Command CompileSwiftSources failed with a nonzero exit code
Actually it looks like Xcode already sets that even without the setting in this case. But I found if you set OTHER_SWIFT_FLAGS = -disallow-use-new-driver it works around this issue, sounds like a bug in Swift where it's unpacking the response file and not just forwarding it along to the new driver. Note as of Swift 5.6 this flag is deprecated, but maybe a fix for this will land before its removal