File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 15
15
* limitations under the License.
16
16
*/
17
17
import PackageDescription
18
+ import Foundation
18
19
19
20
var packageDependencies : [ Package . Dependency ] = [
20
21
. package ( url: " https://github.com/apple/swift-protobuf.git " , . upToNextMinor( from: " 1.1.1 " ) ) ,
@@ -26,13 +27,22 @@ var packageDependencies: [Package.Dependency] = [
26
27
]
27
28
28
29
var cGRPCDependencies : [ Target . Dependency ] = [ ]
30
+
29
31
#if os(Linux)
32
+ let isLinux = true
33
+ #else
34
+ let isLinux = false
35
+ #endif
36
+
30
37
// On Linux, Foundation links with openssl, so we'll need to use that instead of BoringSSL.
31
38
// See https://github.com/apple/swift-nio-ssl/issues/16#issuecomment-392705505 for details.
32
- packageDependencies. append ( . package ( url: " https://github.com/apple/swift-nio-ssl-support.git " , from: " 1.0.0 " ) )
33
- #else
34
- cGRPCDependencies. append ( " BoringSSL " )
35
- #endif
39
+ // swift build doesn't pass -Xswiftc flags to dependencies, so here using an environment variable
40
+ // is easiest.
41
+ if isLinux || ProcessInfo . processInfo. environment. keys. contains ( " GRPC_USE_OPENSSL " ) {
42
+ packageDependencies. append ( . package ( url: " https://github.com/apple/swift-nio-ssl-support.git " , from: " 1.0.0 " ) )
43
+ } else {
44
+ cGRPCDependencies. append ( " BoringSSL " )
45
+ }
36
46
37
47
let package = Package (
38
48
name: " SwiftGRPC " ,
You can’t perform that action at this time.
0 commit comments