Currently, SwiftSyntax is only supported on Darwin. Given that this library is written using Swift, it does take advantage of Foundation for some functionality (and thus, indirectly, on libdispatch and CoreFoundation).
Having the library be available on other platforms makes it possible to write tools that can work with swift code on other targets (e.g. Linux). This means that it is possible to be able to develop across Linux or Darwin.
There exists a swift implementation of Foundation (swift-corelibs-foundation) and it would be possible to use that to provide Foundation on targets that do not have an Objective-C implementation. It may be interesting to see if it is possible to use that implementation everywhere in the future.
Another option would be to remove the dependency on Foundation from SwiftSyntax. While certainly an option, I think that Foundation is meant to abstract the differences of the underlying platform, and as such, is a useful tool to have at that level. It protects SwiftSyntax from having to implement things like process launching for each target.
I think that having an option to control if SwiftSyntax is built would be a good way to introduce a soft dependency on Foundation. The option would default to true on Darwin (maintaining the status quo). On Linux, if the swift-corelibs-foundation tree is present, we would build it, otherwise we would not. If the tree is present, it would allow us to enable the SwiftSyntax build by default. Having the option exposed means that the user can make an explicit call if they like.
This would allow us to make progress on enabling SwiftSyntax on other platforms, while also allowing a bit more time to determine the best path forward longer term (remove the dependency on Foundation or embrace it). It could be that using Foundation really helps simplify the SwiftSyntax source tree. In the mean time, it also would serve as a test for the swift implementation, helping expose latent issues (as it did with NSFIleHandle and NSPipe).
Another option may be to split SwiftSyntax out of the core swift repository. It may make sense to do that as the library is not directly integrated into the compiler build.
With the option to control if the library is built, we can continue to make progress in building and enabling SwiftSyntax on other hosts. It allows for different sets of developers to work on different aspects simultaneously, which would be a boon to productivity.
CC: @Xi_Ge, @tkremenek, @Michael_Gottesman, @DaveZ