@@ -664,12 +664,16 @@ public final class ProductBuildDescription {
664664 return tempsPath. appending ( component: " Objects.LinkFileList " )
665665 }
666666
667+ /// Diagnostics Engine for emitting diagnostics.
668+ let diagnostics : DiagnosticsEngine
669+
667670 /// Create a build description for a product.
668- init ( product: ResolvedProduct , buildParameters: BuildParameters , fs: FileSystem ) {
671+ init ( product: ResolvedProduct , buildParameters: BuildParameters , fs: FileSystem , diagnostics : DiagnosticsEngine ) {
669672 assert ( product. type != . library( . automatic) , " Automatic type libraries should not be described. " )
670673 self . product = product
671674 self . buildParameters = buildParameters
672675 self . fs = fs
676+ self . diagnostics = diagnostics
673677 }
674678
675679 /// Strips the arguments which should *never* be passed to Swift compiler
@@ -724,12 +728,12 @@ public final class ProductBuildDescription {
724728 case . library( . dynamic) :
725729 args += [ " -emit-library " ]
726730 case . executable:
727- // Link the Swift stdlib statically if requested.
728- if containsSwiftTargets ,
729- buildParameters . shouldLinkStaticSwiftStdlib {
730- // FIXME: This does not work for linux yet (SR-648).
731- if ! buildParameters. triple. isLinux ( ) {
732- args += [ " -static-stdlib " ]
731+ // Link the Swift stdlib statically, if requested.
732+ //
733+ // FIXME: This does not work for linux yet (SR-648).
734+ if buildParameters . shouldLinkStaticSwiftStdlib {
735+ if buildParameters. triple. isDarwin ( ) {
736+ diagnostics . emit ( data : SwiftBackDeployLibrariesNote ( ) )
733737 }
734738 }
735739 args += [ " -emit-executable " ]
@@ -861,7 +865,7 @@ public class BuildPlan {
861865 /// The filesystem to operate on.
862866 let fileSystem : FileSystem
863867
864- /// Diagnostics Engine to emit diagnostics
868+ /// Diagnostics Engine for emitting diagnostics.
865869 let diagnostics : DiagnosticsEngine
866870
867871 /// Create a build plan with build parameters and a package graph.
@@ -938,7 +942,8 @@ public class BuildPlan {
938942 for product in graph. allProducts where product. type != . library( . automatic) {
939943 productMap [ product] = ProductBuildDescription (
940944 product: product, buildParameters: buildParameters,
941- fs: fileSystem
945+ fs: fileSystem,
946+ diagnostics: diagnostics
942947 )
943948 }
944949
@@ -1218,3 +1223,13 @@ struct ProductRequiresHigherPlatformVersion: DiagnosticData {
12181223 self . platform = platform
12191224 }
12201225}
1226+
1227+ struct SwiftBackDeployLibrariesNote : DiagnosticData {
1228+ static let id = DiagnosticID (
1229+ type: SwiftBackDeployLibrariesNote . self,
1230+ name: " org.swift.diags. \( SwiftBackDeployLibrariesNote . self) " ,
1231+ defaultBehavior: . warning,
1232+ description: {
1233+ $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/ "
1234+ } )
1235+ }
0 commit comments