@@ -660,12 +660,16 @@ public final class ProductBuildDescription {
660
660
return tempsPath. appending ( component: " Objects.LinkFileList " )
661
661
}
662
662
663
+ /// Diagnostics Engine for emitting diagnostics.
664
+ let diagnostics : DiagnosticsEngine
665
+
663
666
/// 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 ) {
665
668
assert ( product. type != . library( . automatic) , " Automatic type libraries should not be described. " )
666
669
self . product = product
667
670
self . buildParameters = buildParameters
668
671
self . fs = fs
672
+ self . diagnostics = diagnostics
669
673
}
670
674
671
675
/// Strips the arguments which should *never* be passed to Swift compiler
@@ -718,11 +722,12 @@ public final class ProductBuildDescription {
718
722
case . library( . dynamic) :
719
723
args += [ " -emit-library " ]
720
724
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).
722
728
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 ( ) )
726
731
}
727
732
}
728
733
args += [ " -emit-executable " ]
@@ -846,7 +851,7 @@ public class BuildPlan {
846
851
/// The filesystem to operate on.
847
852
let fileSystem : FileSystem
848
853
849
- /// Diagnostics Engine to emit diagnostics
854
+ /// Diagnostics Engine for emitting diagnostics.
850
855
let diagnostics : DiagnosticsEngine
851
856
852
857
/// Create a build plan with build parameters and a package graph.
@@ -923,7 +928,8 @@ public class BuildPlan {
923
928
for product in graph. allProducts where product. type != . library( . automatic) {
924
929
productMap [ product] = ProductBuildDescription (
925
930
product: product, buildParameters: buildParameters,
926
- fs: fileSystem
931
+ fs: fileSystem,
932
+ diagnostics: diagnostics
927
933
)
928
934
}
929
935
@@ -1203,3 +1209,13 @@ struct ProductRequiresHigherPlatformVersion: DiagnosticData {
1203
1209
self . platform = platform
1204
1210
}
1205
1211
}
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