File tree Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ let macOSPlatform: SupportedPlatform
20
20
if let deploymentTarget = ProcessInfo . processInfo. environment [ " SWIFTPM_MACOS_DEPLOYMENT_TARGET " ] {
21
21
macOSPlatform = . macOS( deploymentTarget)
22
22
} else {
23
- macOSPlatform = . macOS( . v10_13 )
23
+ macOSPlatform = . macOS( . v10_10 )
24
24
}
25
25
26
26
let package = Package (
Original file line number Diff line number Diff line change @@ -1404,9 +1404,15 @@ extension Workspace {
1404
1404
private func download( _ artifacts: [ ManagedArtifact ] , diagnostics: DiagnosticsEngine ) {
1405
1405
let group = DispatchGroup ( )
1406
1406
let tempDiagnostics = DiagnosticsEngine ( )
1407
-
1408
- let netrc = try ? Netrc . load ( fromFileAtPath: netrcFilePath) . get ( )
1409
1407
1408
+ var authProvider : AuthorizationProviding ? = nil
1409
+ #if os(macOS)
1410
+ // Netrc feature currently only supported on macOS 10.13+ due to dependency
1411
+ // on NSTextCheckingResult.range(with:)
1412
+ if #available( macOS 10 . 13 , * ) {
1413
+ authProvider = try ? Netrc . load ( fromFileAtPath: netrcFilePath) . get ( )
1414
+ }
1415
+ #endif
1410
1416
for artifact in artifacts {
1411
1417
group. enter ( )
1412
1418
@@ -1430,7 +1436,7 @@ extension Workspace {
1430
1436
downloader. downloadFile (
1431
1437
at: parsedURL,
1432
1438
to: archivePath,
1433
- withAuthorizationProvider: netrc ,
1439
+ withAuthorizationProvider: authProvider ,
1434
1440
progress: { bytesDownloaded, totalBytesToDownload in
1435
1441
self . delegate? . downloadingBinaryArtifact (
1436
1442
from: url,
Original file line number Diff line number Diff line change @@ -43,7 +43,25 @@ final class PackageToolTests: XCTestCase {
43
43
}
44
44
45
45
func testNetrcFile( ) throws {
46
- XCTAssert ( try execute ( [ " --netrc-file " , " /Users/me/.hidden/.netrc " ] ) . stdout. contains ( " Absolute path to netrc file " ) )
46
+ func verifyUnsupportedOSThrows( ) {
47
+ do {
48
+ // should throw and be caught
49
+ try execute ( [ " --netrc-file " , " /Users/me/.hidden/.netrc " ] )
50
+ XCTFail ( )
51
+ } catch {
52
+ XCTAssert ( true )
53
+ }
54
+ }
55
+ #if os(macOS)
56
+ if #available( macOS 10 . 13 , * ) {
57
+ // should succeed
58
+ XCTAssert ( try execute ( [ " --netrc-file " , " /Users/me/.hidden/.netrc " ] ) . stdout. contains ( " Absolute path to netrc file " ) )
59
+ } else {
60
+ verifyUnsupportedOSThrows ( )
61
+ }
62
+ #else
63
+ verifyUnsupportedOSThrows ( )
64
+ #endif
47
65
}
48
66
49
67
func testResolve( ) throws {
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import PackageDescription
15
15
16
16
let package = Package (
17
17
name: " swift-tools-support-core " ,
18
+ platforms: [ . macOS( . v10_13) ] ,
18
19
products: [
19
20
. library(
20
21
name: " SwiftToolsSupport " ,
You can’t perform that action at this time.
0 commit comments