@@ -664,12 +664,16 @@ public final class ProductBuildDescription {
664
664
return tempsPath. appending ( component: " Objects.LinkFileList " )
665
665
}
666
666
667
+ /// Diagnostics Engine for emitting diagnostics.
668
+ let diagnostics : DiagnosticsEngine
669
+
667
670
/// 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 ) {
669
672
assert ( product. type != . library( . automatic) , " Automatic type libraries should not be described. " )
670
673
self . product = product
671
674
self . buildParameters = buildParameters
672
675
self . fs = fs
676
+ self . diagnostics = diagnostics
673
677
}
674
678
675
679
/// Strips the arguments which should *never* be passed to Swift compiler
@@ -724,12 +728,12 @@ public final class ProductBuildDescription {
724
728
case . library( . dynamic) :
725
729
args += [ " -emit-library " ]
726
730
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 ( ) )
733
737
}
734
738
}
735
739
args += [ " -emit-executable " ]
@@ -861,7 +865,7 @@ public class BuildPlan {
861
865
/// The filesystem to operate on.
862
866
let fileSystem : FileSystem
863
867
864
- /// Diagnostics Engine to emit diagnostics
868
+ /// Diagnostics Engine for emitting diagnostics.
865
869
let diagnostics : DiagnosticsEngine
866
870
867
871
/// Create a build plan with build parameters and a package graph.
@@ -938,7 +942,8 @@ public class BuildPlan {
938
942
for product in graph. allProducts where product. type != . library( . automatic) {
939
943
productMap [ product] = ProductBuildDescription (
940
944
product: product, buildParameters: buildParameters,
941
- fs: fileSystem
945
+ fs: fileSystem,
946
+ diagnostics: diagnostics
942
947
)
943
948
}
944
949
@@ -1218,3 +1223,13 @@ struct ProductRequiresHigherPlatformVersion: DiagnosticData {
1218
1223
self . platform = platform
1219
1224
}
1220
1225
}
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