Thanks for the response @Finagolfin, I was starting to wonder if I was in the right place...
This is inconvenient for me because Xcode and Xcode Cloud don't use snapshot builds. The bug appeared a few months ago, and normally I would expect a fix to appear in the very next bugfix release, e.g. reported in 6.2.0, fixed in 6.2.1. I've been unable to deploy an optimized build for several months now!
Further, the Swift Git repository has 620 branches. A normal developer like me has no way of contributing quick one-off patches to this repository. It is highly dissuading. (This need not be a function of project size, Linux has one public branch, and I can always see if my patch has been pulled into that branch or not.)
They're both 6.2.1, is there some other version I need to know about?
Could you please quote from the document what you're referring to? The word "target" only appears once in the whole doc; "triple" doesn't appear at all. I'm guessing that's programming language, host, and target?
swift build --help shows a --triple argument but it has no description (neither does --sdk for that matter):
BUILD OPTIONS:
-c, --configuration <configuration>
Build with configuration (values: debug, release)
-Xcc <Xcc> Pass flag through to all C compiler invocations.
-Xswiftc <Xswiftc> Pass flag through to all Swift compiler invocations.
-Xlinker <Xlinker> Pass flag through to all linker invocations.
-Xcxx <Xcxx> Pass flag through to all C++ compiler invocations.
--triple <triple>
--sdk <sdk>
--toolchain <toolchain>
--swift-sdk <swift-sdk> Filter for selecting a specific Swift SDK to build with.
--sanitize <sanitize> Turn on runtime checks for erroneous behavior, possible values: address, thread, undefined, scudo, fuzzer. (values: address, thread, undefined, scudo, fuzzer)
The man page for swift has no content either. I would expect a man 1 swift-build page detailing this.
The documentation simply does not provide any guidance whatsoever on how to build for a particular architecture—so far I haven't seen any way to distinguish "the command line arguments were written incorrectly" from "Architecture i386 is unrecognized, here's the list of supported values".
Am I supposed to know the difference between --sdk and --swift-sdk?
Would it be fair to request more documentation aimed at those Swift developers not hacking on the internals? Surely I'm not the only developer who's going to produce builds per platform.
Where do I request this feature more formally? Given that I'm building on a couple different architectures and platforms, I would like my script to just work, or at least for as many platforms as the swift executable supports.
It is definitely a complicated problem and I appreciate the thought going into it; I was thinking something more along the lines of a macro: "If you see this function signature (in the style of Darwin), substitute in this for Glibc, and that for FreeBSD libc" etc. It wouldn't be functionally different than how you can have multiple concrete implementations for a string literal.
This clarifies things a little bit, thanks for the link.
This touches on another learning curve problem I have: Is a normal (non-internal) Swift developer supposed to be reading through Swift Evolution proposals? If the proposal says "Status: Implemented", I would expect that to include documentation, too.
So in short: I would like to write a script to produce a build per platform. I should be able to run this on any of my boxes (that supports zsh or make or whatever is reasonable). If a particular platform can't be targeted, I'd like to report a good excuse why. Is this sort of thing just uncommon, or is this normally done a completely different way?