@@ -660,12 +660,16 @@ public final class ProductBuildDescription {
660660 return tempsPath. appending ( component: " Objects.LinkFileList " )
661661 }
662662
663+ /// Diagnostics Engine for emitting diagnostics.
664+ let diagnostics : DiagnosticsEngine
665+
663666 /// Create a build description for a product.
664- init ( product: ResolvedProduct , buildParameters: BuildParameters , fs: FileSystem ) {
667+ init ( product: ResolvedProduct , buildParameters: BuildParameters , fs: FileSystem , diagnostics : DiagnosticsEngine ) {
665668 assert ( product. type != . library( . automatic) , " Automatic type libraries should not be described. " )
666669 self . product = product
667670 self . buildParameters = buildParameters
668671 self . fs = fs
672+ self . diagnostics = diagnostics
669673 }
670674
671675 /// Strips the arguments which should *never* be passed to Swift compiler
@@ -718,11 +722,12 @@ public final class ProductBuildDescription {
718722 case . library( . dynamic) :
719723 args += [ " -emit-library " ]
720724 case . executable:
721- // Link the Swift stdlib statically if requested.
725+ // Link the Swift stdlib statically, if requested.
726+ //
727+ // FIXME: This does not work for linux yet (SR-648).
722728 if buildParameters. shouldLinkStaticSwiftStdlib {
723- // FIXME: This does not work for linux yet (SR-648).
724- if !buildParameters. triple. isLinux ( ) {
725- args += [ " -static-stdlib " ]
729+ if buildParameters. triple. isDarwin ( ) {
730+ diagnostics. emit ( data: SwiftBackDeployLibrariesNote ( ) )
726731 }
727732 }
728733 args += [ " -emit-executable " ]
@@ -846,7 +851,7 @@ public class BuildPlan {
846851 /// The filesystem to operate on.
847852 let fileSystem : FileSystem
848853
849- /// Diagnostics Engine to emit diagnostics
854+ /// Diagnostics Engine for emitting diagnostics.
850855 let diagnostics : DiagnosticsEngine
851856
852857 /// Create a build plan with build parameters and a package graph.
@@ -923,7 +928,8 @@ public class BuildPlan {
923928 for product in graph. allProducts where product. type != . library( . automatic) {
924929 productMap [ product] = ProductBuildDescription (
925930 product: product, buildParameters: buildParameters,
926- fs: fileSystem
931+ fs: fileSystem,
932+ diagnostics: diagnostics
927933 )
928934 }
929935
@@ -1203,3 +1209,13 @@ struct ProductRequiresHigherPlatformVersion: DiagnosticData {
12031209 self . platform = platform
12041210 }
12051211}
1212+
1213+ struct SwiftBackDeployLibrariesNote : DiagnosticData {
1214+ static let id = DiagnosticID (
1215+ type: SwiftBackDeployLibrariesNote . self,
1216+ name: " org.swift.diags. \( SwiftBackDeployLibrariesNote . self) " ,
1217+ defaultBehavior: . warning,
1218+ description: {
1219+ $0 <<< " Swift compiler no longer supports statically linking the Swift libraries. They're included in the OS by default starting with macOS Mojave 10.14.4 beta 3. For macOS Mojave 10.14.3 and earlier, there's an optional Swift library package that can be downloaded from \" More Downloads \" for Apple Developers at https://developer.apple.com/download/more/ "
1220+ } )
1221+ }
0 commit comments