Xcode build: support passing parameters via response files

Number:rdar://50886131 Date Originated:17/05/2019
Status:Open Resolved:No
Product:Developer Tools: Xcode Product Version:10.2.1
Classification:Serious Bug Reproducible:Yes
When a Swift project is big enough, the build system generates a SwiftC command that does not fit the command line length on the host system, failing to build the project. SwiftC (from Swift 5.0 on) support passing parameters via response files (i.e., swiftc @foo.txt where foo.txt contains the arguments) just as clang and many other compilers do. So the compiler feature is present in Swift 5.0, but Xcode appears to still need to be updated to write its command line arguments to a @params file in order for it to work. Therefore, it is not possible to build large swift modules (between 1000-2000 swift files depending on the length of the project path).

Swift PRs fixing the issue can be found here:
- https://github.com/apple/swift/pull/15853
- https://github.com/apple/swift/pull/16362

Forum thread here: https://forums.swift.org/t/swift-compilation-reaching-arg-max-limit-causing-xcode-build-failure/6494/3

Stackoverflow response with a summary of the issue: https://stackoverflow.com/questions/48457585/zombie-archiving-failed-using-integration-menu/48525938#48525938

Steps to Reproduce:
1. Clone https://github.com/Lascorbe/ManyFiles project (a fork of previous work by Gregor Dschung: https://github.com/chkpnt/ManyFiles).
2. Open ManyFiles.xcodeproj in Xcode
3. Build project
4. Build fails with error:

- With the new build system -
unable to spawn process (Argument list too long)

- With the legacy build system -
Build operation failed without specifying any errors. Individual build tasks may have failed for unknown reasons. One possible cause is if there are too many (possibly zombie) processes; in this case, rebooting may fix the problem. Some individual build task failures (up to 12) may be listed below.

Expected Results:
Xcode builds the module.

Actual Results:
Xcode fails to build the module.

Xcode 10.2.1 (10E1001)

macOS 10.14.4, Swift 5


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!